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@31:06713cdbba37, 2019-05-09 (annotated)
- Committer:
- Kern_EL17KJTF
- Date:
- Thu May 09 01:40:45 2019 +0000
- Revision:
- 31:06713cdbba37
- Parent:
- 20:c4e6941c98e2
- Child:
- 32:dca62ba807de
Documentation - HighScores 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 | 16:3abc974e8f69 | 9 | Date: 08/05/2019 |
Kern_EL17KJTF | 16:3abc974e8f69 | 10 | Version: 1.4 |
Kern_EL17KJTF | 1:7a0917df015a | 11 | |
Kern_EL17KJTF | 1:7a0917df015a | 12 | */ |
Kern_EL17KJTF | 16:3abc974e8f69 | 13 | |
Kern_EL17KJTF | 16:3abc974e8f69 | 14 | // Includes all required classes in their respective libraries. |
Kern_EL17KJTF | 10:28575a6eaa13 | 15 | #include "mbed.h" |
Kern_EL17KJTF | 10:28575a6eaa13 | 16 | #include "N5110.h" |
Kern_EL17KJTF | 10:28575a6eaa13 | 17 | #include "Gamepad.h" |
Kern_EL17KJTF | 10:28575a6eaa13 | 18 | #include "Donkey.h" |
Kern_EL17KJTF | 10:28575a6eaa13 | 19 | #include "Options.h" |
Kern_EL17KJTF | 13:94abfe83a294 | 20 | #include "Controls.h" |
Kern_EL17KJTF | 14:d6fbbb912425 | 21 | #include "Instructions.h" |
Kern_EL17KJTF | 16:3abc974e8f69 | 22 | #include "HighScores.h" |
Kern_EL17KJTF | 12:50a7abf21f18 | 23 | #include "Banana.h" |
Kern_EL17KJTF | 10:28575a6eaa13 | 24 | #include "Barrel.h" |
Kern_EL17KJTF | 10:28575a6eaa13 | 25 | #include "GameEngine.h" |
Kern_EL17KJTF | 1:7a0917df015a | 26 | |
Kern_EL17KJTF | 16:3abc974e8f69 | 27 | // Define all objects. |
Kern_EL17KJTF | 16:3abc974e8f69 | 28 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); // LCD class object- pins format required only in define. |
Kern_EL17KJTF | 16:3abc974e8f69 | 29 | Gamepad pad; // Gamepad class obejct. |
Kern_EL17KJTF | 16:3abc974e8f69 | 30 | Donkey dky; // Donkey Kong class object. |
Kern_EL17KJTF | 16:3abc974e8f69 | 31 | Barrel barrel; // Barrel class object. |
Kern_EL17KJTF | 16:3abc974e8f69 | 32 | Banana banana; // Banana class object. |
Kern_EL17KJTF | 16:3abc974e8f69 | 33 | GameEngine eng; // GameEngine class object. |
Kern_EL17KJTF | 16:3abc974e8f69 | 34 | Options opt; // Options Menu class object. |
Kern_EL17KJTF | 16:3abc974e8f69 | 35 | Controls cont; // Controls Menu class object. |
Kern_EL17KJTF | 16:3abc974e8f69 | 36 | Instructions instr; // Instructions Menu class object. |
Kern_EL17KJTF | 16:3abc974e8f69 | 37 | HighScores high; // HighScores Menu class object. |
Kern_EL17KJTF | 16:3abc974e8f69 | 38 | Serial pc(USBTX, USBRX); // Used for testing. |
Kern_EL17KJTF | 14:d6fbbb912425 | 39 | |
Kern_EL17KJTF | 16:3abc974e8f69 | 40 | // Prototypes |
Kern_EL17KJTF | 16:3abc974e8f69 | 41 | void init(); // |
Kern_EL17KJTF | 10:28575a6eaa13 | 42 | void print_menu(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 43 | void welcome(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 44 | void arrow_location(); |
Kern_EL17KJTF | 10:28575a6eaa13 | 45 | void arrow_select(); |
Kern_EL17KJTF | 6:478f81e79d9b | 46 | |
Kern_EL17KJTF | 16:3abc974e8f69 | 47 | // Intialise Menu Variables |
Kern_EL17KJTF | 2:6baf849b0270 | 48 | int fps = 24; |
Kern_EL17KJTF | 2:6baf849b0270 | 49 | int direction; |
Kern_EL17KJTF | 3:b248dc1f3e8d | 50 | int menu_option_pos = 0; |
Kern_EL17KJTF | 2:6baf849b0270 | 51 | int arrow_pos = 0; |
Kern_EL17KJTF | 2:6baf849b0270 | 52 | |
Kern_EL17KJTF | 16:3abc974e8f69 | 53 | int menu_arrow[7][7] = { // Arrow pointer sprite used in main menu. |
Kern_EL17KJTF | 10:28575a6eaa13 | 54 | {0,0,0,0,0,0,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 55 | {0,0,0,0,1,0,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 56 | {0,0,0,0,1,1,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 57 | {1,1,1,1,1,1,1,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 58 | {0,0,0,0,1,1,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 59 | {0,0,0,0,1,0,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 60 | {0,0,0,0,0,0,0,}, |
Kern_EL17KJTF | 10:28575a6eaa13 | 61 | }; |
Kern_EL17KJTF | 7:ffbc921c20f7 | 62 | |
Kern_EL17KJTF | 16:3abc974e8f69 | 63 | int menu_dk_face[36][34] = { // Donkey Kong face sprite used in opening scene. |
Kern_EL17KJTF | 10:28575a6eaa13 | 64 | { 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 | 65 | { 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 | 66 | { 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 | 67 | { 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 | 68 | { 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 | 69 | { 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 | 70 | { 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 | 71 | { 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 | 72 | { 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 | 73 | { 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 | 74 | { 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 | 75 | { 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 | 76 | { 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 | 77 | { 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 | 78 | { 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 | 79 | { 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 | 80 | { 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 | 81 | { 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 | 82 | { 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 | 83 | { 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 | 84 | { 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 | 85 | { 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 | 86 | { 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 | 87 | { 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 | 88 | { 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 | 89 | { 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 | 90 | { 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 | 91 | { 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 | 92 | { 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 | 93 | { 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 | 94 | { 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 | 95 | { 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 | 96 | { 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 | 97 | { 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 | 98 | { 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 | 99 | { 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 | 100 | }; |
Kern_EL17KJTF | 12:50a7abf21f18 | 101 | |
Kern_EL17KJTF | 16:3abc974e8f69 | 102 | // Functions |
Kern_EL17KJTF | 2:6baf849b0270 | 103 | int main() { |
Kern_EL17KJTF | 16:3abc974e8f69 | 104 | init(); // Initialises the LCD and Gamepad. |
Kern_EL17KJTF | 16:3abc974e8f69 | 105 | welcome(); // Displays welcome screen, has information about the creator and title screen. |
Kern_EL17KJTF | 16:3abc974e8f69 | 106 | while(1) { // Main menu loop |
Kern_EL17KJTF | 16:3abc974e8f69 | 107 | arrow_location(); // Determines arrow position on screen, will go up and down with joystick commands. |
Kern_EL17KJTF | 16:3abc974e8f69 | 108 | print_menu(); // This re-prints the menu at the start of every loop. |
Kern_EL17KJTF | 16:3abc974e8f69 | 109 | arrow_select(); // Will select the current menu options when A button pressed. |
Kern_EL17KJTF | 2:6baf849b0270 | 110 | wait_ms(1.0f/fps); |
Kern_EL17KJTF | 1:7a0917df015a | 111 | } |
Kern_EL17KJTF | 1:7a0917df015a | 112 | } |
Kern_EL17KJTF | 16:3abc974e8f69 | 113 | |
Kern_EL17KJTF | 16:3abc974e8f69 | 114 | // Initialises Gamepad and LCD. |
Kern_EL17KJTF | 2:6baf849b0270 | 115 | void init() { |
Kern_EL17KJTF | 1:7a0917df015a | 116 | lcd.init(); |
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 | 16:3abc974e8f69 | 121 | // Moves arrow sprite up or down depending on joystick commands. If reaches the bottom will go back to top position. |
Kern_EL17KJTF | 2:6baf849b0270 | 122 | void arrow_location() { |
Kern_EL17KJTF | 2:6baf849b0270 | 123 | direction = pad.get_direction(); |
Kern_EL17KJTF | 16:3abc974e8f69 | 124 | if (direction == N) { // Will occur if the joystick is pushed up. |
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 | 16:3abc974e8f69 | 129 | if (direction == S) { // Will occur if the joystick is pushed down. |
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 | 16:3abc974e8f69 | 140 | arrow_pos = 8 + (menu_option_pos * 8); // Sets and offset due to sprite and font size. |
Kern_EL17KJTF | 3:b248dc1f3e8d | 141 | // printf("Option Num = %d", menu_option_pos) |
Kern_EL17KJTF | 2:6baf849b0270 | 142 | } |
Kern_EL17KJTF | 2:6baf849b0270 | 143 | |
Kern_EL17KJTF | 16:3abc974e8f69 | 144 | // Runs the current menu option the arrow has selected when A is pressed. |
Kern_EL17KJTF | 2:6baf849b0270 | 145 | void arrow_select() { |
Kern_EL17KJTF | 2:6baf849b0270 | 146 | if (pad.check_event(Gamepad::A_PRESSED) == true) { |
Kern_EL17KJTF | 16:3abc974e8f69 | 147 | if (menu_option_pos == 0) { // Start Game option. |
Kern_EL17KJTF | 2:6baf849b0270 | 148 | // printf("GameEngine"); |
Kern_EL17KJTF | 16:3abc974e8f69 | 149 | eng.gameengine_run(pad, lcd, barrel, banana, dky); // Runs the main game loop in the GameEngine class. |
Kern_EL17KJTF | 31:06713cdbba37 | 150 | eng.gameengine_score(pad, lcd, banana, high); // When gameover is reached, runs the end game screen. |
Kern_EL17KJTF | 2:6baf849b0270 | 151 | } |
Kern_EL17KJTF | 16:3abc974e8f69 | 152 | if (menu_option_pos == 1) { // Controls option. |
Kern_EL17KJTF | 2:6baf849b0270 | 153 | // printf("Controls"); |
Kern_EL17KJTF | 16:3abc974e8f69 | 154 | cont.controls_run(pad, lcd); // Runs the controls screen loop. |
Kern_EL17KJTF | 2:6baf849b0270 | 155 | } |
Kern_EL17KJTF | 16:3abc974e8f69 | 156 | if (menu_option_pos == 2) { // Instructions option. |
Kern_EL17KJTF | 2:6baf849b0270 | 157 | // printf("Instructions"); |
Kern_EL17KJTF | 16:3abc974e8f69 | 158 | instr.instructions_run(pad, lcd); // Runs the instructions screen loop. |
Kern_EL17KJTF | 2:6baf849b0270 | 159 | } |
Kern_EL17KJTF | 16:3abc974e8f69 | 160 | if (menu_option_pos == 3) { // Options option. |
Kern_EL17KJTF | 2:6baf849b0270 | 161 | // printf("Options"); |
Kern_EL17KJTF | 16:3abc974e8f69 | 162 | opt.options_run(pad, lcd); // Runs the options screen loop. |
Kern_EL17KJTF | 2:6baf849b0270 | 163 | } |
Kern_EL17KJTF | 16:3abc974e8f69 | 164 | if (menu_option_pos == 4) { // High Scores option. |
Kern_EL17KJTF | 4:59175720d8ee | 165 | // printf("High Scores"); |
Kern_EL17KJTF | 16:3abc974e8f69 | 166 | high.highscores_run(pad, lcd, banana); // Runs the highscores screen loop. |
Kern_EL17KJTF | 4:59175720d8ee | 167 | } |
Kern_EL17KJTF | 2:6baf849b0270 | 168 | } |
Kern_EL17KJTF | 2:6baf849b0270 | 169 | } |
Kern_EL17KJTF | 1:7a0917df015a | 170 | |
Kern_EL17KJTF | 16:3abc974e8f69 | 171 | // Prints the main menu, with options and the selector arrow. |
Kern_EL17KJTF | 2:6baf849b0270 | 172 | void print_menu() { |
Kern_EL17KJTF | 2:6baf849b0270 | 173 | lcd.clear(); |
Kern_EL17KJTF | 3:b248dc1f3e8d | 174 | lcd.printString("Main Menu",19,0); |
Kern_EL17KJTF | 4:59175720d8ee | 175 | lcd.printString("Start Game",8,1); |
Kern_EL17KJTF | 4:59175720d8ee | 176 | lcd.printString("Controls",8,2); |
Kern_EL17KJTF | 4:59175720d8ee | 177 | lcd.printString("Instructions",8,3); |
Kern_EL17KJTF | 4:59175720d8ee | 178 | lcd.printString("Options",8,4); |
Kern_EL17KJTF | 4:59175720d8ee | 179 | lcd.printString("High Scores",8,5); |
Kern_EL17KJTF | 2:6baf849b0270 | 180 | lcd.drawSprite(0,arrow_pos,7,7,(int *)menu_arrow); |
Kern_EL17KJTF | 2:6baf849b0270 | 181 | lcd.refresh(); |
Kern_EL17KJTF | 1:7a0917df015a | 182 | } |
Kern_EL17KJTF | 1:7a0917df015a | 183 | |
Kern_EL17KJTF | 16:3abc974e8f69 | 184 | // Prints basic information about the game, and plays title screen. |
Kern_EL17KJTF | 2:6baf849b0270 | 185 | void welcome() { |
Kern_EL17KJTF | 1:7a0917df015a | 186 | lcd.clear(); |
Kern_EL17KJTF | 16:3abc974e8f69 | 187 | lcd.drawSprite(24,0,36,34,(int *)menu_dk_face); // Donkey Kong sprite for main menu |
Kern_EL17KJTF | 20:c4e6941c98e2 | 188 | lcd.printString(" Donkey Kong",0,5); // Game title. |
Kern_EL17KJTF | 1:7a0917df015a | 189 | lcd.refresh(); |
Kern_EL17KJTF | 16:3abc974e8f69 | 190 | wait(4.0); |
Kern_EL17KJTF | 1:7a0917df015a | 191 | lcd.clear(); |
Kern_EL17KJTF | 16:3abc974e8f69 | 192 | lcd.printString(" Created",0,0); // Information about creator. |
Kern_EL17KJTF | 2:6baf849b0270 | 193 | lcd.printString(" By",0,1); |
Kern_EL17KJTF | 2:6baf849b0270 | 194 | lcd.printString(" Kern Fowler",0,3); |
Kern_EL17KJTF | 2:6baf849b0270 | 195 | lcd.printString(" 201116686",0,4); |
Kern_EL17KJTF | 1:7a0917df015a | 196 | lcd.refresh(); |
Kern_EL17KJTF | 16:3abc974e8f69 | 197 | wait(4.0); |
Kern_EL17KJTF | 17:ac0cb2980f6e | 198 | } |