added collectibles support
This commit is contained in:
@@ -9,9 +9,9 @@ Background: background-orange
|
||||
# ######## ###
|
||||
#
|
||||
############ #
|
||||
# # #
|
||||
# o # #
|
||||
# # ######## #
|
||||
# #
|
||||
# # o
|
||||
# ############
|
||||
|
||||
|
||||
|
||||
@@ -20,13 +20,14 @@ var Tiles = InitTiles()
|
||||
// Tile: contains image, identifier (as used in level data) and
|
||||
// additional properties
|
||||
type Tile struct {
|
||||
Id byte
|
||||
Sprite *ebiten.Image
|
||||
Class string
|
||||
Solid bool
|
||||
Player bool
|
||||
Renderable bool
|
||||
Velocity bool
|
||||
Id byte
|
||||
Sprite *ebiten.Image
|
||||
Class string
|
||||
Solid bool
|
||||
Player bool
|
||||
Renderable bool
|
||||
Velocity bool
|
||||
Collectible bool
|
||||
}
|
||||
|
||||
func NewTilePlayer() *Tile {
|
||||
@@ -50,6 +51,17 @@ func NewTileBlock(class string) *Tile {
|
||||
}
|
||||
}
|
||||
|
||||
func NewTileCollectible(class string) *Tile {
|
||||
return &Tile{
|
||||
Id: 'o',
|
||||
Sprite: Assets[class],
|
||||
Class: class,
|
||||
Solid: false,
|
||||
Renderable: true,
|
||||
Collectible: true,
|
||||
}
|
||||
}
|
||||
|
||||
// used to map level data bytes to actual tiles
|
||||
type TileRegistry map[byte]*Tile
|
||||
|
||||
@@ -77,6 +89,7 @@ func InitTiles() TileRegistry {
|
||||
' ': {Id: ' ', Class: "floor", Renderable: false},
|
||||
'#': NewTileBlock("block-grey32"),
|
||||
'S': NewTilePlayer(),
|
||||
'o': NewTileCollectible("collectible-orange"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user