Updated dragon sprite & changed villain into an egg.

This commit is contained in:
Sander Schobers 2019-12-31 11:21:31 +01:00
parent 70ce0da074
commit 30999c944a
10 changed files with 33 additions and 33 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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)
}
}

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@ -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

View File

@ -0,0 +1,11 @@
sprite:
texture: egg
part:
name: egg
sub_texture: 0,0,1140,1980
anchor: 570,1860
scale: 6
:part
:sprite

View File

@ -1,11 +0,0 @@
sprite:
texture: villain
part:
name: villain
sub_texture: 0,0,200,400
anchor: 100,350
scale: 2
:part
:sprite