added transient entities: when crossed, turns into wall tile

This commit is contained in:
2024-02-22 14:33:01 +01:00
parent f696660ccd
commit 308f335cd1
20 changed files with 375 additions and 53 deletions

View File

@@ -4,8 +4,8 @@ Background: background-lila
#######
# v #
# #
# t #
#> S <#
# #
# ^ #

View File

@@ -3,13 +3,13 @@ Background: background-lila
#######
# ^ #
# #
#< S >#
# #
#^ v#
#######
#############
# #
#> S # #
# ># >#
#< # #
# v# <#
#############

View File

@@ -30,8 +30,10 @@ type Tile struct {
Renderable bool
Velocity bool
Collectible bool
Transient bool
Particle int // -1=unused, 0-3 = show image of slice
Particles []*ebiten.Image
Tiles []*ebiten.Image
TileNames []string // same thing, only the names
Obstacle bool
Direction int // obstacles
}
@@ -77,6 +79,7 @@ func NewTileObstacle(class string, direction int) *Tile {
Renderable: true,
Obstacle: true,
Direction: direction,
Velocity: true,
}
}
@@ -93,7 +96,28 @@ func NewTileParticle(class []string) *Tile {
Solid: false,
Renderable: false,
Particle: 0,
Particles: sprites,
Tiles: sprites,
}
}
func NewTileTranswall(class []string) *Tile {
sprites := []*ebiten.Image{}
names := []string{}
for _, sprite := range class {
sprites = append(sprites, Assets[sprite])
names = append(names, sprite)
}
return &Tile{
Id: '*',
Class: "transwall",
Solid: false,
Renderable: true,
Transient: true,
Tiles: sprites,
Sprite: sprites[0], // initially use the first
TileNames: names,
}
}
@@ -123,6 +147,7 @@ func InitTiles() TileRegistry {
return TileRegistry{
' ': {Id: ' ', Class: "floor", Renderable: false},
'#': NewTileBlock("block-grey32"),
'B': NewTileBlock("block-orange-32"),
'S': NewTilePlayer(),
'o': NewTileCollectible("collectible-orange"),
'+': NewTileObstacle("obstacle-star", config.All),
@@ -138,6 +163,7 @@ func InitTiles() TileRegistry {
"particle-ring-5",
"particle-ring-6",
}),
't': NewTileTranswall([]string{"transwall", "block-orange-32"}),
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB