From cd4cbbdef9770f4917826e2467ab3432c231f2cd Mon Sep 17 00:00:00 2001 From: Josh Deprez Date: Wed, 25 Aug 2021 16:14:40 +1000 Subject: [PATCH] let's goooo --- main.go | 103 +------------------------------------------------------- 1 file changed, 1 insertion(+), 102 deletions(-) diff --git a/main.go b/main.go index d3c63b1..d2110e5 100644 --- a/main.go +++ b/main.go @@ -1,8 +1,6 @@ package main import ( - "image" - "image/color" _ "image/png" "log" @@ -16,103 +14,6 @@ func main() { ebiten.SetWindowSize(640, 480) ebiten.SetWindowTitle("TODO") - if false { - redTileAnim := &engine.Anim{Frames: []engine.AnimFrame{ - {Frame: 3, Duration: 12}, - {Frame: 4, Duration: 12}, - {Frame: 5, Duration: 12}, - {Frame: 6, Duration: 12}, - }} - greenTileAnim := &engine.Anim{Frames: []engine.AnimFrame{ - {Frame: 0, Duration: 16}, - {Frame: 1, Duration: 16}, - {Frame: 2, Duration: 16}, - }} - denseTiles := [][]engine.Tile{ - {engine.StaticTile(9), nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, engine.StaticTile(9)}, - {nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, engine.AnimatedTile{Animer: redTileAnim.Copy()}, nil, nil, nil, nil, nil, nil, nil, nil, nil}, - {nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, engine.AnimatedTile{Animer: redTileAnim.Copy()}, nil, nil, nil}, - {nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil}, - {nil, nil, engine.AnimatedTile{Animer: greenTileAnim.Copy()}, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil}, - {nil, nil, nil, nil, nil, engine.AnimatedTile{Animer: redTileAnim.Copy()}, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil}, - {nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, engine.AnimatedTile{Animer: greenTileAnim.Copy()}, nil, nil, nil, nil, nil, nil}, - {nil, nil, nil, nil, engine.AnimatedTile{Animer: greenTileAnim.Copy()}, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil}, - {nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, engine.AnimatedTile{Animer: greenTileAnim.Copy()}, nil, nil, nil, nil, nil, nil, nil, nil, nil}, - {nil, engine.AnimatedTile{Animer: redTileAnim.Copy()}, nil, nil, nil, nil, nil, nil, engine.StaticTile(9), nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil}, - {nil, nil, nil, nil, nil, engine.StaticTile(9), nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, engine.StaticTile(9), nil, nil, nil}, - {nil, nil, nil, nil, engine.StaticTile(9), engine.StaticTile(9), engine.StaticTile(9), nil, nil, nil, engine.StaticTile(9), nil, nil, nil, nil, nil, nil, nil, nil, nil}, - {engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8), engine.AnimatedTile{Animer: redTileAnim.Copy()}, engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8), engine.StaticTile(8)}, - {engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.AnimatedTile{Animer: redTileAnim.Copy()}, engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.AnimatedTile{Animer: greenTileAnim.Copy()}, engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7)}, - {engine.StaticTile(9), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(7), engine.StaticTile(9)}, - } - tiles := make(map[image.Point]engine.Tile) - for j, row := range denseTiles { - for i, tile := range row { - if tile == nil { - continue - } - tiles[image.Pt(i, j)] = tile - } - } - - level1 := &engine.Scene{ - ID: "level_1", - Bounds: engine.Bounds(image.Rect(-32, -32, 320+32, 240+32)), - Components: []interface{}{ - &engine.Fill{ - Color: color.Gray{100}, - ZOrder: 0, - }, - &engine.Image{ - ID: "bg_image", - Parallax: 0.5, - ZOrder: 1, - Pos: image.Pt(-160, -120), - Src: engine.ImageRef{Path: "assets/space.png"}, - }, - &engine.Tilemap{ - ID: "terrain", - ZOrder: 2, - Map: tiles, - Src: engine.ImageRef{Path: "assets/boxes.png"}, - TileSize: 16, - }, - &engine.SolidRect{ - ID: "ceiling", - Bounds: engine.Bounds(image.Rect(0, -1, 320, 0)), - }, - &engine.SolidRect{ - ID: "left_wall", - Bounds: engine.Bounds(image.Rect(-1, 0, 0, 240)), - }, - &engine.SolidRect{ - ID: "right_wall", - Bounds: engine.Bounds(image.Rect(320, 0, 321, 240)), - }, - &game.Awakeman{ - CameraID: "game_camera", - ToastID: "toast", - Sprite: engine.Sprite{ - ID: "awakeman", - Actor: engine.Actor{ - CollisionDomain: "level_1", - Pos: image.Pt(100, 100), - Size: image.Pt(8, 16), - }, - ZOrder: 3, - FrameOffset: image.Pt(-1, 0), - FrameSize: image.Pt(10, 16), - Src: engine.ImageRef{Path: "assets/aw.png"}, - }, - }, - }, - } - - if err := engine.SaveGobz(level1, "game/assets/level1.gobz"); err != nil { - log.Fatalf("Couldn't save level1.gobz: %v", err) - } - } - g := &engine.Game{ ScreenHeight: 240, ScreenWidth: 320, @@ -123,9 +24,7 @@ func main() { ID: "game_camera", Scene: &engine.SceneRef{Path: "assets/level1.gobz"}, }, - &engine.DebugToast{ - ID: "toast", - }, + &engine.DebugToast{ID: "toast"}, engine.PerfDisplay{}, }, },