![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
Blocks/Blocks.cpp@13:9785f2404045, 2019-04-03 (annotated)
- Committer:
- AhmedPlaymaker
- Date:
- Wed Apr 03 17:51:19 2019 +0000
- Revision:
- 13:9785f2404045
- Parent:
- 12:1e601b176437
- Child:
- 18:b391caa5754c
Tried to make the snake such that it does not go through the blocks once it is sideways, succeeded mostly but still has some minor glitches in doing so
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AhmedPlaymaker | 10:751bd953fa27 | 1 | #include "Blocks.h" |
AhmedPlaymaker | 10:751bd953fa27 | 2 | |
AhmedPlaymaker | 10:751bd953fa27 | 3 | Blocks::Blocks() |
AhmedPlaymaker | 10:751bd953fa27 | 4 | { |
AhmedPlaymaker | 10:751bd953fa27 | 5 | |
AhmedPlaymaker | 10:751bd953fa27 | 6 | } |
AhmedPlaymaker | 10:751bd953fa27 | 7 | |
AhmedPlaymaker | 10:751bd953fa27 | 8 | Blocks::~Blocks() |
AhmedPlaymaker | 10:751bd953fa27 | 9 | { |
AhmedPlaymaker | 10:751bd953fa27 | 10 | |
AhmedPlaymaker | 10:751bd953fa27 | 11 | } |
AhmedPlaymaker | 10:751bd953fa27 | 12 | |
AhmedPlaymaker | 10:751bd953fa27 | 13 | //Frame Sprite. |
AhmedPlaymaker | 10:751bd953fa27 | 14 | int Frame[11][1] = { |
AhmedPlaymaker | 10:751bd953fa27 | 15 | {0}, |
AhmedPlaymaker | 10:751bd953fa27 | 16 | {0}, |
AhmedPlaymaker | 10:751bd953fa27 | 17 | {1}, |
AhmedPlaymaker | 10:751bd953fa27 | 18 | {1}, |
AhmedPlaymaker | 10:751bd953fa27 | 19 | {1}, |
AhmedPlaymaker | 10:751bd953fa27 | 20 | {1}, |
AhmedPlaymaker | 10:751bd953fa27 | 21 | {1}, |
AhmedPlaymaker | 10:751bd953fa27 | 22 | {1}, |
AhmedPlaymaker | 10:751bd953fa27 | 23 | {1}, |
AhmedPlaymaker | 10:751bd953fa27 | 24 | {0}, |
AhmedPlaymaker | 10:751bd953fa27 | 25 | {0}, |
AhmedPlaymaker | 10:751bd953fa27 | 26 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 27 | int One[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 28 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 29 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 30 | {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 31 | {0,0,0,0,0,0,1,1,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 32 | {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 33 | {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 34 | {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 35 | {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 36 | {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 37 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 38 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 39 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 40 | int Two[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 41 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 42 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 43 | {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 44 | {0,0,0,0,0,1,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 45 | {0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 46 | {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 47 | {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 48 | {0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 49 | {0,0,0,0,0,1,1,1,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 50 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 51 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 52 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 53 | int Three[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 54 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 55 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 56 | {0,0,0,0,0,1,1,1,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 57 | {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 58 | {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 59 | {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 60 | {0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 61 | {0,0,0,0,0,1,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 62 | {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 63 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 64 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 65 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 66 | int Four[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 67 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 68 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 69 | {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 70 | {0,0,0,0,0,0,0,1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 71 | {0,0,0,0,0,0,1,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 72 | {0,0,0,0,0,1,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 73 | {0,0,0,0,0,1,1,1,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 74 | {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 75 | {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 76 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 77 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 78 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 79 | int Five[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 80 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 81 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 82 | {0,0,0,0,0,1,1,1,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 83 | {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 84 | {0,0,0,0,0,1,1,1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 85 | {0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 86 | {0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 87 | {0,0,0,0,0,1,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 88 | {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 89 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 90 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 91 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 92 | int Six[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 93 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 94 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 95 | {0,0,0,0,0,0,0,0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 96 | {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 97 | {0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 98 | {0,0,0,0,0,1,1,1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 99 | {0,0,0,0,0,1,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 100 | {0,0,0,0,0,1,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 101 | {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 102 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 103 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 104 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 105 | int Seven[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 106 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 107 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 108 | {0,0,0,0,0,1,1,1,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 109 | {0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 110 | {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 111 | {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 112 | {0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 113 | {0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 114 | {0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 115 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 116 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 117 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 118 | int Eight[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 119 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 120 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 121 | {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 122 | {0,0,0,0,0,1,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 123 | {0,0,0,0,0,1,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 124 | {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 125 | {0,0,0,0,0,1,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 126 | {0,0,0,0,0,1,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 127 | {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 128 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 129 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 130 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 131 | int Nine[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 132 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 133 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 134 | {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 135 | {0,0,0,0,0,1,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 136 | {0,0,0,0,0,1,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 137 | {0,0,0,0,0,0,1,1,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 138 | {0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 139 | {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 140 | {0,0,0,0,0,0,1,1,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 141 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 142 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 143 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 144 | int Ten[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 145 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 146 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 147 | {0,0,0,0,1,0,0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 148 | {0,0,0,1,1,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 149 | {0,0,0,0,1,0,0,1,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 150 | {0,0,0,0,1,0,0,1,0,1,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 151 | {0,0,0,0,1,0,0,1,1,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 152 | {0,0,0,0,1,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 153 | {0,0,0,1,1,1,0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 154 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 155 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 156 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 157 | int Eleven[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 158 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 159 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 160 | {0,0,0,0,0,1,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 161 | {0,0,0,0,1,1,0,0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 162 | {0,0,0,0,0,1,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 163 | {0,0,0,0,0,1,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 164 | {0,0,0,0,0,1,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 165 | {0,0,0,0,0,1,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 166 | {0,0,0,0,1,1,1,0,0,1,1,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 167 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 168 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 169 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 170 | int Twelve[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 171 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 172 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 173 | {0,0,0,0,1,0,0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 174 | {0,0,0,1,1,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 175 | {0,0,0,0,1,0,0,0,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 176 | {0,0,0,0,1,0,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 177 | {0,0,0,0,1,0,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 178 | {0,0,0,0,1,0,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 179 | {0,0,0,1,1,1,0,1,1,1,1,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 180 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 181 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 182 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 183 | int Thirteen[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 184 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 185 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 186 | {0,0,0,0,1,0,0,1,1,1,1,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 187 | {0,0,0,1,1,0,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 188 | {0,0,0,0,1,0,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 189 | {0,0,0,0,1,0,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 190 | {0,0,0,0,1,0,0,0,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 191 | {0,0,0,0,1,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 192 | {0,0,0,1,1,1,0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 193 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 194 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 195 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 196 | int Fourteen[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 197 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 198 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 199 | {0,0,0,0,1,0,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 200 | {0,0,0,1,1,0,0,0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 201 | {0,0,0,0,1,0,0,0,1,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 202 | {0,0,0,0,1,0,0,1,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 203 | {0,0,0,0,1,0,0,1,1,1,1,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 204 | {0,0,0,0,1,0,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 205 | {0,0,0,1,1,1,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 206 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 207 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 208 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 209 | int Fifteen[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 210 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 211 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 212 | {0,0,0,0,1,0,0,1,1,1,1,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 213 | {0,0,0,1,1,0,0,1,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 214 | {0,0,0,0,1,0,0,1,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 215 | {0,0,0,0,1,0,0,0,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 216 | {0,0,0,0,1,0,0,0,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 217 | {0,0,0,0,1,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 218 | {0,0,0,1,1,1,0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 219 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 220 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 221 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 222 | int Sixteen[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 223 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 224 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 225 | {0,0,0,0,1,0,0,0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 226 | {0,0,0,1,1,0,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 227 | {0,0,0,0,1,0,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 228 | {0,0,0,0,1,0,0,1,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 229 | {0,0,0,0,1,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 230 | {0,0,0,0,1,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 231 | {0,0,0,1,1,1,0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 232 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 233 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 234 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 235 | int Seventeen[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 236 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 237 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 238 | {0,0,0,0,1,0,0,1,1,1,1,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 239 | {0,0,0,1,1,0,0,0,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 240 | {0,0,0,0,1,0,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 241 | {0,0,0,0,1,0,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 242 | {0,0,0,0,1,0,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 243 | {0,0,0,0,1,0,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 244 | {0,0,0,1,1,1,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 245 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 246 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 247 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 248 | int Eighteen[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 249 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 250 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 251 | {0,0,0,0,1,0,0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 252 | {0,0,0,1,1,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 253 | {0,0,0,0,1,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 254 | {0,0,0,0,1,0,0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 255 | {0,0,0,0,1,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 256 | {0,0,0,0,1,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 257 | {0,0,0,1,1,1,0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 258 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 259 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 260 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 261 | int Nineteen[11][15] = { |
AhmedPlaymaker | 10:751bd953fa27 | 262 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 263 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 264 | {0,0,0,0,1,0,0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 265 | {0,0,0,1,1,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 266 | {0,0,0,0,1,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 267 | {0,0,0,0,1,0,0,0,1,1,1,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 268 | {0,0,0,0,1,0,0,0,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 269 | {0,0,0,0,1,0,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 270 | {0,0,0,1,1,1,0,0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 271 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 10:751bd953fa27 | 272 | {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}, |
AhmedPlaymaker | 10:751bd953fa27 | 273 | }; |
AhmedPlaymaker | 13:9785f2404045 | 274 | int Nothing[11][15] = { |
AhmedPlaymaker | 13:9785f2404045 | 275 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 13:9785f2404045 | 276 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 13:9785f2404045 | 277 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 13:9785f2404045 | 278 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 13:9785f2404045 | 279 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 13:9785f2404045 | 280 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 13:9785f2404045 | 281 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 13:9785f2404045 | 282 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 13:9785f2404045 | 283 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 13:9785f2404045 | 284 | }; |
AhmedPlaymaker | 10:751bd953fa27 | 285 | |
AhmedPlaymaker | 10:751bd953fa27 | 286 | int k = 0; |
AhmedPlaymaker | 10:751bd953fa27 | 287 | void Blocks::init() |
AhmedPlaymaker | 10:751bd953fa27 | 288 | { |
AhmedPlaymaker | 10:751bd953fa27 | 289 | blockdrop=0; |
AhmedPlaymaker | 10:751bd953fa27 | 290 | } |
AhmedPlaymaker | 10:751bd953fa27 | 291 | |
AhmedPlaymaker | 10:751bd953fa27 | 292 | |
AhmedPlaymaker | 12:1e601b176437 | 293 | int Blocks::draw(N5110 &lcd, int length, int blocknum, int srn) |
AhmedPlaymaker | 10:751bd953fa27 | 294 | { |
AhmedPlaymaker | 10:751bd953fa27 | 295 | |
AhmedPlaymaker | 10:751bd953fa27 | 296 | _velocity.x = 0; |
AhmedPlaymaker | 10:751bd953fa27 | 297 | _velocity.y = 1; |
AhmedPlaymaker | 10:751bd953fa27 | 298 | |
AhmedPlaymaker | 10:751bd953fa27 | 299 | //Resets SnakeFood position if it reaches the bottom of the screen. |
AhmedPlaymaker | 10:751bd953fa27 | 300 | //Also prevents SnakeFood from going out of the side of the screen. |
AhmedPlaymaker | 10:751bd953fa27 | 301 | if(_bx < 0){ |
AhmedPlaymaker | 10:751bd953fa27 | 302 | _bx = 0; |
AhmedPlaymaker | 10:751bd953fa27 | 303 | } |
AhmedPlaymaker | 10:751bd953fa27 | 304 | if(_bx > 84){ |
AhmedPlaymaker | 10:751bd953fa27 | 305 | _bx = 84; |
AhmedPlaymaker | 10:751bd953fa27 | 306 | } |
AhmedPlaymaker | 11:d6ceff1ff6d7 | 307 | if(_by >= 150){ |
AhmedPlaymaker | 10:751bd953fa27 | 308 | k = 0; |
AhmedPlaymaker | 10:751bd953fa27 | 309 | } |
AhmedPlaymaker | 10:751bd953fa27 | 310 | if(k == 0){ |
AhmedPlaymaker | 12:1e601b176437 | 311 | send=0; |
AhmedPlaymaker | 10:751bd953fa27 | 312 | _bx = 0; //change the number here so that there is always an unsurity(a little) if the food will come or not(change the limits for this) |
AhmedPlaymaker | 10:751bd953fa27 | 313 | _by = -11; |
AhmedPlaymaker | 10:751bd953fa27 | 314 | k = k+1; |
AhmedPlaymaker | 10:751bd953fa27 | 315 | pos = 4; |
AhmedPlaymaker | 10:751bd953fa27 | 316 | times = 1; |
AhmedPlaymaker | 10:751bd953fa27 | 317 | i=0;// to save the positions of the random numbers generated in a block |
AhmedPlaymaker | 10:751bd953fa27 | 318 | while(pos<=68) { |
AhmedPlaymaker | 10:751bd953fa27 | 319 | if(times == rand()%6) { |
AhmedPlaymaker | 11:d6ceff1ff6d7 | 320 | double round = length/(3/2); |
AhmedPlaymaker | 10:751bd953fa27 | 321 | caseselect[i] = floor(round); |
AhmedPlaymaker | 10:751bd953fa27 | 322 | } |
AhmedPlaymaker | 13:9785f2404045 | 323 | if(times == rand()%6) { |
AhmedPlaymaker | 13:9785f2404045 | 324 | caseselect[i] = 0; |
AhmedPlaymaker | 13:9785f2404045 | 325 | } |
AhmedPlaymaker | 10:751bd953fa27 | 326 | else { |
AhmedPlaymaker | 10:751bd953fa27 | 327 | caseselect[i] = rand()%19; |
AhmedPlaymaker | 10:751bd953fa27 | 328 | } |
AhmedPlaymaker | 10:751bd953fa27 | 329 | pos+=16; |
AhmedPlaymaker | 10:751bd953fa27 | 330 | times+=1; |
AhmedPlaymaker | 10:751bd953fa27 | 331 | if (times == 5) { |
AhmedPlaymaker | 10:751bd953fa27 | 332 | times = 0; |
AhmedPlaymaker | 10:751bd953fa27 | 333 | } |
AhmedPlaymaker | 10:751bd953fa27 | 334 | i++; |
AhmedPlaymaker | 10:751bd953fa27 | 335 | } |
AhmedPlaymaker | 11:d6ceff1ff6d7 | 336 | double roundagain = length/(14/4); //to make sure at least one is smaller than the snake size |
AhmedPlaymaker | 10:751bd953fa27 | 337 | caseselect[rand()%5] = floor(roundagain); |
AhmedPlaymaker | 10:751bd953fa27 | 338 | |
AhmedPlaymaker | 10:751bd953fa27 | 339 | } |
AhmedPlaymaker | 10:751bd953fa27 | 340 | lcd.drawSprite(_bx+3,_by,11,1,(int *)Frame); //Function to draw the sprite. |
AhmedPlaymaker | 10:751bd953fa27 | 341 | lcd.drawSprite(_bx+19,_by,11,1,(int *)Frame); |
AhmedPlaymaker | 10:751bd953fa27 | 342 | lcd.drawSprite(_bx+35,_by,11,1,(int *)Frame); |
AhmedPlaymaker | 10:751bd953fa27 | 343 | lcd.drawSprite(_bx+51,_by,11,1,(int *)Frame); |
AhmedPlaymaker | 10:751bd953fa27 | 344 | lcd.drawSprite(_bx+67,_by,11,1,(int *)Frame); |
AhmedPlaymaker | 10:751bd953fa27 | 345 | lcd.drawSprite(_bx+83,_by,11,1,(int *)Frame); |
AhmedPlaymaker | 10:751bd953fa27 | 346 | i = 0; |
AhmedPlaymaker | 10:751bd953fa27 | 347 | pos = 4; |
AhmedPlaymaker | 10:751bd953fa27 | 348 | while((i<5)&&(pos<=68)) { |
AhmedPlaymaker | 10:751bd953fa27 | 349 | state = caseselect[i]; |
AhmedPlaymaker | 10:751bd953fa27 | 350 | switch(state) { |
AhmedPlaymaker | 10:751bd953fa27 | 351 | case 0: |
AhmedPlaymaker | 13:9785f2404045 | 352 | lcd.drawSprite(pos,_by,11,15,(int *)Nothing); |
AhmedPlaymaker | 13:9785f2404045 | 353 | break; |
AhmedPlaymaker | 13:9785f2404045 | 354 | case 1: |
AhmedPlaymaker | 10:751bd953fa27 | 355 | lcd.drawSprite(pos,_by,11,15,(int *)One); |
AhmedPlaymaker | 10:751bd953fa27 | 356 | break; |
AhmedPlaymaker | 13:9785f2404045 | 357 | case 2: |
AhmedPlaymaker | 10:751bd953fa27 | 358 | lcd.drawSprite(pos,_by,11,15,(int *)Two); |
AhmedPlaymaker | 10:751bd953fa27 | 359 | break; |
AhmedPlaymaker | 13:9785f2404045 | 360 | case 3: |
AhmedPlaymaker | 10:751bd953fa27 | 361 | lcd.drawSprite(pos,_by,11,15,(int *)Three); |
AhmedPlaymaker | 10:751bd953fa27 | 362 | break; |
AhmedPlaymaker | 10:751bd953fa27 | 363 | case 4: |
AhmedPlaymaker | 13:9785f2404045 | 364 | lcd.drawSprite(pos,_by,11,15,(int *)Four); |
AhmedPlaymaker | 10:751bd953fa27 | 365 | break; |
AhmedPlaymaker | 10:751bd953fa27 | 366 | case 5: |
AhmedPlaymaker | 13:9785f2404045 | 367 | lcd.drawSprite(pos,_by,11,15,(int *)Five); |
AhmedPlaymaker | 10:751bd953fa27 | 368 | break; |
AhmedPlaymaker | 10:751bd953fa27 | 369 | case 6: |
AhmedPlaymaker | 13:9785f2404045 | 370 | lcd.drawSprite(pos,_by,11,15,(int *)Six); |
AhmedPlaymaker | 10:751bd953fa27 | 371 | break; |
AhmedPlaymaker | 10:751bd953fa27 | 372 | case 7: |
AhmedPlaymaker | 13:9785f2404045 | 373 | lcd.drawSprite(pos,_by,11,15,(int *)Seven); |
AhmedPlaymaker | 10:751bd953fa27 | 374 | break; |
AhmedPlaymaker | 10:751bd953fa27 | 375 | case 8: |
AhmedPlaymaker | 13:9785f2404045 | 376 | lcd.drawSprite(pos,_by,11,15,(int *)Eight); |
AhmedPlaymaker | 10:751bd953fa27 | 377 | break; |
AhmedPlaymaker | 10:751bd953fa27 | 378 | case 9: |
AhmedPlaymaker | 13:9785f2404045 | 379 | lcd.drawSprite(pos,_by,11,15,(int *)Nine); |
AhmedPlaymaker | 10:751bd953fa27 | 380 | break; |
AhmedPlaymaker | 10:751bd953fa27 | 381 | case 10: |
AhmedPlaymaker | 13:9785f2404045 | 382 | lcd.drawSprite(pos,_by,11,15,(int *)Ten); |
AhmedPlaymaker | 10:751bd953fa27 | 383 | break; |
AhmedPlaymaker | 10:751bd953fa27 | 384 | case 11: |
AhmedPlaymaker | 13:9785f2404045 | 385 | lcd.drawSprite(pos,_by,11,15,(int *)Eleven); |
AhmedPlaymaker | 10:751bd953fa27 | 386 | break; |
AhmedPlaymaker | 10:751bd953fa27 | 387 | case 12: |
AhmedPlaymaker | 13:9785f2404045 | 388 | lcd.drawSprite(pos,_by,11,15,(int *)Twelve); |
AhmedPlaymaker | 13:9785f2404045 | 389 | break; |
AhmedPlaymaker | 13:9785f2404045 | 390 | case 13: |
AhmedPlaymaker | 10:751bd953fa27 | 391 | lcd.drawSprite(pos,_by,11,15,(int *)Thirteen); |
AhmedPlaymaker | 10:751bd953fa27 | 392 | break; |
AhmedPlaymaker | 13:9785f2404045 | 393 | case 14: |
AhmedPlaymaker | 10:751bd953fa27 | 394 | lcd.drawSprite(pos,_by,11,15,(int *)Fourteen); |
AhmedPlaymaker | 10:751bd953fa27 | 395 | break; |
AhmedPlaymaker | 13:9785f2404045 | 396 | case 15: |
AhmedPlaymaker | 10:751bd953fa27 | 397 | lcd.drawSprite(pos,_by,11,15,(int *)Fifteen); |
AhmedPlaymaker | 10:751bd953fa27 | 398 | break; |
AhmedPlaymaker | 10:751bd953fa27 | 399 | case 16: |
AhmedPlaymaker | 13:9785f2404045 | 400 | lcd.drawSprite(pos,_by,11,15,(int *)Sixteen); |
AhmedPlaymaker | 10:751bd953fa27 | 401 | break; |
AhmedPlaymaker | 10:751bd953fa27 | 402 | case 17: |
AhmedPlaymaker | 13:9785f2404045 | 403 | lcd.drawSprite(pos,_by,11,15,(int *)Seventeen); |
AhmedPlaymaker | 13:9785f2404045 | 404 | break; |
AhmedPlaymaker | 13:9785f2404045 | 405 | case 18: |
AhmedPlaymaker | 10:751bd953fa27 | 406 | lcd.drawSprite(pos,_by,11,15,(int *)Eighteen); |
AhmedPlaymaker | 10:751bd953fa27 | 407 | break; |
AhmedPlaymaker | 13:9785f2404045 | 408 | case 19: |
AhmedPlaymaker | 10:751bd953fa27 | 409 | lcd.drawSprite(pos,_by,11,15,(int *)Nineteen); |
AhmedPlaymaker | 10:751bd953fa27 | 410 | break; |
AhmedPlaymaker | 10:751bd953fa27 | 411 | default: |
AhmedPlaymaker | 10:751bd953fa27 | 412 | break; |
AhmedPlaymaker | 10:751bd953fa27 | 413 | } |
AhmedPlaymaker | 10:751bd953fa27 | 414 | i++; |
AhmedPlaymaker | 10:751bd953fa27 | 415 | pos+=16; |
AhmedPlaymaker | 10:751bd953fa27 | 416 | } |
AhmedPlaymaker | 12:1e601b176437 | 417 | return send; |
AhmedPlaymaker | 10:751bd953fa27 | 418 | } |
AhmedPlaymaker | 10:751bd953fa27 | 419 | |
AhmedPlaymaker | 10:751bd953fa27 | 420 | |
AhmedPlaymaker | 10:751bd953fa27 | 421 | |
AhmedPlaymaker | 10:751bd953fa27 | 422 | Vector2D Blocks::get_pos() //Obtains the X and Y coordinate of the target. |
AhmedPlaymaker | 10:751bd953fa27 | 423 | { |
AhmedPlaymaker | 10:751bd953fa27 | 424 | Vector2D blockpos = {_bx,_by}; |
AhmedPlaymaker | 10:751bd953fa27 | 425 | //printf("blockpos is = %f %f \n", blockpos.x, blockpos.y); |
AhmedPlaymaker | 10:751bd953fa27 | 426 | return blockpos; |
AhmedPlaymaker | 10:751bd953fa27 | 427 | } |
AhmedPlaymaker | 10:751bd953fa27 | 428 | |
AhmedPlaymaker | 12:1e601b176437 | 429 | int * Blocks::get_number() //Obtains the X and Y coordinate of the target. |
AhmedPlaymaker | 12:1e601b176437 | 430 | { |
AhmedPlaymaker | 12:1e601b176437 | 431 | return caseselect; |
AhmedPlaymaker | 12:1e601b176437 | 432 | } |
AhmedPlaymaker | 10:751bd953fa27 | 433 | |
AhmedPlaymaker | 10:751bd953fa27 | 434 | |
AhmedPlaymaker | 12:1e601b176437 | 435 | void Blocks::update(int blocknum, int srn, int send) //send sends the block number only when the y position satisfies a particular requirement |
AhmedPlaymaker | 10:751bd953fa27 | 436 | { |
AhmedPlaymaker | 10:751bd953fa27 | 437 | if(blockdrop == 0) { |
AhmedPlaymaker | 10:751bd953fa27 | 438 | _bx += _velocity.x; |
AhmedPlaymaker | 10:751bd953fa27 | 439 | _by += _velocity.y; |
AhmedPlaymaker | 10:751bd953fa27 | 440 | } |
AhmedPlaymaker | 10:751bd953fa27 | 441 | blockdrop += 1; |
AhmedPlaymaker | 10:751bd953fa27 | 442 | |
AhmedPlaymaker | 10:751bd953fa27 | 443 | if(blockdrop == 2) { //make this a variable multiple of game speed |
AhmedPlaymaker | 10:751bd953fa27 | 444 | blockdrop = 0; |
AhmedPlaymaker | 10:751bd953fa27 | 445 | } |
AhmedPlaymaker | 12:1e601b176437 | 446 | if(send) { |
AhmedPlaymaker | 12:1e601b176437 | 447 | caseselect[srn] = blocknum; |
AhmedPlaymaker | 12:1e601b176437 | 448 | } |
AhmedPlaymaker | 10:751bd953fa27 | 449 | } |
AhmedPlaymaker | 10:751bd953fa27 | 450 | |
AhmedPlaymaker | 10:751bd953fa27 | 451 | |
AhmedPlaymaker | 10:751bd953fa27 | 452 | void Blocks::set_pos(Vector2D p) |
AhmedPlaymaker | 10:751bd953fa27 | 453 | { |
AhmedPlaymaker | 10:751bd953fa27 | 454 | _bx = p.x; |
AhmedPlaymaker | 10:751bd953fa27 | 455 | _by = p.y; |
AhmedPlaymaker | 10:751bd953fa27 | 456 | } |