-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.go
125 lines (103 loc) · 2.95 KB
/
global.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
ld47, a video game made for Ludum Dare game jam, 47th edition
Copyright (C) 2020 Loïg Jezequel
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see https://www.gnu.org/licenses/
*/
package main
import (
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/audio"
"golang.org/x/image/font"
)
// size of the screen
const (
screenWidth = 384
screenHeight = 272
tilex = 24
menux = 4
tiley = 17
tileyOffset = -8
)
// duration of a loop step in frames
var stepDuration = 20
// number of frames between end of level and next level
var endLevelDuration = 120
// title screen
var titleImage *ebiten.Image
const (
subtitleText = "Stuck in a loop"
creditText = "A game made in 48h for Ludum Dare 47"
infoText = "Press enter"
)
// in level info
const (
totalNumLevel = 20
levelInfoText1 = "Benchmark: " + speaker2BaseName
levelInfoText2 = " - Progress: "
)
// infos on tiles
var (
tilesImage *ebiten.Image
tileSize = 16
)
// All types of tiles
var wallTile = tile{kind: wall}
var floorTileA = tile{kind: floor}
var floorTileB = tile{kind: floor}
var boxTileA = tile{kind: box}
var boxTileB = tile{kind: box}
var nothingTile = tile{kind: nothing}
var resetTileA = tile{kind: resetFloor}
var resetTileB = tile{kind: resetFloor}
// Over the floor objects
var goalImage *ebiten.Image
var goalBoxImage *ebiten.Image
// infos on player
const (
numPlayerImages = 2
numPlayerWinImages = 6
)
var playerImages []*ebiten.Image
var playerFrames []int = []int{40, 10}
var playerWinImages []*ebiten.Image
var playerWinFrames []int = []int{10, 10, 10, 10, 10, 10}
// menu
const (
maxLoopLength = 8
)
var menuLeftPartsUp []*ebiten.Image
var menuLeftPartDown *ebiten.Image
var menuRightPartUp *ebiten.Image
var menuRightPartDown *ebiten.Image
var menuCenterPartUp *ebiten.Image
var menuCenterPartDown *ebiten.Image
var menuNotification *ebiten.Image
var menuMoveInfos []*ebiten.Image
var menuEmptySpot *ebiten.Image
var selectedLeftUp *ebiten.Image
var selectedLeftDown *ebiten.Image
var selectedCenterUp *ebiten.Image
var selectedCenterDown *ebiten.Image
var selectedRightUp *ebiten.Image
var selectedRightDown *ebiten.Image
var menuMoveImages []*ebiten.Image
// talking
var displayFont font.Face
const talkFrames = 180
// sounds
var moveSoundBytes []byte
var dashSoundBytes []byte
var talkSoundBytes []byte
var endLevelSoundBytes []byte
var missMoveSoundBytes []byte
var resetSoundBytes []byte
var infiniteMusic *audio.InfiniteLoop