Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@12:50a7abf21f18, 2019-05-08 (annotated)
- Committer:
- Kern_EL17KJTF
- Date:
- Wed May 08 01:28:25 2019 +0000
- Revision:
- 12:50a7abf21f18
- Parent:
- 11:b288d01533cc
- Child:
- 13:94abfe83a294
Game basics fully working
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kern_EL17KJTF | 0:0130fd5738f7 | 1 | /* |
Kern_EL17KJTF | 0:0130fd5738f7 | 2 | ELEC2645 Embedded Systems Project |
Kern_EL17KJTF | 0:0130fd5738f7 | 3 | School of Electronic & Electrical Engineering |
Kern_EL17KJTF | 0:0130fd5738f7 | 4 | University of Leeds |
Kern_EL17KJTF | 0:0130fd5738f7 | 5 | |
Kern_EL17KJTF | 0:0130fd5738f7 | 6 | Name: Kern Fowler |
Kern_EL17KJTF | 0:0130fd5738f7 | 7 | Username: el17kjtf |
Kern_EL17KJTF | 0:0130fd5738f7 | 8 | Student ID Number: 201116686 |
Kern_EL17KJTF | 0:0130fd5738f7 | 9 | Date: 19/02/2019 |
Kern_EL17KJTF | 2:6baf849b0270 | 10 | Version: 1.2 |
Kern_EL17KJTF | 1:7a0917df015a | 11 | |
Kern_EL17KJTF | 1:7a0917df015a | 12 | */ |
Kern_EL17KJTF | 10:28575a6eaa13 | 13 | #include "mbed.h" |
Kern_EL17KJTF | 10:28575a6eaa13 | 14 | #include "N5110.h" |
Kern_EL17KJTF | 10:28575a6eaa13 | 15 | #include "Gamepad.h" |
Kern_EL17KJTF | 10:28575a6eaa13 | 16 | #include "Donkey.h" |
Kern_EL17KJTF | 10:28575a6eaa13 | 17 | #include "Options.h" |
Kern_EL17KJTF | 12:50a7abf21f18 | 18 | #include "Banana.h" |
Kern_EL17KJTF | 10:28575a6eaa13 | 19 | #include "Barrel.h" |
Kern_EL17KJTF | 10:28575a6eaa13 | 20 | #include "GameEngine.h" |
Kern_EL17KJTF | 1:7a0917df015a | 21 | |
Kern_EL17KJTF | 6:478f81e79d9b | 22 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
Kern_EL17KJTF | 6:478f81e79d9b | 23 | Gamepad pad; |
Kern_EL17KJTF | 10:28575a6eaa13 | 24 | Donkey dky; |
Kern_EL17KJTF | 10:28575a6eaa13 | 25 | Barrel barrel; |
Kern_EL17KJTF | 10:28575a6eaa13 | 26 | Banana banana; |
Kern_EL17KJTF | 10:28575a6eaa13 | 27 | GameEngine eng; |
Kern_EL17KJTF | 6:478f81e79d9b | 28 | Options opt; |
Kern_EL17KJTF | 10:28575a6eaa13 | 29 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 30 | void init(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 31 | void print_menu(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 32 | void welcome(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 33 | void arrow_location(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 34 | void arrow_select(); |
Kern_EL17KJTF | 6:478f81e79d9b | 35 | |
Kern_EL17KJTF | 2:6baf849b0270 | 36 | int fps = 24; |
Kern_EL17KJTF | 2:6baf849b0270 | 37 | int direction; |
Kern_EL17KJTF | 3:b248dc1f3e8d | 38 | int menu_option_pos = 0; |
Kern_EL17KJTF | 2:6baf849b0270 | 39 | int arrow_pos = 0; |
Kern_EL17KJTF | 2:6baf849b0270 | 40 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 41 | int menu_arrow[7][7] = { // Arrow pointer used in main menu |
Kern_EL17KJTF | 10:28575a6eaa13 | 42 | {0,0,0,0,0,0,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 43 | {0,0,0,0,1,0,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 44 | {0,0,0,0,1,1,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 45 | {1,1,1,1,1,1,1,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 46 | {0,0,0,0,1,1,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 47 | {0,0,0,0,1,0,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 48 | {0,0,0,0,0,0,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 49 | }; |
Kern_EL17KJTF | 7:ffbc921c20f7 | 50 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 51 | int menu_dk_face[36][34] = { // donkey kong face for menu |
Kern_EL17KJTF | 10:28575a6eaa13 | 52 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 53 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 54 | { 0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 55 | { 0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 56 | { 0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,1,0,0,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 57 | { 0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,0,0,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 58 | { 0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 59 | { 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,0,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 60 | { 0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 61 | { 0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 62 | { 0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 63 | { 0,0,0,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,1,1,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 64 | { 0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 65 | { 0,1,1,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,1,1,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 66 | { 0,1,0,0,0,1,0,1,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,1,0,0,0,1,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 67 | { 0,1,0,0,0,1,0,0,1,0,0,1,0,1,1,1,0,1,1,1,0,1,0,0,0,1,0,0,1,0,0,0,1,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 68 | { 0,1,0,1,0,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,1,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 69 | { 0,1,0,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,1,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 70 | { 0,1,0,1,1,1,1,0,1,0,1,0,0,1,1,0,1,0,1,1,0,0,1,0,0,1,0,1,1,1,1,0,1,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 71 | { 0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,1,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 72 | { 0,0,1,0,0,1,1,1,0,0,0,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,1,1,1,0,0,1,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 73 | { 0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 74 | { 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 75 | { 0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 76 | { 0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 77 | { 0,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 78 | { 0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,1,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 79 | { 0,1,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,1,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 80 | { 0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 81 | { 0,0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 82 | { 0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 83 | { 0,0,0,0,0,1,1,0,0,0,0,1,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 84 | { 0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 85 | { 0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 86 | { 0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 87 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0 }, |
Kern_EL17KJTF | 10:28575a6eaa13 | 88 | }; |
Kern_EL17KJTF | 12:50a7abf21f18 | 89 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 90 | void controls_run(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 91 | // Instructions --------------------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 92 | void instructions_run(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 93 | // Options -------------------------- |
Kern_EL17KJTF | 9:e6832bf222b7 | 94 | |
Kern_EL17KJTF | 9:e6832bf222b7 | 95 | |
Kern_EL17KJTF | 9:e6832bf222b7 | 96 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 97 | // High Scores----------------------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 98 | void high_scores_run(); |
Kern_EL17KJTF | 6:478f81e79d9b | 99 | |
Kern_EL17KJTF | 6:478f81e79d9b | 100 | // Main Menu -------------------------------------------------------------- |
Kern_EL17KJTF | 2:6baf849b0270 | 101 | int main() { |
Kern_EL17KJTF | 1:7a0917df015a | 102 | init(); // initialise peripherals |
Kern_EL17KJTF | 1:7a0917df015a | 103 | welcome(); // display welcome message |
Kern_EL17KJTF | 1:7a0917df015a | 104 | |
Kern_EL17KJTF | 1:7a0917df015a | 105 | while(1) { // infinite loop |
Kern_EL17KJTF | 2:6baf849b0270 | 106 | arrow_location(); |
Kern_EL17KJTF | 2:6baf849b0270 | 107 | print_menu(); // this re-prints the menu at the start of every loop |
Kern_EL17KJTF | 2:6baf849b0270 | 108 | arrow_select(); |
Kern_EL17KJTF | 2:6baf849b0270 | 109 | wait_ms(1.0f/fps); |
Kern_EL17KJTF | 1:7a0917df015a | 110 | } |
Kern_EL17KJTF | 1:7a0917df015a | 111 | } |
Kern_EL17KJTF | 1:7a0917df015a | 112 | |
Kern_EL17KJTF | 2:6baf849b0270 | 113 | void init() { |
Kern_EL17KJTF | 1:7a0917df015a | 114 | // initialise LCD |
Kern_EL17KJTF | 1:7a0917df015a | 115 | lcd.init(); |
Kern_EL17KJTF | 1:7a0917df015a | 116 | // initialise Gamepad |
Kern_EL17KJTF | 1:7a0917df015a | 117 | pad.init(); |
Kern_EL17KJTF | 2:6baf849b0270 | 118 | wait(2.5); |
Kern_EL17KJTF | 2:6baf849b0270 | 119 | } |
Kern_EL17KJTF | 2:6baf849b0270 | 120 | |
Kern_EL17KJTF | 2:6baf849b0270 | 121 | void arrow_location() { |
Kern_EL17KJTF | 2:6baf849b0270 | 122 | direction = pad.get_direction(); |
Kern_EL17KJTF | 2:6baf849b0270 | 123 | if (direction == N) { |
Kern_EL17KJTF | 3:b248dc1f3e8d | 124 | menu_option_pos = menu_option_pos - 1; |
Kern_EL17KJTF | 2:6baf849b0270 | 125 | // printf("North Pressed"); |
Kern_EL17KJTF | 2:6baf849b0270 | 126 | wait_ms(250); |
Kern_EL17KJTF | 2:6baf849b0270 | 127 | } |
Kern_EL17KJTF | 2:6baf849b0270 | 128 | if (direction == S) { |
Kern_EL17KJTF | 3:b248dc1f3e8d | 129 | menu_option_pos = menu_option_pos + 1; |
Kern_EL17KJTF | 2:6baf849b0270 | 130 | // printf("South Pressed"); |
Kern_EL17KJTF | 2:6baf849b0270 | 131 | wait_ms(250); |
Kern_EL17KJTF | 2:6baf849b0270 | 132 | } |
Kern_EL17KJTF | 4:59175720d8ee | 133 | if (menu_option_pos > 4) { |
Kern_EL17KJTF | 3:b248dc1f3e8d | 134 | menu_option_pos = 0; |
Kern_EL17KJTF | 2:6baf849b0270 | 135 | } |
Kern_EL17KJTF | 3:b248dc1f3e8d | 136 | if (menu_option_pos < 0) { |
Kern_EL17KJTF | 4:59175720d8ee | 137 | menu_option_pos = 4; |
Kern_EL17KJTF | 2:6baf849b0270 | 138 | } |
Kern_EL17KJTF | 4:59175720d8ee | 139 | arrow_pos = 8 + (menu_option_pos * 8); |
Kern_EL17KJTF | 3:b248dc1f3e8d | 140 | // printf("Option Num = %d", menu_option_pos) |
Kern_EL17KJTF | 2:6baf849b0270 | 141 | } |
Kern_EL17KJTF | 2:6baf849b0270 | 142 | |
Kern_EL17KJTF | 2:6baf849b0270 | 143 | void arrow_select() { |
Kern_EL17KJTF | 2:6baf849b0270 | 144 | if (pad.check_event(Gamepad::A_PRESSED) == true) { |
Kern_EL17KJTF | 3:b248dc1f3e8d | 145 | if (menu_option_pos == 0) { |
Kern_EL17KJTF | 2:6baf849b0270 | 146 | // printf("GameEngine"); |
Kern_EL17KJTF | 10:28575a6eaa13 | 147 | eng.gameengine_run(pad, lcd, barrel, banana, dky); |
Kern_EL17KJTF | 12:50a7abf21f18 | 148 | eng.gameengine_score(pad, lcd, banana); |
Kern_EL17KJTF | 2:6baf849b0270 | 149 | } |
Kern_EL17KJTF | 3:b248dc1f3e8d | 150 | if (menu_option_pos == 1) { |
Kern_EL17KJTF | 2:6baf849b0270 | 151 | // printf("Controls"); |
Kern_EL17KJTF | 2:6baf849b0270 | 152 | controls_run(); |
Kern_EL17KJTF | 2:6baf849b0270 | 153 | } |
Kern_EL17KJTF | 3:b248dc1f3e8d | 154 | if (menu_option_pos == 2) { |
Kern_EL17KJTF | 2:6baf849b0270 | 155 | // printf("Instructions"); |
Kern_EL17KJTF | 2:6baf849b0270 | 156 | instructions_run(); |
Kern_EL17KJTF | 2:6baf849b0270 | 157 | } |
Kern_EL17KJTF | 3:b248dc1f3e8d | 158 | if (menu_option_pos == 3) { |
Kern_EL17KJTF | 2:6baf849b0270 | 159 | // printf("Options"); |
Kern_EL17KJTF | 6:478f81e79d9b | 160 | opt.options_run(pad, lcd); |
Kern_EL17KJTF | 2:6baf849b0270 | 161 | } |
Kern_EL17KJTF | 4:59175720d8ee | 162 | if (menu_option_pos == 4) { |
Kern_EL17KJTF | 4:59175720d8ee | 163 | // printf("High Scores"); |
Kern_EL17KJTF | 4:59175720d8ee | 164 | high_scores_run(); |
Kern_EL17KJTF | 4:59175720d8ee | 165 | } |
Kern_EL17KJTF | 2:6baf849b0270 | 166 | } |
Kern_EL17KJTF | 2:6baf849b0270 | 167 | } |
Kern_EL17KJTF | 1:7a0917df015a | 168 | |
Kern_EL17KJTF | 2:6baf849b0270 | 169 | void print_menu() { |
Kern_EL17KJTF | 2:6baf849b0270 | 170 | lcd.clear(); |
Kern_EL17KJTF | 3:b248dc1f3e8d | 171 | lcd.printString("Main Menu",19,0); |
Kern_EL17KJTF | 4:59175720d8ee | 172 | lcd.printString("Start Game",8,1); |
Kern_EL17KJTF | 4:59175720d8ee | 173 | lcd.printString("Controls",8,2); |
Kern_EL17KJTF | 4:59175720d8ee | 174 | lcd.printString("Instructions",8,3); |
Kern_EL17KJTF | 4:59175720d8ee | 175 | lcd.printString("Options",8,4); |
Kern_EL17KJTF | 4:59175720d8ee | 176 | lcd.printString("High Scores",8,5); |
Kern_EL17KJTF | 2:6baf849b0270 | 177 | lcd.drawSprite(0,arrow_pos,7,7,(int *)menu_arrow); |
Kern_EL17KJTF | 2:6baf849b0270 | 178 | lcd.refresh(); |
Kern_EL17KJTF | 1:7a0917df015a | 179 | } |
Kern_EL17KJTF | 1:7a0917df015a | 180 | |
Kern_EL17KJTF | 2:6baf849b0270 | 181 | void welcome() { |
Kern_EL17KJTF | 1:7a0917df015a | 182 | lcd.clear(); |
Kern_EL17KJTF | 2:6baf849b0270 | 183 | lcd.drawSprite(24,0,36,34,(int *)menu_dk_face); |
Kern_EL17KJTF | 1:7a0917df015a | 184 | lcd.printString(" Donkey Kong",0,5); |
Kern_EL17KJTF | 1:7a0917df015a | 185 | lcd.refresh(); |
Kern_EL17KJTF | 2:6baf849b0270 | 186 | wait(1.0); //edit back to longer |
Kern_EL17KJTF | 1:7a0917df015a | 187 | lcd.clear(); |
Kern_EL17KJTF | 2:6baf849b0270 | 188 | lcd.printString(" Created",0,0); |
Kern_EL17KJTF | 2:6baf849b0270 | 189 | lcd.printString(" By",0,1); |
Kern_EL17KJTF | 2:6baf849b0270 | 190 | lcd.printString(" Kern Fowler",0,3); |
Kern_EL17KJTF | 2:6baf849b0270 | 191 | lcd.printString(" 201116686",0,4); |
Kern_EL17KJTF | 1:7a0917df015a | 192 | lcd.refresh(); |
Kern_EL17KJTF | 2:6baf849b0270 | 193 | wait(1.0); |
Kern_EL17KJTF | 1:7a0917df015a | 194 | } |
Kern_EL17KJTF | 10:28575a6eaa13 | 195 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 196 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 197 | // Donkey ----------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 198 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 199 | // Barrel ----------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 200 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 201 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 202 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 203 | // Banana ----------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 204 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 205 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 206 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 207 | // Game State-------------------------------------------------------------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 208 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 209 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 210 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 211 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 212 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 213 | // Controls State---------------------------------------------------------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 214 | void controls_run() { |
Kern_EL17KJTF | 10:28575a6eaa13 | 215 | wait_ms(250); |
Kern_EL17KJTF | 10:28575a6eaa13 | 216 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 217 | while (pad.check_event(Gamepad::BACK_PRESSED) == false) { |
Kern_EL17KJTF | 10:28575a6eaa13 | 218 | //printf("Control State"); |
Kern_EL17KJTF | 10:28575a6eaa13 | 219 | lcd.clear(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 220 | lcd.printString("Controls",19,0); |
Kern_EL17KJTF | 10:28575a6eaa13 | 221 | lcd.refresh(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 222 | wait_ms(1.0f/fps); |
Kern_EL17KJTF | 10:28575a6eaa13 | 223 | } |
Kern_EL17KJTF | 10:28575a6eaa13 | 224 | } |
Kern_EL17KJTF | 10:28575a6eaa13 | 225 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 226 | // Instructions State------------------------------------------------------ |
Kern_EL17KJTF | 10:28575a6eaa13 | 227 | void instructions_run() { |
Kern_EL17KJTF | 10:28575a6eaa13 | 228 | wait_ms(250); |
Kern_EL17KJTF | 10:28575a6eaa13 | 229 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 230 | while (pad.check_event(Gamepad::BACK_PRESSED) == false) { |
Kern_EL17KJTF | 10:28575a6eaa13 | 231 | //printf("Instructions State"); |
Kern_EL17KJTF | 10:28575a6eaa13 | 232 | lcd.clear(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 233 | lcd.printString("Instructions",7,0); |
Kern_EL17KJTF | 10:28575a6eaa13 | 234 | lcd.refresh(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 235 | wait_ms(1.0f/fps); |
Kern_EL17KJTF | 10:28575a6eaa13 | 236 | } |
Kern_EL17KJTF | 10:28575a6eaa13 | 237 | } |
Kern_EL17KJTF | 10:28575a6eaa13 | 238 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 239 | // Options State----------------------------------------------------------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 240 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 241 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 242 | // High Score State-------------------------------------------------------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 243 | void high_scores_run() { |
Kern_EL17KJTF | 10:28575a6eaa13 | 244 | while (pad.check_event(Gamepad::BACK_PRESSED) == false) { |
Kern_EL17KJTF | 10:28575a6eaa13 | 245 | //printf("High Score State"); |
Kern_EL17KJTF | 10:28575a6eaa13 | 246 | lcd.clear(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 247 | lcd.printString("High Scores",12,0); |
Kern_EL17KJTF | 10:28575a6eaa13 | 248 | lcd.refresh(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 249 | wait_ms(1.0f/fps); |
Kern_EL17KJTF | 10:28575a6eaa13 | 250 | } |
Kern_EL17KJTF | 10:28575a6eaa13 | 251 | } |
Kern_EL17KJTF | 10:28575a6eaa13 | 252 |