Updated dragon sprite & changed villain into an egg.
This commit is contained in:
parent
70ce0da074
commit
30999c944a
@ -149,9 +149,9 @@ func (g *game) loadSprites(names ...string) error {
|
||||
func (g *game) loadAssets() error {
|
||||
log.Println("Loading textures...")
|
||||
err := g.loadTextures(map[string]string{
|
||||
"entity_brick.png": "brick",
|
||||
"entity_dragon.png": "dragon",
|
||||
"entity_villain.png": "villain",
|
||||
"entity_brick.png": "brick",
|
||||
"entity_dragon.png": "dragon",
|
||||
"entity_egg.png": "egg",
|
||||
|
||||
"tile_lava_brick.png": "lava_brick",
|
||||
"tile_magma.png": "magma",
|
||||
@ -179,7 +179,7 @@ func (g *game) loadAssets() error {
|
||||
log.Printf("Loaded %d fonts.\n", g.ui.Fonts().Len())
|
||||
|
||||
log.Println("Loading sprites")
|
||||
err = g.loadSprites("brick", "dragon", "lava_brick", "magma", "particles", "ui", "villain")
|
||||
err = g.loadSprites("brick", "dragon", "egg", "lava_brick", "magma", "particles", "ui")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ const (
|
||||
entityTypeInvalid entityType = entityType(0)
|
||||
entityTypeNone = '_'
|
||||
entityTypeCharacter = '@'
|
||||
entityTypeVillain = 'X'
|
||||
entityTypeEgg = 'X'
|
||||
entityTypeBrick = 'B'
|
||||
)
|
||||
|
||||
@ -23,7 +23,7 @@ func (e entityType) IsValid() bool {
|
||||
switch e {
|
||||
case entityTypeNone:
|
||||
case entityTypeCharacter:
|
||||
case entityTypeVillain:
|
||||
case entityTypeEgg:
|
||||
case entityTypeBrick:
|
||||
default:
|
||||
return false
|
||||
|
@ -230,8 +230,8 @@ func (l *playLevel) Render(ctx *alui.Context, bounds geom.RectangleF32) {
|
||||
l.drawSprite("brick", "brick", e.scr)
|
||||
case entityTypeCharacter:
|
||||
l.drawSprite("dragon", "dragon", e.scr)
|
||||
case entityTypeVillain:
|
||||
l.drawSprite("villain", "villain", e.scr)
|
||||
case entityTypeEgg:
|
||||
l.drawSprite("egg", "egg", e.scr)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,13 +12,13 @@ import (
|
||||
type playLevelState struct {
|
||||
ctx *Context
|
||||
|
||||
pack levelPack
|
||||
level level
|
||||
player *entity
|
||||
villain *entity
|
||||
bricks entityList
|
||||
sunken entityList
|
||||
splash map[geom.Point]*splashAnimation
|
||||
pack levelPack
|
||||
level level
|
||||
player *entity
|
||||
egg *entity
|
||||
bricks entityList
|
||||
sunken entityList
|
||||
splash map[geom.Point]*splashAnimation
|
||||
|
||||
steps int
|
||||
complete bool
|
||||
@ -31,7 +31,7 @@ type playLevelState struct {
|
||||
|
||||
func (s *playLevelState) Entities() entityList {
|
||||
var entities entityList
|
||||
return entities.Add(s.player).Add(s.villain).AddList(s.bricks)
|
||||
return entities.Add(s.player).Add(s.egg).AddList(s.bricks)
|
||||
}
|
||||
|
||||
func (s *playLevelState) Particles(at geom.Point) []particle {
|
||||
@ -72,8 +72,8 @@ func (s *playLevelState) Init(ctx *Context, pack, level string, onComplete func(
|
||||
s.bricks = append(s.bricks, newEntity(e, s.level.idxToPos(i)))
|
||||
case entityTypeCharacter:
|
||||
s.player = newEntity(e, s.level.idxToPos(i))
|
||||
case entityTypeVillain:
|
||||
s.villain = newEntity(e, s.level.idxToPos(i))
|
||||
case entityTypeEgg:
|
||||
s.egg = newEntity(e, s.level.idxToPos(i))
|
||||
}
|
||||
}
|
||||
s.keysDown = keyPressedState{}
|
||||
@ -111,7 +111,7 @@ func (s *playLevelState) TryPlayerMove(dir geom.Point, key allg5.Key) {
|
||||
log.Printf("Moving player to %s", to)
|
||||
s.ani.StartFn(s.ctx.Tick, newMoveAnimation(s.player, to), func() {
|
||||
log.Printf("Player movement finished")
|
||||
if s.player.pos == s.villain.pos {
|
||||
if s.player.pos == s.egg.pos {
|
||||
s.complete = true
|
||||
if onComplete := s.onComplete; onComplete != nil {
|
||||
onComplete()
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 719 KiB |
BIN
cmd/krampus19/res/entity_egg.png
Normal file
BIN
cmd/krampus19/res/entity_egg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 246 KiB |
Binary file not shown.
Before Width: | Height: | Size: 15 KiB |
@ -3,9 +3,9 @@ texture: dragon
|
||||
|
||||
part:
|
||||
name: dragon
|
||||
sub_texture: 0,0,200,400
|
||||
anchor: 100,350
|
||||
scale: 2
|
||||
sub_texture: 0,0,1140,1980
|
||||
anchor: 570,1920
|
||||
scale: 5
|
||||
:part
|
||||
|
||||
:sprite
|
11
cmd/krampus19/res/sprites/egg.txt
Normal file
11
cmd/krampus19/res/sprites/egg.txt
Normal file
@ -0,0 +1,11 @@
|
||||
sprite:
|
||||
texture: egg
|
||||
|
||||
part:
|
||||
name: egg
|
||||
sub_texture: 0,0,1140,1980
|
||||
anchor: 570,1860
|
||||
scale: 6
|
||||
:part
|
||||
|
||||
:sprite
|
@ -1,11 +0,0 @@
|
||||
sprite:
|
||||
texture: villain
|
||||
|
||||
part:
|
||||
name: villain
|
||||
sub_texture: 0,0,200,400
|
||||
anchor: 100,350
|
||||
scale: 2
|
||||
:part
|
||||
|
||||
:sprite
|
Loading…
Reference in New Issue
Block a user