level1 -> game package

This commit is contained in:
Josh Deprez 2021-09-09 10:24:43 +10:00
parent e11f199d53
commit 247caa1373
2 changed files with 325 additions and 315 deletions

320
game/level1.go Normal file
View file

@ -0,0 +1,320 @@
package game
import (
"image"
"image/color"
"drjosh.dev/gurgle/engine"
"drjosh.dev/gurgle/geom"
)
// Level1 creates the level_1 scene.
func Level1() *engine.Scene {
return &engine.Scene{
ID: "level_1",
Bounds: engine.Bounds(image.Rect(-32, -32, 320+32, 240+32)),
Components: []interface{}{
&engine.Fill{
ID: "bg_fill",
Color: color.Gray{100},
ZOrder: -1000,
},
&engine.Parallax{
CameraID: "game_camera",
Child: &engine.Billboard{
ID: "bg_image",
ZOrder: -900,
Pos: image.Pt(-160, -120),
Src: engine.ImageRef{Path: "assets/space.png"},
},
Factor: 0.5,
},
&engine.PrismMap{
ID: "hexagons",
DrawOrderBias: image.Pt(0, -1), // draw higher Y after lower Y
PosToWorld: geom.IntMatrix3x4{
// For each tile in the X direction, go right by 24 and
// forward by 8, etc
0: [4]int{24, 0, 0, 0},
1: [4]int{0, 16, 0, 0},
2: [4]int{8, 0, 16, 0},
},
PrismSize: geom.Int3{X: 32, Y: 16, Z: 16},
PrismTop: []image.Point{
{X: 8, Y: 0},
{X: 0, Y: 8},
{X: 8, Y: 16},
{X: 23, Y: 16},
{X: 31, Y: 8},
{X: 23, Y: 0},
},
Sheet: engine.Sheet{
CellSize: image.Pt(32, 32),
Src: engine.ImageRef{Path: "assets/hexprism32.png"},
},
Map: map[geom.Int3]*engine.Prism{
geom.Pt3(11, 0, -6): {},
geom.Pt3(12, 0, -6): {},
geom.Pt3(9, 0, -5): {},
geom.Pt3(10, 0, -5): {},
geom.Pt3(11, 0, -5): {},
geom.Pt3(12, 0, -5): {},
geom.Pt3(7, 0, -4): {},
geom.Pt3(8, 0, -4): {},
geom.Pt3(9, 0, -4): {},
geom.Pt3(10, 0, -4): {},
geom.Pt3(11, 0, -4): {},
geom.Pt3(12, 0, -4): {},
geom.Pt3(5, 0, -3): {},
geom.Pt3(6, 0, -3): {},
geom.Pt3(7, 0, -3): {},
geom.Pt3(8, 0, -3): {},
geom.Pt3(9, 0, -3): {},
geom.Pt3(10, 0, -3): {},
geom.Pt3(11, 0, -3): {},
geom.Pt3(12, 0, -3): {},
geom.Pt3(3, 0, -2): {},
geom.Pt3(4, 0, -2): {},
geom.Pt3(5, 0, -2): {},
geom.Pt3(6, 0, -2): {},
geom.Pt3(7, 0, -2): {},
geom.Pt3(8, 0, -2): {},
geom.Pt3(9, 0, -2): {},
geom.Pt3(10, 0, -2): {},
geom.Pt3(11, 0, -2): {},
geom.Pt3(12, 0, -2): {},
geom.Pt3(1, 0, -1): {},
geom.Pt3(2, 0, -1): {},
geom.Pt3(3, 0, -1): {},
geom.Pt3(4, 0, -1): {},
geom.Pt3(5, 0, -1): {},
geom.Pt3(6, 0, -1): {},
geom.Pt3(7, 0, -1): {},
geom.Pt3(8, 0, -1): {},
geom.Pt3(9, 0, -1): {},
geom.Pt3(10, 0, -1): {},
geom.Pt3(11, 0, -1): {},
geom.Pt3(12, 0, -1): {},
geom.Pt3(0, 0, 0): {},
geom.Pt3(1, 0, 0): {},
geom.Pt3(2, 0, 0): {},
geom.Pt3(3, 0, 0): {},
geom.Pt3(4, 0, 0): {},
geom.Pt3(5, 0, 0): {},
geom.Pt3(6, 0, 0): {},
geom.Pt3(7, 0, 0): {},
geom.Pt3(8, 0, 0): {},
geom.Pt3(9, 0, 0): {},
geom.Pt3(10, 0, 0): {},
geom.Pt3(11, 0, 0): {},
geom.Pt3(12, 0, 0): {},
geom.Pt3(0, 0, 1): {},
geom.Pt3(1, 0, 1): {},
geom.Pt3(2, 0, 1): {},
geom.Pt3(3, 0, 1): {},
geom.Pt3(4, 0, 1): {},
geom.Pt3(5, 0, 1): {},
geom.Pt3(6, 0, 1): {},
geom.Pt3(7, 0, 1): {},
geom.Pt3(8, 0, 1): {},
geom.Pt3(9, 0, 1): {},
geom.Pt3(10, 0, 1): {},
geom.Pt3(11, 0, 1): {},
geom.Pt3(12, 0, 1): {},
geom.Pt3(0, 0, 2): {},
geom.Pt3(1, 0, 2): {},
geom.Pt3(2, 0, 2): {},
geom.Pt3(3, 0, 2): {},
geom.Pt3(4, 0, 2): {},
geom.Pt3(5, 0, 2): {},
geom.Pt3(6, 0, 2): {},
geom.Pt3(7, 0, 2): {},
geom.Pt3(8, 0, 2): {},
geom.Pt3(9, 0, 2): {},
geom.Pt3(10, 0, 2): {},
geom.Pt3(11, 0, 2): {},
geom.Pt3(12, 0, 2): {},
geom.Pt3(0, 0, 3): {},
geom.Pt3(1, 0, 3): {},
geom.Pt3(2, 0, 3): {},
geom.Pt3(3, 0, 3): {},
geom.Pt3(4, 0, 3): {},
geom.Pt3(5, 0, 3): {},
geom.Pt3(6, 0, 3): {},
geom.Pt3(7, 0, 3): {},
geom.Pt3(8, 0, 3): {},
geom.Pt3(9, 0, 3): {},
geom.Pt3(10, 0, 3): {},
geom.Pt3(11, 0, 3): {},
geom.Pt3(12, 0, 3): {},
geom.Pt3(0, 0, 4): {},
geom.Pt3(1, 0, 4): {},
geom.Pt3(2, 0, 4): {},
geom.Pt3(3, 0, 4): {},
geom.Pt3(4, 0, 4): {},
geom.Pt3(5, 0, 4): {},
geom.Pt3(6, 0, 4): {},
geom.Pt3(7, 0, 4): {},
geom.Pt3(8, 0, 4): {},
geom.Pt3(9, 0, 4): {},
geom.Pt3(10, 0, 4): {},
geom.Pt3(11, 0, 4): {},
geom.Pt3(12, 0, 4): {},
geom.Pt3(0, 0, 5): {},
geom.Pt3(1, 0, 5): {},
geom.Pt3(2, 0, 5): {},
geom.Pt3(3, 0, 5): {},
geom.Pt3(4, 0, 5): {},
geom.Pt3(5, 0, 5): {},
geom.Pt3(6, 0, 5): {},
geom.Pt3(6, -1, 5): {Cell: 1},
geom.Pt3(7, 0, 5): {},
geom.Pt3(8, 0, 5): {},
geom.Pt3(9, 0, 5): {},
geom.Pt3(10, 0, 5): {},
geom.Pt3(11, 0, 5): {},
geom.Pt3(12, 0, 5): {},
geom.Pt3(0, 0, 6): {},
geom.Pt3(1, 0, 6): {},
geom.Pt3(2, 0, 6): {},
geom.Pt3(3, 0, 6): {},
geom.Pt3(4, 0, 6): {},
geom.Pt3(5, 0, 6): {},
geom.Pt3(6, 0, 6): {},
geom.Pt3(7, 0, 6): {},
geom.Pt3(8, 0, 6): {},
geom.Pt3(9, 0, 6): {},
geom.Pt3(10, 0, 6): {},
geom.Pt3(11, 0, 6): {},
geom.Pt3(12, 0, 6): {},
geom.Pt3(0, 0, 7): {},
geom.Pt3(1, 0, 7): {},
geom.Pt3(2, 0, 7): {},
geom.Pt3(3, 0, 7): {},
geom.Pt3(4, 0, 7): {},
geom.Pt3(5, 0, 7): {},
geom.Pt3(6, 0, 7): {},
geom.Pt3(7, 0, 7): {},
geom.Pt3(8, 0, 7): {},
geom.Pt3(9, 0, 7): {},
geom.Pt3(10, 0, 7): {},
geom.Pt3(11, 0, 7): {},
geom.Pt3(12, 0, 7): {},
geom.Pt3(0, 0, 8): {},
geom.Pt3(1, 0, 8): {},
geom.Pt3(2, 0, 8): {},
geom.Pt3(3, 0, 8): {},
geom.Pt3(4, 0, 8): {},
geom.Pt3(5, 0, 8): {},
geom.Pt3(6, 0, 8): {},
geom.Pt3(7, 0, 8): {},
geom.Pt3(8, 0, 8): {},
geom.Pt3(9, 0, 8): {},
geom.Pt3(10, 0, 8): {},
geom.Pt3(0, 0, 9): {},
geom.Pt3(1, 0, 9): {},
geom.Pt3(2, 0, 9): {},
geom.Pt3(3, 0, 9): {},
geom.Pt3(4, 0, 9): {},
geom.Pt3(5, 0, 9): {},
geom.Pt3(6, 0, 9): {},
geom.Pt3(7, 0, 9): {},
geom.Pt3(8, 0, 9): {},
geom.Pt3(0, 0, 10): {},
geom.Pt3(1, 0, 10): {},
geom.Pt3(2, 0, 10): {},
geom.Pt3(3, 0, 10): {},
geom.Pt3(4, 0, 10): {},
geom.Pt3(5, 0, 10): {},
geom.Pt3(6, 0, 10): {},
geom.Pt3(0, 0, 11): {},
geom.Pt3(1, 0, 11): {},
geom.Pt3(2, 0, 11): {},
geom.Pt3(3, 0, 11): {},
geom.Pt3(4, 0, 11): {},
geom.Pt3(0, 0, 12): {},
geom.Pt3(1, 0, 12): {},
geom.Pt3(2, 0, 12): {},
geom.Pt3(0, 0, 13): {},
},
},
&Awakeman{
CameraID: "game_camera",
ToastID: "toast",
Sprite: engine.Sprite{
Actor: engine.Actor{
CollisionDomain: "level_1",
Pos: geom.Pt3(100, -32, 100),
Size: geom.Pt3(8, 16, 2),
},
DrawOffset: image.Pt(-1, 0),
Sheet: engine.Sheet{
AnimDefs: map[string]*engine.AnimDef{
"idle_left": {Steps: []engine.AnimStep{
{Cell: 1, Duration: 60},
}},
"idle_right": {Steps: []engine.AnimStep{
{Cell: 0, Duration: 60},
}},
"run_left": {Steps: []engine.AnimStep{
{Cell: 14, Duration: 3},
{Cell: 15, Duration: 5},
{Cell: 16, Duration: 3},
{Cell: 17, Duration: 3},
}},
"run_right": {Steps: []engine.AnimStep{
{Cell: 10, Duration: 3},
{Cell: 11, Duration: 5},
{Cell: 12, Duration: 3},
{Cell: 13, Duration: 3},
}},
"run_vert": {Steps: []engine.AnimStep{
{Cell: 18, Duration: 3},
{Cell: 19, Duration: 5},
{Cell: 20, Duration: 3},
{Cell: 21, Duration: 3},
{Cell: 22, Duration: 3},
{Cell: 23, Duration: 5},
{Cell: 24, Duration: 3},
{Cell: 25, Duration: 3},
}},
"walk_left": {Steps: []engine.AnimStep{
{Cell: 2, Duration: 6},
{Cell: 3, Duration: 6},
{Cell: 4, Duration: 6},
{Cell: 5, Duration: 6},
}},
"walk_right": {Steps: []engine.AnimStep{
{Cell: 6, Duration: 6},
{Cell: 7, Duration: 6},
{Cell: 8, Duration: 6},
{Cell: 9, Duration: 6},
}},
},
CellSize: image.Pt(10, 16),
Src: engine.ImageRef{Path: "assets/aw.png"},
},
},
},
},
}
}

320
main.go
View file

@ -2,7 +2,6 @@ package main
import ( import (
"image" "image"
"image/color"
_ "image/png" _ "image/png"
"log" "log"
"math" "math"
@ -18,6 +17,7 @@ import (
const ( const (
enableCPUProfile = false enableCPUProfile = false
enableREPL = true
hardcodedLevel1 = true hardcodedLevel1 = true
rewriteLevel1 = false rewriteLevel1 = false
) )
@ -43,7 +43,7 @@ func main() {
// Change to true to rewrite level1.gobz // Change to true to rewrite level1.gobz
lev1 := interface{}(&engine.SceneRef{Path: "assets/level1.gobz"}) lev1 := interface{}(&engine.SceneRef{Path: "assets/level1.gobz"})
if hardcodedLevel1 { if hardcodedLevel1 {
lev1 = level1() lev1 = game.Level1()
if rewriteLevel1 && runtime.GOOS != "js" { if rewriteLevel1 && runtime.GOOS != "js" {
if err := engine.SaveGobz(lev1, "game/assets/level1.gobz"); err != nil { if err := engine.SaveGobz(lev1, "game/assets/level1.gobz"); err != nil {
log.Fatalf("Couldn't save level1.gobz: %v", err) log.Fatalf("Couldn't save level1.gobz: %v", err)
@ -53,6 +53,8 @@ func main() {
g := &engine.Game{ g := &engine.Game{
ScreenSize: image.Pt(320, 240), // Window interior is this many pixels. ScreenSize: image.Pt(320, 240), // Window interior is this many pixels.
// TODO: refactor Projection and VoxelScale into... Scene? Camera?
// We might want different projections and scales in different levels.
Projection: geom.IntProjection{ Projection: geom.IntProjection{
// Each 1 voxel step in Z is projected into 1 pixel in Y. // Each 1 voxel step in Z is projected into 1 pixel in Y.
X: 0, X: 0,
@ -80,323 +82,11 @@ func main() {
log.Fatalf("Loading/preparing error: %v", err) log.Fatalf("Loading/preparing error: %v", err)
} }
if runtime.GOOS != "js" { if enableREPL && runtime.GOOS != "js" {
// Run a repl on the console.
go g.REPL(os.Stdin, os.Stdout, game.Assets) go g.REPL(os.Stdin, os.Stdout, game.Assets)
} }
// ... while the game also runs
if err := ebiten.RunGame(g); err != nil { if err := ebiten.RunGame(g); err != nil {
log.Fatalf("Game error: %v", err) log.Fatalf("Game error: %v", err)
} }
} }
func level1() *engine.Scene {
return &engine.Scene{
ID: "level_1",
Bounds: engine.Bounds(image.Rect(-32, -32, 320+32, 240+32)),
Components: []interface{}{
&engine.Fill{
ID: "bg_fill",
Color: color.Gray{100},
ZOrder: -1000,
},
&engine.Parallax{
CameraID: "game_camera",
Child: &engine.Billboard{
ID: "bg_image",
ZOrder: -900,
Pos: image.Pt(-160, -120),
Src: engine.ImageRef{Path: "assets/space.png"},
},
Factor: 0.5,
},
&engine.PrismMap{
ID: "hexagons",
DrawOrderBias: image.Pt(0, -1), // draw higher Y after lower Y
PosToWorld: geom.IntMatrix3x4{
// For each tile in the X direction, go right by 24 and
// forward by 8, etc
0: [4]int{24, 0, 0, 0},
1: [4]int{0, 16, 0, 0},
2: [4]int{8, 0, 16, 0},
},
PrismSize: geom.Int3{X: 32, Y: 16, Z: 16},
PrismTop: []image.Point{
{X: 8, Y: 0},
{X: 0, Y: 8},
{X: 8, Y: 16},
{X: 23, Y: 16},
{X: 31, Y: 8},
{X: 23, Y: 0},
},
Sheet: engine.Sheet{
CellSize: image.Pt(32, 32),
Src: engine.ImageRef{Path: "assets/hexprism32.png"},
},
Map: map[geom.Int3]*engine.Prism{
geom.Pt3(11, 0, -6): {},
geom.Pt3(12, 0, -6): {},
geom.Pt3(9, 0, -5): {},
geom.Pt3(10, 0, -5): {},
geom.Pt3(11, 0, -5): {},
geom.Pt3(12, 0, -5): {},
geom.Pt3(7, 0, -4): {},
geom.Pt3(8, 0, -4): {},
geom.Pt3(9, 0, -4): {},
geom.Pt3(10, 0, -4): {},
geom.Pt3(11, 0, -4): {},
geom.Pt3(12, 0, -4): {},
geom.Pt3(5, 0, -3): {},
geom.Pt3(6, 0, -3): {},
geom.Pt3(7, 0, -3): {},
geom.Pt3(8, 0, -3): {},
geom.Pt3(9, 0, -3): {},
geom.Pt3(10, 0, -3): {},
geom.Pt3(11, 0, -3): {},
geom.Pt3(12, 0, -3): {},
geom.Pt3(3, 0, -2): {},
geom.Pt3(4, 0, -2): {},
geom.Pt3(5, 0, -2): {},
geom.Pt3(6, 0, -2): {},
geom.Pt3(7, 0, -2): {},
geom.Pt3(8, 0, -2): {},
geom.Pt3(9, 0, -2): {},
geom.Pt3(10, 0, -2): {},
geom.Pt3(11, 0, -2): {},
geom.Pt3(12, 0, -2): {},
geom.Pt3(1, 0, -1): {},
geom.Pt3(2, 0, -1): {},
geom.Pt3(3, 0, -1): {},
geom.Pt3(4, 0, -1): {},
geom.Pt3(5, 0, -1): {},
geom.Pt3(6, 0, -1): {},
geom.Pt3(7, 0, -1): {},
geom.Pt3(8, 0, -1): {},
geom.Pt3(9, 0, -1): {},
geom.Pt3(10, 0, -1): {},
geom.Pt3(11, 0, -1): {},
geom.Pt3(12, 0, -1): {},
geom.Pt3(0, 0, 0): {},
geom.Pt3(1, 0, 0): {},
geom.Pt3(2, 0, 0): {},
geom.Pt3(3, 0, 0): {},
geom.Pt3(4, 0, 0): {},
geom.Pt3(5, 0, 0): {},
geom.Pt3(6, 0, 0): {},
geom.Pt3(7, 0, 0): {},
geom.Pt3(8, 0, 0): {},
geom.Pt3(9, 0, 0): {},
geom.Pt3(10, 0, 0): {},
geom.Pt3(11, 0, 0): {},
geom.Pt3(12, 0, 0): {},
geom.Pt3(0, 0, 1): {},
geom.Pt3(1, 0, 1): {},
geom.Pt3(2, 0, 1): {},
geom.Pt3(3, 0, 1): {},
geom.Pt3(4, 0, 1): {},
geom.Pt3(5, 0, 1): {},
geom.Pt3(6, 0, 1): {},
geom.Pt3(7, 0, 1): {},
geom.Pt3(8, 0, 1): {},
geom.Pt3(9, 0, 1): {},
geom.Pt3(10, 0, 1): {},
geom.Pt3(11, 0, 1): {},
geom.Pt3(12, 0, 1): {},
geom.Pt3(0, 0, 2): {},
geom.Pt3(1, 0, 2): {},
geom.Pt3(2, 0, 2): {},
geom.Pt3(3, 0, 2): {},
geom.Pt3(4, 0, 2): {},
geom.Pt3(5, 0, 2): {},
geom.Pt3(6, 0, 2): {},
geom.Pt3(7, 0, 2): {},
geom.Pt3(8, 0, 2): {},
geom.Pt3(9, 0, 2): {},
geom.Pt3(10, 0, 2): {},
geom.Pt3(11, 0, 2): {},
geom.Pt3(12, 0, 2): {},
geom.Pt3(0, 0, 3): {},
geom.Pt3(1, 0, 3): {},
geom.Pt3(2, 0, 3): {},
geom.Pt3(3, 0, 3): {},
geom.Pt3(4, 0, 3): {},
geom.Pt3(5, 0, 3): {},
geom.Pt3(6, 0, 3): {},
geom.Pt3(7, 0, 3): {},
geom.Pt3(8, 0, 3): {},
geom.Pt3(9, 0, 3): {},
geom.Pt3(10, 0, 3): {},
geom.Pt3(11, 0, 3): {},
geom.Pt3(12, 0, 3): {},
geom.Pt3(0, 0, 4): {},
geom.Pt3(1, 0, 4): {},
geom.Pt3(2, 0, 4): {},
geom.Pt3(3, 0, 4): {},
geom.Pt3(4, 0, 4): {},
geom.Pt3(5, 0, 4): {},
geom.Pt3(6, 0, 4): {},
geom.Pt3(7, 0, 4): {},
geom.Pt3(8, 0, 4): {},
geom.Pt3(9, 0, 4): {},
geom.Pt3(10, 0, 4): {},
geom.Pt3(11, 0, 4): {},
geom.Pt3(12, 0, 4): {},
geom.Pt3(0, 0, 5): {},
geom.Pt3(1, 0, 5): {},
geom.Pt3(2, 0, 5): {},
geom.Pt3(3, 0, 5): {},
geom.Pt3(4, 0, 5): {},
geom.Pt3(5, 0, 5): {},
geom.Pt3(6, 0, 5): {},
geom.Pt3(6, -1, 5): {Cell: 1},
geom.Pt3(7, 0, 5): {},
geom.Pt3(8, 0, 5): {},
geom.Pt3(9, 0, 5): {},
geom.Pt3(10, 0, 5): {},
geom.Pt3(11, 0, 5): {},
geom.Pt3(12, 0, 5): {},
geom.Pt3(0, 0, 6): {},
geom.Pt3(1, 0, 6): {},
geom.Pt3(2, 0, 6): {},
geom.Pt3(3, 0, 6): {},
geom.Pt3(4, 0, 6): {},
geom.Pt3(5, 0, 6): {},
geom.Pt3(6, 0, 6): {},
geom.Pt3(7, 0, 6): {},
geom.Pt3(8, 0, 6): {},
geom.Pt3(9, 0, 6): {},
geom.Pt3(10, 0, 6): {},
geom.Pt3(11, 0, 6): {},
geom.Pt3(12, 0, 6): {},
geom.Pt3(0, 0, 7): {},
geom.Pt3(1, 0, 7): {},
geom.Pt3(2, 0, 7): {},
geom.Pt3(3, 0, 7): {},
geom.Pt3(4, 0, 7): {},
geom.Pt3(5, 0, 7): {},
geom.Pt3(6, 0, 7): {},
geom.Pt3(7, 0, 7): {},
geom.Pt3(8, 0, 7): {},
geom.Pt3(9, 0, 7): {},
geom.Pt3(10, 0, 7): {},
geom.Pt3(11, 0, 7): {},
geom.Pt3(12, 0, 7): {},
geom.Pt3(0, 0, 8): {},
geom.Pt3(1, 0, 8): {},
geom.Pt3(2, 0, 8): {},
geom.Pt3(3, 0, 8): {},
geom.Pt3(4, 0, 8): {},
geom.Pt3(5, 0, 8): {},
geom.Pt3(6, 0, 8): {},
geom.Pt3(7, 0, 8): {},
geom.Pt3(8, 0, 8): {},
geom.Pt3(9, 0, 8): {},
geom.Pt3(10, 0, 8): {},
geom.Pt3(0, 0, 9): {},
geom.Pt3(1, 0, 9): {},
geom.Pt3(2, 0, 9): {},
geom.Pt3(3, 0, 9): {},
geom.Pt3(4, 0, 9): {},
geom.Pt3(5, 0, 9): {},
geom.Pt3(6, 0, 9): {},
geom.Pt3(7, 0, 9): {},
geom.Pt3(8, 0, 9): {},
geom.Pt3(0, 0, 10): {},
geom.Pt3(1, 0, 10): {},
geom.Pt3(2, 0, 10): {},
geom.Pt3(3, 0, 10): {},
geom.Pt3(4, 0, 10): {},
geom.Pt3(5, 0, 10): {},
geom.Pt3(6, 0, 10): {},
geom.Pt3(0, 0, 11): {},
geom.Pt3(1, 0, 11): {},
geom.Pt3(2, 0, 11): {},
geom.Pt3(3, 0, 11): {},
geom.Pt3(4, 0, 11): {},
geom.Pt3(0, 0, 12): {},
geom.Pt3(1, 0, 12): {},
geom.Pt3(2, 0, 12): {},
geom.Pt3(0, 0, 13): {},
},
},
&game.Awakeman{
CameraID: "game_camera",
ToastID: "toast",
Sprite: engine.Sprite{
Actor: engine.Actor{
CollisionDomain: "level_1",
Pos: geom.Pt3(100, -32, 100),
Size: geom.Pt3(8, 16, 2),
},
DrawOffset: image.Pt(-1, 0),
Sheet: engine.Sheet{
AnimDefs: map[string]*engine.AnimDef{
"idle_left": {Steps: []engine.AnimStep{
{Cell: 1, Duration: 60},
}},
"idle_right": {Steps: []engine.AnimStep{
{Cell: 0, Duration: 60},
}},
"run_left": {Steps: []engine.AnimStep{
{Cell: 14, Duration: 3},
{Cell: 15, Duration: 5},
{Cell: 16, Duration: 3},
{Cell: 17, Duration: 3},
}},
"run_right": {Steps: []engine.AnimStep{
{Cell: 10, Duration: 3},
{Cell: 11, Duration: 5},
{Cell: 12, Duration: 3},
{Cell: 13, Duration: 3},
}},
"run_vert": {Steps: []engine.AnimStep{
{Cell: 18, Duration: 3},
{Cell: 19, Duration: 5},
{Cell: 20, Duration: 3},
{Cell: 21, Duration: 3},
{Cell: 22, Duration: 3},
{Cell: 23, Duration: 5},
{Cell: 24, Duration: 3},
{Cell: 25, Duration: 3},
}},
"walk_left": {Steps: []engine.AnimStep{
{Cell: 2, Duration: 6},
{Cell: 3, Duration: 6},
{Cell: 4, Duration: 6},
{Cell: 5, Duration: 6},
}},
"walk_right": {Steps: []engine.AnimStep{
{Cell: 6, Duration: 6},
{Cell: 7, Duration: 6},
{Cell: 8, Duration: 6},
{Cell: 9, Duration: 6},
}},
},
CellSize: image.Pt(10, 16),
Src: engine.ImageRef{Path: "assets/aw.png"},
},
},
},
},
}
}