-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobals.pde
110 lines (94 loc) · 3.51 KB
/
globals.pde
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
/*
* globals.pde
*
* All variables that need global scope
*
* Created on: December 23, 2019
* Author: Sean LaPlante
*/
int TIME = 0;
boolean DEBUG = false; // Displays cheat lines and other useful info
enum GameState {
START_SCREEN,
PLAYING
}
enum InputType {
TOUCH_START,
TOUCH_END,
TOUCH_MOVE
}
enum BlockSide {
BLOCK_LEFT,
BLOCK_RIGHT,
BLOCK_TOP,
BLOCK_BOTTOM
}
GameState currentState = GameState.START_SCREEN;
StartScreen startScreen = null;
MainGame ENGINE = null;
int FRAME_RATE = 90;
//
// Globals used throughout the game
//
// These are set in setup()
//
float BALL_RADIUS; // The radius of the game ball
float PICKUP_BALL_RADIUS; // The radius of the ring around pickup balls
float COIN_RADIUS; // The radius of a coin
float SHOT_SPEED; // The speed the ball travels for a shot
float BLOCK_WIDTH; // The width of a game block
float BLOCK_RADIUS; // A block's corner radius to make the corners kind-of rounded
int EXPLODE_PART_COUNT; // Number of particles a block turns into when it explodes
int EXPLODE_ALPHA_CHANGE; // Rate of change for the alpha of an explostion particle (how fast do they fade out?)
float EXPLODE_PART_MAX_SPEED; // Minimum speed (used to set the velocity) - Should be negative.
float EXPLODE_PART_MIN_SPEED; // Max speed (used to set the velocity) - Should be positive.
float EXPLODE_PART_BWIDTH; // An explosion particle is also a square. What's its width and height?
float EXPLODE_PART_RADIUS; // An explosion particle's corner radius to make the rects rounded.
float BLOCK_XY_SPACING; // The whitespace between the blocks
float DEFAULT_TEXT_SIZE; // Size of the rest of the text
float SMALL_TEXT_SIZE; // Size of small text
int BLOCK_COLUMNS; // Number of columns for blocks
float HUD_TOP_SIZE_PERCENT; // Percentage of the screen height that should be taken for the top of the HUD
float HUD_BOTTOM_SIZE_PERCENT; // Percentage of the screen height that should be taken for the bottom of the HUD
float SLIDE_VELOCITY; // y direction velocity for sliding blocks down when the level changes
String SAVE_LOCATION; // The save location. On android just "osballs.json". On PC "data/osballs.json"
int VERSION_MAJOR = 1; // Major version number (e.g. the 1 in 1.2.3)
int VERSION_MINOR = 0; // Minor version number (e.g. the 2 in 1.2.3)
int VERSION_BUILD = 0; // The build/patch version number (e.g. the 3 in 1.2.3)
boolean IS_ANDROID_MODE; // Set in settings(). True if running in Android mode, False otherwise.
float BUTTON_RADIUS; // A button's corner radius.
void startTimer() {
/*
* Used to profile the program when DEBUG is true
*/
if (!DEBUG) {
return;
}
TIME = millis();
}
void stopTimer(String func) {
/*
* Used to profile the program when DEBUG is true
*/
if (!DEBUG) {
return;
}
println(func, ": ", millis() - TIME);
}
void startGame() {
/*
* Called in setup and game over
*/
currentState = GameState.START_SCREEN;
startScreen = new StartScreen();
ENGINE = new MainGame();
ENGINE.world.generateNewRow();
ENGINE.hud.loadGame();
}
void gameOver() {
/*
* Called when they lose
*/
ENGINE.hud.gameOver(); // This will save what is required.
startGame();
}