This repository has been archived by the owner on Feb 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpong.h
86 lines (67 loc) · 1.57 KB
/
pong.h
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
#pragma once
#include "cab202_timers.h"
#include "cab202_sprites.h"
// A few utilities due to C lacking certain functions in the standard library
#define PI 3.14159265358979323846
#define MIN(a,b) a < b ? a : b
// Program management variables
#define FPS 60
#define DELAY MILLISECONDS / FPS
bool running = true;
bool display_help_screen = true;
bool gameover = false;
// Level management variables.
int level = 0;
int score = 0;
int lives = 3;
int game_time = 0;
const int LEVEL_COUNT = 4;
timer_id *cooldown_timer;
int cooldown_number;
sprite_id *ball_sprite;
double ball_starting_velocity = 0.2;
// Level 3 variables
char * anomoly_image =
"\\ | /"
" \\|/ "
"-- --"
" /|\\ "
"/ | \\";
sprite_id * anomoly;
timer_id *anomoly_timer;
bool anomoly_visible = false;
int anomoly_x_offset = 3;
int anomoly_y_offset = 2;
// Level 4 variables
int rail_xoffset = 0;
int rail_width = 0;
char * top_rail;
char * bottom_rail;
// Paddle variables
int left_paddle_offset;
int right_paddle_offset;
int paddle_size;
// Help Screen
const char * help_screen_text[] = {
"Pong",
"Created by Madeline Miller - n9342401",
"",
"Controls",
"L for next level - H for help",
"S for down - W for up"
"",
"Press any key to exit"
};
// Gameover screen
const char * game_over_screen_text[] = {
"Game Over",
"Play again? (y/n)"
};
void setup();
void cleanup();
void process();
void spawn_ball();
void start_level(int new_level);
void reset_game();
void game_over();
int string_length(char * str);