Game For ECE 2035
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
actions.cpp@7:862062ffca62, 2021-11-20 (annotated)
- Committer:
- nasiromar
- Date:
- Sat Nov 20 03:37:50 2021 +0000
- Revision:
- 7:862062ffca62
- Parent:
- 6:c9695079521d
- Child:
- 8:fcc333a8f9e1
Base Model without game over
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nasiromar | 6:c9695079521d | 1 | #include "actions.h" |
nasiromar | 6:c9695079521d | 2 | #include "speech.h" |
nasiromar | 6:c9695079521d | 3 | #include "hardware.h" |
nasiromar | 6:c9695079521d | 4 | #include "globals.h" |
nasiromar | 7:862062ffca62 | 5 | #include "map.h" |
nasiromar | 6:c9695079521d | 6 | |
nasiromar | 6:c9695079521d | 7 | |
nasiromar | 6:c9695079521d | 8 | void npc_speech1() |
nasiromar | 6:c9695079521d | 9 | { |
nasiromar | 6:c9695079521d | 10 | |
nasiromar | 7:862062ffca62 | 11 | char line1[] = "Salutations:"; |
nasiromar | 7:862062ffca62 | 12 | char line2[] = "Traveler!"; |
nasiromar | 7:862062ffca62 | 13 | horizontal_speech1(line1,line2); |
nasiromar | 7:862062ffca62 | 14 | |
nasiromar | 7:862062ffca62 | 15 | char line3[] = "Welcome to"; |
nasiromar | 7:862062ffca62 | 16 | char line4[] = "NasLand"; |
nasiromar | 7:862062ffca62 | 17 | horizontal_speech1(line3,line4); |
nasiromar | 7:862062ffca62 | 18 | |
nasiromar | 7:862062ffca62 | 19 | char line5[] = "I offer a quest"; |
nasiromar | 7:862062ffca62 | 20 | char line6[] = "If thee accept"; |
nasiromar | 7:862062ffca62 | 21 | horizontal_speech1(line5,line6); |
nasiromar | 7:862062ffca62 | 22 | |
nasiromar | 7:862062ffca62 | 23 | char line7[] = "Excellent!"; |
nasiromar | 7:862062ffca62 | 24 | char line8[] = "I need a dragon"; |
nasiromar | 7:862062ffca62 | 25 | horizontal_speech1(line7,line8); |
nasiromar | 7:862062ffca62 | 26 | |
nasiromar | 7:862062ffca62 | 27 | char line9[] = "Well not need"; |
nasiromar | 7:862062ffca62 | 28 | char line10[] = "but want DEAD!"; |
nasiromar | 7:862062ffca62 | 29 | horizontal_speech1(line9,line10); |
nasiromar | 7:862062ffca62 | 30 | |
nasiromar | 7:862062ffca62 | 31 | char line11[] = "so go to the "; |
nasiromar | 7:862062ffca62 | 32 | char line12[] = "portal next.."; |
nasiromar | 7:862062ffca62 | 33 | horizontal_speech1(line11,line12); |
nasiromar | 7:862062ffca62 | 34 | |
nasiromar | 7:862062ffca62 | 35 | char line13[] = "Hint: "; |
nasiromar | 7:862062ffca62 | 36 | char line14[] = "X[20],Y[35]"; |
nasiromar | 7:862062ffca62 | 37 | horizontal_speech1(line13,line14); |
nasiromar | 7:862062ffca62 | 38 | } |
nasiromar | 7:862062ffca62 | 39 | |
nasiromar | 7:862062ffca62 | 40 | void npc_speech2() |
nasiromar | 7:862062ffca62 | 41 | { |
nasiromar | 7:862062ffca62 | 42 | |
nasiromar | 7:862062ffca62 | 43 | char line1[] = "Welcome Back"; |
nasiromar | 6:c9695079521d | 44 | char line2[] = "Traveler!"; |
nasiromar | 6:c9695079521d | 45 | horizontal_speech1(line1,line2); |
nasiromar | 7:862062ffca62 | 46 | |
nasiromar | 7:862062ffca62 | 47 | char line3[] = "The Dragon"; |
nasiromar | 7:862062ffca62 | 48 | char line4[] = "has been slain"; |
nasiromar | 7:862062ffca62 | 49 | horizontal_speech1(line3,line4); |
nasiromar | 7:862062ffca62 | 50 | |
nasiromar | 7:862062ffca62 | 51 | char line5[] = "You have saved"; |
nasiromar | 7:862062ffca62 | 52 | char line6[] = "NasLand"; |
nasiromar | 7:862062ffca62 | 53 | horizontal_speech1(line5,line6); |
nasiromar | 7:862062ffca62 | 54 | |
nasiromar | 7:862062ffca62 | 55 | char line7[] = "Go to Castle"; |
nasiromar | 7:862062ffca62 | 56 | char line8[] = "To collect"; |
nasiromar | 7:862062ffca62 | 57 | horizontal_speech1(line7,line8); |
nasiromar | 7:862062ffca62 | 58 | |
nasiromar | 7:862062ffca62 | 59 | char line9[] = "TREASURE"; |
nasiromar | 7:862062ffca62 | 60 | char line10[] = "TREASURE"; |
nasiromar | 7:862062ffca62 | 61 | horizontal_speech1(line9,line10); |
nasiromar | 7:862062ffca62 | 62 | |
nasiromar | 7:862062ffca62 | 63 | char line11[] = "Farwell Great "; |
nasiromar | 7:862062ffca62 | 64 | char line12[] = "Mage..."; |
nasiromar | 7:862062ffca62 | 65 | horizontal_speech1(line11,line12); |
nasiromar | 7:862062ffca62 | 66 | |
nasiromar | 7:862062ffca62 | 67 | char line13[] = "Hint: "; |
nasiromar | 7:862062ffca62 | 68 | char line14[] = "X[26],Y[12]"; |
nasiromar | 7:862062ffca62 | 69 | horizontal_speech1(line13,line14); |
nasiromar | 7:862062ffca62 | 70 | } |
nasiromar | 7:862062ffca62 | 71 | |
nasiromar | 7:862062ffca62 | 72 | |
nasiromar | 7:862062ffca62 | 73 | void slay_dragon(){ |
nasiromar | 7:862062ffca62 | 74 | char line1[] = "Me!?!"; |
nasiromar | 7:862062ffca62 | 75 | char line2[] = "Dying? at the"; |
nasiromar | 7:862062ffca62 | 76 | horizontal_speech1(line1,line2); |
nasiromar | 7:862062ffca62 | 77 | |
nasiromar | 7:862062ffca62 | 78 | char line3[] = "hands of a"; |
nasiromar | 7:862062ffca62 | 79 | char line4[] = "mere MORTAL"; |
nasiromar | 7:862062ffca62 | 80 | horizontal_speech1(line3,line4); |
nasiromar | 7:862062ffca62 | 81 | |
nasiromar | 7:862062ffca62 | 82 | char line5[] = "Ahhhhhhhh!"; |
nasiromar | 7:862062ffca62 | 83 | char line6[] = "DIES:("; |
nasiromar | 7:862062ffca62 | 84 | horizontal_speech1(line5,line6); |
nasiromar | 7:862062ffca62 | 85 | |
nasiromar | 7:862062ffca62 | 86 | char line7[] = "CONGRATULATIONS!"; |
nasiromar | 7:862062ffca62 | 87 | char line8[] = "Dragon Slain"; |
nasiromar | 7:862062ffca62 | 88 | horizontal_speech1(line7,line8); |
nasiromar | 7:862062ffca62 | 89 | |
nasiromar | 7:862062ffca62 | 90 | char line9[] = "Heres the key!"; |
nasiromar | 7:862062ffca62 | 91 | char line10[] = "Well Done!"; |
nasiromar | 7:862062ffca62 | 92 | horizontal_speech1(line9,line10); |
nasiromar | 7:862062ffca62 | 93 | |
nasiromar | 7:862062ffca62 | 94 | } |
nasiromar | 7:862062ffca62 | 95 | |
nasiromar | 7:862062ffca62 | 96 | |
nasiromar | 7:862062ffca62 | 97 | |
nasiromar | 7:862062ffca62 | 98 | |
nasiromar | 7:862062ffca62 | 99 | |
nasiromar | 7:862062ffca62 | 100 | void init_dung(){ |
nasiromar | 7:862062ffca62 | 101 | Map* map = set_active_map(1); |
nasiromar | 7:862062ffca62 | 102 | for(int i = map_width() + 7; i < map_area(); i += 39) { |
nasiromar | 7:862062ffca62 | 103 | add_chest(i % map_width(), i / map_width()); |
nasiromar | 7:862062ffca62 | 104 | } |
nasiromar | 7:862062ffca62 | 105 | pc.printf("plants\r\n"); |
nasiromar | 7:862062ffca62 | 106 | |
nasiromar | 7:862062ffca62 | 107 | pc.printf("Adding walls!\r\n"); |
nasiromar | 7:862062ffca62 | 108 | add_castle(0, 0, HORIZONTAL, map_width()); |
nasiromar | 7:862062ffca62 | 109 | add_castle(0, map_height()-1, HORIZONTAL, map_width()); |
nasiromar | 7:862062ffca62 | 110 | add_castle(0, 0, VERTICAL, map_height()); |
nasiromar | 7:862062ffca62 | 111 | add_castle(map_width()-1, 0, VERTICAL, map_height()); |
nasiromar | 7:862062ffca62 | 112 | pc.printf("Walls done!\r\n"); |
nasiromar | 7:862062ffca62 | 113 | |
nasiromar | 7:862062ffca62 | 114 | |
nasiromar | 7:862062ffca62 | 115 | add_portal2(15,21); |
nasiromar | 7:862062ffca62 | 116 | |
nasiromar | 7:862062ffca62 | 117 | add_dragon(18,9); |
nasiromar | 7:862062ffca62 | 118 | |
nasiromar | 7:862062ffca62 | 119 | |
nasiromar | 7:862062ffca62 | 120 | print_map(); |
nasiromar | 7:862062ffca62 | 121 | |
nasiromar | 7:862062ffca62 | 122 | } |