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@13:94abfe83a294, 2019-05-08 (annotated)
- Committer:
- Kern_EL17KJTF
- Date:
- Wed May 08 19:49:35 2019 +0000
- Revision:
- 13:94abfe83a294
- Parent:
- 12:50a7abf21f18
- Child:
- 14:d6fbbb912425
Controls Menu Added.
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 | 13:94abfe83a294 | 18 | #include "Controls.h" |
Kern_EL17KJTF | 12:50a7abf21f18 | 19 | #include "Banana.h" |
Kern_EL17KJTF | 10:28575a6eaa13 | 20 | #include "Barrel.h" |
Kern_EL17KJTF | 10:28575a6eaa13 | 21 | #include "GameEngine.h" |
Kern_EL17KJTF | 1:7a0917df015a | 22 | |
Kern_EL17KJTF | 6:478f81e79d9b | 23 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
Kern_EL17KJTF | 6:478f81e79d9b | 24 | Gamepad pad; |
Kern_EL17KJTF | 10:28575a6eaa13 | 25 | Donkey dky; |
Kern_EL17KJTF | 10:28575a6eaa13 | 26 | Barrel barrel; |
Kern_EL17KJTF | 10:28575a6eaa13 | 27 | Banana banana; |
Kern_EL17KJTF | 10:28575a6eaa13 | 28 | GameEngine eng; |
Kern_EL17KJTF | 6:478f81e79d9b | 29 | Options opt; |
Kern_EL17KJTF | 13:94abfe83a294 | 30 | Controls cont; |
Kern_EL17KJTF | 10:28575a6eaa13 | 31 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 32 | void init(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 33 | void print_menu(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 34 | void welcome(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 35 | void arrow_location(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 36 | void arrow_select(); |
Kern_EL17KJTF | 6:478f81e79d9b | 37 | |
Kern_EL17KJTF | 2:6baf849b0270 | 38 | int fps = 24; |
Kern_EL17KJTF | 2:6baf849b0270 | 39 | int direction; |
Kern_EL17KJTF | 3:b248dc1f3e8d | 40 | int menu_option_pos = 0; |
Kern_EL17KJTF | 2:6baf849b0270 | 41 | int arrow_pos = 0; |
Kern_EL17KJTF | 2:6baf849b0270 | 42 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 43 | int menu_arrow[7][7] = { // Arrow pointer used in main menu |
Kern_EL17KJTF | 10:28575a6eaa13 | 44 | {0,0,0,0,0,0,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 45 | {0,0,0,0,1,0,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 46 | {0,0,0,0,1,1,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 47 | {1,1,1,1,1,1,1,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 48 | {0,0,0,0,1,1,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 49 | {0,0,0,0,1,0,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 50 | {0,0,0,0,0,0,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 51 | }; |
Kern_EL17KJTF | 7:ffbc921c20f7 | 52 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 53 | int menu_dk_face[36][34] = { // donkey kong face for menu |
Kern_EL17KJTF | 10:28575a6eaa13 | 54 | { 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 | 55 | { 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 | 56 | { 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 | 57 | { 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 | 58 | { 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 | 59 | { 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 | 60 | { 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 | 61 | { 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 | 62 | { 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 | 63 | { 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 | 64 | { 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 | 65 | { 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 | 66 | { 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 | 67 | { 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 | 68 | { 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 | 69 | { 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 | 70 | { 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 | 71 | { 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 | 72 | { 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 | 73 | { 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 | 74 | { 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 | 75 | { 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 | 76 | { 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 | 77 | { 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 | 78 | { 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 | 79 | { 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 | 80 | { 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 | 81 | { 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 | 82 | { 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 | 83 | { 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 | 84 | { 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 | 85 | { 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 | 86 | { 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 | 87 | { 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 | 88 | { 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 | 89 | { 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 | 90 | }; |
Kern_EL17KJTF | 12:50a7abf21f18 | 91 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 92 | // Instructions --------------------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 93 | void instructions_run(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 94 | // Options -------------------------- |
Kern_EL17KJTF | 9:e6832bf222b7 | 95 | |
Kern_EL17KJTF | 9:e6832bf222b7 | 96 | |
Kern_EL17KJTF | 9:e6832bf222b7 | 97 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 98 | // High Scores----------------------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 99 | void high_scores_run(); |
Kern_EL17KJTF | 6:478f81e79d9b | 100 | |
Kern_EL17KJTF | 6:478f81e79d9b | 101 | // Main Menu -------------------------------------------------------------- |
Kern_EL17KJTF | 2:6baf849b0270 | 102 | int main() { |
Kern_EL17KJTF | 1:7a0917df015a | 103 | init(); // initialise peripherals |
Kern_EL17KJTF | 1:7a0917df015a | 104 | welcome(); // display welcome message |
Kern_EL17KJTF | 1:7a0917df015a | 105 | |
Kern_EL17KJTF | 1:7a0917df015a | 106 | while(1) { // infinite loop |
Kern_EL17KJTF | 2:6baf849b0270 | 107 | arrow_location(); |
Kern_EL17KJTF | 2:6baf849b0270 | 108 | print_menu(); // this re-prints the menu at the start of every loop |
Kern_EL17KJTF | 2:6baf849b0270 | 109 | arrow_select(); |
Kern_EL17KJTF | 2:6baf849b0270 | 110 | wait_ms(1.0f/fps); |
Kern_EL17KJTF | 1:7a0917df015a | 111 | } |
Kern_EL17KJTF | 1:7a0917df015a | 112 | } |
Kern_EL17KJTF | 1:7a0917df015a | 113 | |
Kern_EL17KJTF | 2:6baf849b0270 | 114 | void init() { |
Kern_EL17KJTF | 1:7a0917df015a | 115 | // initialise LCD |
Kern_EL17KJTF | 1:7a0917df015a | 116 | lcd.init(); |
Kern_EL17KJTF | 1:7a0917df015a | 117 | // initialise Gamepad |
Kern_EL17KJTF | 1:7a0917df015a | 118 | pad.init(); |
Kern_EL17KJTF | 2:6baf849b0270 | 119 | wait(2.5); |
Kern_EL17KJTF | 2:6baf849b0270 | 120 | } |
Kern_EL17KJTF | 2:6baf849b0270 | 121 | |
Kern_EL17KJTF | 2:6baf849b0270 | 122 | void arrow_location() { |
Kern_EL17KJTF | 2:6baf849b0270 | 123 | direction = pad.get_direction(); |
Kern_EL17KJTF | 2:6baf849b0270 | 124 | if (direction == N) { |
Kern_EL17KJTF | 3:b248dc1f3e8d | 125 | menu_option_pos = menu_option_pos - 1; |
Kern_EL17KJTF | 2:6baf849b0270 | 126 | // printf("North Pressed"); |
Kern_EL17KJTF | 2:6baf849b0270 | 127 | wait_ms(250); |
Kern_EL17KJTF | 2:6baf849b0270 | 128 | } |
Kern_EL17KJTF | 2:6baf849b0270 | 129 | if (direction == S) { |
Kern_EL17KJTF | 3:b248dc1f3e8d | 130 | menu_option_pos = menu_option_pos + 1; |
Kern_EL17KJTF | 2:6baf849b0270 | 131 | // printf("South Pressed"); |
Kern_EL17KJTF | 2:6baf849b0270 | 132 | wait_ms(250); |
Kern_EL17KJTF | 2:6baf849b0270 | 133 | } |
Kern_EL17KJTF | 4:59175720d8ee | 134 | if (menu_option_pos > 4) { |
Kern_EL17KJTF | 3:b248dc1f3e8d | 135 | menu_option_pos = 0; |
Kern_EL17KJTF | 2:6baf849b0270 | 136 | } |
Kern_EL17KJTF | 3:b248dc1f3e8d | 137 | if (menu_option_pos < 0) { |
Kern_EL17KJTF | 4:59175720d8ee | 138 | menu_option_pos = 4; |
Kern_EL17KJTF | 2:6baf849b0270 | 139 | } |
Kern_EL17KJTF | 4:59175720d8ee | 140 | arrow_pos = 8 + (menu_option_pos * 8); |
Kern_EL17KJTF | 3:b248dc1f3e8d | 141 | // printf("Option Num = %d", menu_option_pos) |
Kern_EL17KJTF | 2:6baf849b0270 | 142 | } |
Kern_EL17KJTF | 2:6baf849b0270 | 143 | |
Kern_EL17KJTF | 2:6baf849b0270 | 144 | void arrow_select() { |
Kern_EL17KJTF | 2:6baf849b0270 | 145 | if (pad.check_event(Gamepad::A_PRESSED) == true) { |
Kern_EL17KJTF | 3:b248dc1f3e8d | 146 | if (menu_option_pos == 0) { |
Kern_EL17KJTF | 2:6baf849b0270 | 147 | // printf("GameEngine"); |
Kern_EL17KJTF | 10:28575a6eaa13 | 148 | eng.gameengine_run(pad, lcd, barrel, banana, dky); |
Kern_EL17KJTF | 12:50a7abf21f18 | 149 | eng.gameengine_score(pad, lcd, banana); |
Kern_EL17KJTF | 2:6baf849b0270 | 150 | } |
Kern_EL17KJTF | 3:b248dc1f3e8d | 151 | if (menu_option_pos == 1) { |
Kern_EL17KJTF | 2:6baf849b0270 | 152 | // printf("Controls"); |
Kern_EL17KJTF | 13:94abfe83a294 | 153 | cont.controls_run(pad, lcd); |
Kern_EL17KJTF | 2:6baf849b0270 | 154 | } |
Kern_EL17KJTF | 3:b248dc1f3e8d | 155 | if (menu_option_pos == 2) { |
Kern_EL17KJTF | 2:6baf849b0270 | 156 | // printf("Instructions"); |
Kern_EL17KJTF | 2:6baf849b0270 | 157 | instructions_run(); |
Kern_EL17KJTF | 2:6baf849b0270 | 158 | } |
Kern_EL17KJTF | 3:b248dc1f3e8d | 159 | if (menu_option_pos == 3) { |
Kern_EL17KJTF | 2:6baf849b0270 | 160 | // printf("Options"); |
Kern_EL17KJTF | 6:478f81e79d9b | 161 | opt.options_run(pad, lcd); |
Kern_EL17KJTF | 2:6baf849b0270 | 162 | } |
Kern_EL17KJTF | 4:59175720d8ee | 163 | if (menu_option_pos == 4) { |
Kern_EL17KJTF | 4:59175720d8ee | 164 | // printf("High Scores"); |
Kern_EL17KJTF | 4:59175720d8ee | 165 | high_scores_run(); |
Kern_EL17KJTF | 4:59175720d8ee | 166 | } |
Kern_EL17KJTF | 2:6baf849b0270 | 167 | } |
Kern_EL17KJTF | 2:6baf849b0270 | 168 | } |
Kern_EL17KJTF | 1:7a0917df015a | 169 | |
Kern_EL17KJTF | 2:6baf849b0270 | 170 | void print_menu() { |
Kern_EL17KJTF | 2:6baf849b0270 | 171 | lcd.clear(); |
Kern_EL17KJTF | 3:b248dc1f3e8d | 172 | lcd.printString("Main Menu",19,0); |
Kern_EL17KJTF | 4:59175720d8ee | 173 | lcd.printString("Start Game",8,1); |
Kern_EL17KJTF | 4:59175720d8ee | 174 | lcd.printString("Controls",8,2); |
Kern_EL17KJTF | 4:59175720d8ee | 175 | lcd.printString("Instructions",8,3); |
Kern_EL17KJTF | 4:59175720d8ee | 176 | lcd.printString("Options",8,4); |
Kern_EL17KJTF | 4:59175720d8ee | 177 | lcd.printString("High Scores",8,5); |
Kern_EL17KJTF | 2:6baf849b0270 | 178 | lcd.drawSprite(0,arrow_pos,7,7,(int *)menu_arrow); |
Kern_EL17KJTF | 2:6baf849b0270 | 179 | lcd.refresh(); |
Kern_EL17KJTF | 1:7a0917df015a | 180 | } |
Kern_EL17KJTF | 1:7a0917df015a | 181 | |
Kern_EL17KJTF | 2:6baf849b0270 | 182 | void welcome() { |
Kern_EL17KJTF | 1:7a0917df015a | 183 | lcd.clear(); |
Kern_EL17KJTF | 2:6baf849b0270 | 184 | lcd.drawSprite(24,0,36,34,(int *)menu_dk_face); |
Kern_EL17KJTF | 1:7a0917df015a | 185 | lcd.printString(" Donkey Kong",0,5); |
Kern_EL17KJTF | 1:7a0917df015a | 186 | lcd.refresh(); |
Kern_EL17KJTF | 2:6baf849b0270 | 187 | wait(1.0); //edit back to longer |
Kern_EL17KJTF | 1:7a0917df015a | 188 | lcd.clear(); |
Kern_EL17KJTF | 2:6baf849b0270 | 189 | lcd.printString(" Created",0,0); |
Kern_EL17KJTF | 2:6baf849b0270 | 190 | lcd.printString(" By",0,1); |
Kern_EL17KJTF | 2:6baf849b0270 | 191 | lcd.printString(" Kern Fowler",0,3); |
Kern_EL17KJTF | 2:6baf849b0270 | 192 | lcd.printString(" 201116686",0,4); |
Kern_EL17KJTF | 1:7a0917df015a | 193 | lcd.refresh(); |
Kern_EL17KJTF | 2:6baf849b0270 | 194 | wait(1.0); |
Kern_EL17KJTF | 1:7a0917df015a | 195 | } |
Kern_EL17KJTF | 10:28575a6eaa13 | 196 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 197 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 198 | // Donkey ----------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 199 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 200 | // Barrel ----------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 201 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 202 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 203 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 204 | // Banana ----------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 205 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 206 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 207 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 208 | // Game State-------------------------------------------------------------- |
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 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 214 | // Instructions State------------------------------------------------------ |
Kern_EL17KJTF | 10:28575a6eaa13 | 215 | void instructions_run() { |
Kern_EL17KJTF | 10:28575a6eaa13 | 216 | wait_ms(250); |
Kern_EL17KJTF | 10:28575a6eaa13 | 217 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 218 | while (pad.check_event(Gamepad::BACK_PRESSED) == false) { |
Kern_EL17KJTF | 10:28575a6eaa13 | 219 | //printf("Instructions State"); |
Kern_EL17KJTF | 10:28575a6eaa13 | 220 | lcd.clear(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 221 | lcd.printString("Instructions",7,0); |
Kern_EL17KJTF | 10:28575a6eaa13 | 222 | lcd.refresh(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 223 | wait_ms(1.0f/fps); |
Kern_EL17KJTF | 10:28575a6eaa13 | 224 | } |
Kern_EL17KJTF | 10:28575a6eaa13 | 225 | } |
Kern_EL17KJTF | 10:28575a6eaa13 | 226 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 227 | // Options State----------------------------------------------------------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 228 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 229 | |
Kern_EL17KJTF | 10:28575a6eaa13 | 230 | // High Score State-------------------------------------------------------- |
Kern_EL17KJTF | 10:28575a6eaa13 | 231 | void high_scores_run() { |
Kern_EL17KJTF | 10:28575a6eaa13 | 232 | while (pad.check_event(Gamepad::BACK_PRESSED) == false) { |
Kern_EL17KJTF | 10:28575a6eaa13 | 233 | //printf("High Score State"); |
Kern_EL17KJTF | 10:28575a6eaa13 | 234 | lcd.clear(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 235 | lcd.printString("High Scores",12,0); |
Kern_EL17KJTF | 10:28575a6eaa13 | 236 | lcd.refresh(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 237 | wait_ms(1.0f/fps); |
Kern_EL17KJTF | 10:28575a6eaa13 | 238 | } |
Kern_EL17KJTF | 10:28575a6eaa13 | 239 | } |
Kern_EL17KJTF | 10:28575a6eaa13 | 240 |