walls and box

This commit is contained in:
Josh Deprez 2021-08-03 18:36:17 +10:00 committed by Josh Deprez
parent adc8fc0514
commit 152fc7d528
2 changed files with 19 additions and 0 deletions

View file

@ -27,6 +27,7 @@ type Actor struct {
ID ID
Position image.Point Position image.Point
Size image.Point Size image.Point
ZPos // TODO: refactor
game *Game game *Game
xRem, yRem float64 xRem, yRem float64

18
main.go
View file

@ -73,15 +73,33 @@ func main() {
Map: tiles, Map: tiles,
Src: engine.ImageRef{Path: "assets/boxes.png"}, Src: engine.ImageRef{Path: "assets/boxes.png"},
TileSize: 16, TileSize: 16,
ZPos: 0,
},
&engine.SolidRect{
ID: "ceiling",
Rect: image.Rect(0, -2, 320, -1),
},
&engine.SolidRect{
ID: "left_wall",
Rect: image.Rect(-2, 0, -1, 240),
},
&engine.SolidRect{
ID: "right_wall",
Rect: image.Rect(320, 0, 321, 240),
}, },
&engine.SolidRect{ &engine.SolidRect{
ID: "ground", ID: "ground",
Rect: image.Rect(0, 192, 320, 240), Rect: image.Rect(0, 192, 320, 240),
}, },
&engine.SolidRect{
ID: "a_red_tile",
Rect: image.Rect(16, 144, 31, 159),
},
&engine.Actor{ &engine.Actor{
ID: "protagonist", ID: "protagonist",
Position: image.Pt(100, 100), Position: image.Pt(100, 100),
Size: image.Pt(16, 16), Size: image.Pt(16, 16),
ZPos: 1,
}, },
}, },
}, },