added game font rendering using etxt to player hud, fixed current level

This commit is contained in:
2024-03-01 18:10:09 +01:00
parent ae8058e052
commit a2ed7782b2
10 changed files with 41 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
Description: test obstacles
Description: open the door
MinMoves: 2
Background: background-lila

View File

@@ -1,4 +1,4 @@
Description: find the fruit
Description: collect all yellow dots
MinMoves: 7
Background: background-lila

View File

@@ -1,4 +1,4 @@
Description: win
Description: some enemies can be moved
MinMoves: 5
Background: background-lila

View File

@@ -1,4 +1,4 @@
Description: use multiple players
Description: the more players the better
MinMoves: 4
Background: background-lila

View File

@@ -1,4 +1,4 @@
Description: space
Description: don't fall off the world
MinMoves: 3
Background: background-lila

View File

@@ -201,6 +201,7 @@ type TileRegistry map[byte]*Tile
// Each level data must be 20 chars wide (= 640 px width) and 15 chars
// high (=480 px height).
type RawLevel struct {
Number int
Name string
Description string
Background *ebiten.Image
@@ -249,10 +250,11 @@ func LoadLevels(dir string) []RawLevel {
return entries[i].Name() < entries[j].Name()
})
for _, levelfile := range entries {
for idx, levelfile := range entries {
if levelfile.Type().IsRegular() && strings.Contains(levelfile.Name(), ".lvl") {
path := filepath.Join("assets", dir)
level := ParseRawLevel(path, levelfile)
level.Number = idx
levels = append(levels, level)
@@ -271,6 +273,7 @@ func ParseRawLevel(dir string, levelfile fs.DirEntry) RawLevel {
defer fd.Close()
name := strings.TrimSuffix(levelfile.Name(), ".lvl")
name = name[3:]
des := ""
background := &ebiten.Image{}
data := []byte{}