added detonation particles after collectibles have been collected

This commit is contained in:
2024-02-08 18:33:59 +01:00
parent d17594dc38
commit 006216398a
9 changed files with 122 additions and 17 deletions

View File

@@ -28,6 +28,8 @@ type Tile struct {
Renderable bool
Velocity bool
Collectible bool
Particle int // -1=unused, 0-3 = show image of slice
Particles []*ebiten.Image
}
func NewTilePlayer() *Tile {
@@ -62,6 +64,23 @@ func NewTileCollectible(class string) *Tile {
}
}
func NewTileParticle(class []string) *Tile {
sprites := []*ebiten.Image{}
for _, sprite := range class {
sprites = append(sprites, Assets[sprite])
}
return &Tile{
Id: '*',
Class: "particle",
Solid: false,
Renderable: false,
Particle: -1,
Particles: sprites,
}
}
// used to map level data bytes to actual tiles
type TileRegistry map[byte]*Tile
@@ -90,6 +109,10 @@ func InitTiles() TileRegistry {
'#': NewTileBlock("block-grey32"),
'S': NewTilePlayer(),
'o': NewTileCollectible("collectible-orange"),
'*': NewTileParticle([]string{
"particle-dust-0", "particle-dust-0", "particle-dust-1", "particle-dust-1",
"particle-dust-0", "particle-dust-2", "particle-dust-3", "particle-dust-3",
}),
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB