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 {
|
func (g *game) loadAssets() error {
|
||||||
log.Println("Loading textures...")
|
log.Println("Loading textures...")
|
||||||
err := g.loadTextures(map[string]string{
|
err := g.loadTextures(map[string]string{
|
||||||
"entity_brick.png": "brick",
|
"entity_brick.png": "brick",
|
||||||
"entity_dragon.png": "dragon",
|
"entity_dragon.png": "dragon",
|
||||||
"entity_villain.png": "villain",
|
"entity_egg.png": "egg",
|
||||||
|
|
||||||
"tile_lava_brick.png": "lava_brick",
|
"tile_lava_brick.png": "lava_brick",
|
||||||
"tile_magma.png": "magma",
|
"tile_magma.png": "magma",
|
||||||
@ -179,7 +179,7 @@ func (g *game) loadAssets() error {
|
|||||||
log.Printf("Loaded %d fonts.\n", g.ui.Fonts().Len())
|
log.Printf("Loaded %d fonts.\n", g.ui.Fonts().Len())
|
||||||
|
|
||||||
log.Println("Loading sprites")
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ const (
|
|||||||
entityTypeInvalid entityType = entityType(0)
|
entityTypeInvalid entityType = entityType(0)
|
||||||
entityTypeNone = '_'
|
entityTypeNone = '_'
|
||||||
entityTypeCharacter = '@'
|
entityTypeCharacter = '@'
|
||||||
entityTypeVillain = 'X'
|
entityTypeEgg = 'X'
|
||||||
entityTypeBrick = 'B'
|
entityTypeBrick = 'B'
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ func (e entityType) IsValid() bool {
|
|||||||
switch e {
|
switch e {
|
||||||
case entityTypeNone:
|
case entityTypeNone:
|
||||||
case entityTypeCharacter:
|
case entityTypeCharacter:
|
||||||
case entityTypeVillain:
|
case entityTypeEgg:
|
||||||
case entityTypeBrick:
|
case entityTypeBrick:
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
|
@ -230,8 +230,8 @@ func (l *playLevel) Render(ctx *alui.Context, bounds geom.RectangleF32) {
|
|||||||
l.drawSprite("brick", "brick", e.scr)
|
l.drawSprite("brick", "brick", e.scr)
|
||||||
case entityTypeCharacter:
|
case entityTypeCharacter:
|
||||||
l.drawSprite("dragon", "dragon", e.scr)
|
l.drawSprite("dragon", "dragon", e.scr)
|
||||||
case entityTypeVillain:
|
case entityTypeEgg:
|
||||||
l.drawSprite("villain", "villain", e.scr)
|
l.drawSprite("egg", "egg", e.scr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,13 +12,13 @@ import (
|
|||||||
type playLevelState struct {
|
type playLevelState struct {
|
||||||
ctx *Context
|
ctx *Context
|
||||||
|
|
||||||
pack levelPack
|
pack levelPack
|
||||||
level level
|
level level
|
||||||
player *entity
|
player *entity
|
||||||
villain *entity
|
egg *entity
|
||||||
bricks entityList
|
bricks entityList
|
||||||
sunken entityList
|
sunken entityList
|
||||||
splash map[geom.Point]*splashAnimation
|
splash map[geom.Point]*splashAnimation
|
||||||
|
|
||||||
steps int
|
steps int
|
||||||
complete bool
|
complete bool
|
||||||
@ -31,7 +31,7 @@ type playLevelState struct {
|
|||||||
|
|
||||||
func (s *playLevelState) Entities() entityList {
|
func (s *playLevelState) Entities() entityList {
|
||||||
var 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 {
|
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)))
|
s.bricks = append(s.bricks, newEntity(e, s.level.idxToPos(i)))
|
||||||
case entityTypeCharacter:
|
case entityTypeCharacter:
|
||||||
s.player = newEntity(e, s.level.idxToPos(i))
|
s.player = newEntity(e, s.level.idxToPos(i))
|
||||||
case entityTypeVillain:
|
case entityTypeEgg:
|
||||||
s.villain = newEntity(e, s.level.idxToPos(i))
|
s.egg = newEntity(e, s.level.idxToPos(i))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.keysDown = keyPressedState{}
|
s.keysDown = keyPressedState{}
|
||||||
@ -111,7 +111,7 @@ func (s *playLevelState) TryPlayerMove(dir geom.Point, key allg5.Key) {
|
|||||||
log.Printf("Moving player to %s", to)
|
log.Printf("Moving player to %s", to)
|
||||||
s.ani.StartFn(s.ctx.Tick, newMoveAnimation(s.player, to), func() {
|
s.ani.StartFn(s.ctx.Tick, newMoveAnimation(s.player, to), func() {
|
||||||
log.Printf("Player movement finished")
|
log.Printf("Player movement finished")
|
||||||
if s.player.pos == s.villain.pos {
|
if s.player.pos == s.egg.pos {
|
||||||
s.complete = true
|
s.complete = true
|
||||||
if onComplete := s.onComplete; onComplete != nil {
|
if onComplete := s.onComplete; onComplete != nil {
|
||||||
onComplete()
|
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:
|
part:
|
||||||
name: dragon
|
name: dragon
|
||||||
sub_texture: 0,0,200,400
|
sub_texture: 0,0,1140,1980
|
||||||
anchor: 100,350
|
anchor: 570,1920
|
||||||
scale: 2
|
scale: 5
|
||||||
:part
|
:part
|
||||||
|
|
||||||
:sprite
|
: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