added transient entities: when crossed, turns into wall tile
This commit is contained in:
@@ -4,8 +4,8 @@ Background: background-lila
|
||||
|
||||
|
||||
#######
|
||||
# v #
|
||||
# #
|
||||
# t #
|
||||
#> S <#
|
||||
# #
|
||||
# ^ #
|
||||
|
||||
@@ -3,13 +3,13 @@ Background: background-lila
|
||||
|
||||
|
||||
|
||||
#######
|
||||
# ^ #
|
||||
# #
|
||||
#< S >#
|
||||
# #
|
||||
#^ v#
|
||||
#######
|
||||
#############
|
||||
# #
|
||||
#> S # #
|
||||
# ># >#
|
||||
#< # #
|
||||
# v# <#
|
||||
#############
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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"}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
assets/sprites/transwall.png
Normal file
BIN
assets/sprites/transwall.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Reference in New Issue
Block a user