-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlevel.go
45 lines (38 loc) · 777 Bytes
/
level.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
package main
import (
"github.com/hajimehoshi/ebiten/v2"
)
type Level struct {
label string
final bool
cells int
moves int
pieces []*Piece
board *ebiten.Image
boardOpts *ebiten.DrawImageOptions
flag *ebiten.Image
}
func initializeLevel() {
level.board, level.boardOpts = generateBoardImage(level.cells)
for _, p := range level.pieces {
p.image = p.imgsrc()
p.opts = &ebiten.DrawImageOptions{}
}
updatePieceLocations()
state = make([]*State, 0)
pushState(0)
}
var last = Level{
label: "you should never see this level",
cells: 1,
moves: 0,
final: true,
flag: ebiten.NewImage(w, h),
pieces: []*Piece{
{
imgsrc: func() *ebiten.Image { return generateGemImage(rainbowColors[0]) },
x: 0,
y: 0,
},
},
}