-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
64 lines (59 loc) · 1.2 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
import (
"log"
_ "image/png"
"github.com/hajimehoshi/ebiten/v2"
)
const (
screenWidth = 72
screenHeight = 80
)
func main() {
// initialize game
game, err := NewGame(GameConfig{
ActionSourceIdle: &ActionSource{
ImagePaths: []string{
"assets/idle1.png",
"assets/idle2.png",
"assets/idle3.png",
"assets/idle4.png",
},
},
ActionSourceSleep: &ActionSource{
ImagePaths: []string{
"assets/zzz1.png",
"assets/zzz2.png",
"assets/zzz3.png",
"assets/zzz4.png",
},
},
ActionSourceWalkingLeft: &ActionSource{
ImagePaths: []string{
"assets/walkingleft1.png",
"assets/walkingleft2.png",
"assets/walkingleft3.png",
"assets/walkingleft4.png",
},
},
ActionSourceWalkingRight: &ActionSource{
ImagePaths: []string{
"assets/walkingright1.png",
"assets/walkingright2.png",
"assets/walkingright3.png",
"assets/walkingright4.png",
},
},
ExitButtonImagePath: "assets/close.png",
WindowDimension: Dimension{
Width: screenWidth,
Height: screenHeight,
},
})
if err != nil {
log.Fatalf("unable to initialize game due: %v", err)
}
// run game
if err := ebiten.RunGame(game); err != nil {
log.Fatal(err)
}
}