Skip to content

Commit b3a6f8f

Browse files
committed
update
1 parent b78c539 commit b3a6f8f

File tree

7 files changed

+89
-11
lines changed

7 files changed

+89
-11
lines changed

ToDo.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
1. Wie bewegt sich das Monster?
2+
Eigenschaften von Monstern? Kann Monster schießen, springen usw?
3+
-> Monster bleiben in einem Bildschirm
4+
2. Wie kann Charakter schießen? verschiedene Waffen? Wie viel Munition?
5+
-> Wenn Charakter gegen Monster läuft: Leben verlieren (Wie viele Leben?)
6+
-> Wenn Charakter von Monster getroffen wird: Leben verlieren
7+
-> Wenn Charkter Monster tötet: Belohnung?
8+
3. Wie viele Türen gibt es, wie erreicht man diese sicher? in welche Richtung läuft man?
9+
10+
Design:
11+
Umrandung, Plattformen, Charakter, Monster, Boden, Türen

master/main.c

+78-11
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,60 @@
99
#include "buttons.h"
1010
#include "display.h"
1111

12+
#define LEVEL_WIDTH 320 // 2*DISPLAY_WIDTH
13+
1214
#define ON_THE_GROUND 0
1315
#define FALLING_DOWN 7
1416

1517
void init();
1618

1719
void drawmonster(int x, int y)
20+
{
21+
page(x, y, 0b11010000);
22+
page(x+1, y, 0b11110000);
23+
page(x+2, y, 0b11111100);
24+
page(x+3, y, 0b11110111);
25+
page(x+4, y, 0b11110111);
26+
page(x+5, y, 0b00110111);
27+
page(x+6, y, 0b00000011);
28+
page(x, y+1, 0b00000111);
29+
page(x+1, y+1, 0xFF);
30+
page(x+2, y+1, 0xFF);
31+
page(x+3, y+1, 0xFF);
32+
page(x+4, y+1, 0xFF);
33+
page(x+5, y+1, 0b00001111);
34+
page(x+6, y+1, 0b00000101);
35+
page(x, y+2, 0b11010000);
36+
page(x+1, y+2, 0b11111101);
37+
page(x+2, y+2, 0b11001111);
38+
page(x+3, y+2, 0b00000011);
39+
page(x+4, y+2, 0b11010011);
40+
page(x+5, y+2, 0xFF);
41+
page(x+6, y+2, 0b11001100);
42+
}
43+
44+
45+
void drawdoor()
46+
{
47+
page(0,24, 0xFF);
48+
page(1,24, 0xFF);
49+
page(2,24, 0xFF);
50+
page(0,23, 0xFF);
51+
page(1,23, 0xFF);
52+
page(2,23, 0xFF);
53+
page(0,22, 0xFF);
54+
page(1,22, 0xFF);
55+
page(2,22, 0xFF);
56+
page(0,21, 0xFF);
57+
page(1,21, 0xFF);
58+
page(2,21, 0xFF);
59+
page(0,20, 0xFF);
60+
page(1,20, 0xFF);
61+
page(2,20, 0xFF);
62+
63+
}
64+
65+
void drawcharacter(int x, int y)
1866
{
1967
page(x, y, 0xFF);
2068
page(x+1, y, 0b11010011);
@@ -54,9 +102,12 @@ void drawfloor()
54102
}
55103
}
56104

105+
long level_seed;
106+
long level_pos = 0;
57107
long platforms;
58108
void drawplatform()
59109
{
110+
srandom(level_seed + level_pos);
60111
platforms = random();
61112
for(uint8_t pos = 0; pos < DISPLAY_WIDTH/8; ++pos) // draw random platforms at 20 possible positions
62113
{
@@ -77,15 +128,24 @@ long platform(int x, int y)
77128
else
78129
return 0;
79130
}
131+
132+
void redraw()
133+
{
134+
clear();
135+
drawfloor();
136+
drawplatform();
137+
}
80138

81139
int main(void)
82140
{
83141
init();
84-
drawfloor();
85-
drawplatform();
142+
level_seed = random();
143+
redraw();
144+
drawdoor();
145+
drawmonster(140, 22);
86146
int x = 10;
87147
int y = 22;
88-
drawmonster(x,y);
148+
drawcharacter(x,y);
89149
int jumpcounter = ON_THE_GROUND;
90150
uint32_t nextmoveevent = 0;
91151
uint32_t nextjumpevent = 0;
@@ -98,12 +158,11 @@ int main(void)
98158
{
99159
if (x + 7 == DISPLAY_WIDTH)
100160
{
101-
clear();
102-
drawfloor();
103-
drawplatform();
161+
++level_pos;
162+
redraw();
104163
x = 0;
105164
//y = 22;
106-
drawmonster(x,y);
165+
drawcharacter(x,y);
107166
}
108167
else if (!platform(x+7,y) &&!platform(x+7, y+1)&&!platform(x+7, y+2))
109168
{
@@ -115,20 +174,28 @@ int main(void)
115174
page(x, y, 0x00);
116175
page(x, y+1, 0x00);
117176
page(x, y+2, 0x00);
118-
drawmonster(++x, y);
177+
drawcharacter(++x, y);
119178
nextmoveevent = getMsTimer() + 50;
120179
}
121180
}
122181
if (B_LEFT &&!platform(x-1,y) &&!platform(x-1, y+1)&&!platform(x-1, y+2))
123182
{
183+
if (x == 0)
184+
{
185+
--level_pos;
186+
redraw();
187+
x = 153;
188+
//y = 22;
189+
drawcharacter(x,y);
190+
}
124191
if (platform(x+6,y+3) && !platform(x+5,y+3))
125192
{
126193
jumpcounter = FALLING_DOWN;
127194
}
128195
page(x+6, y, 0x00);
129196
page(x+6, y+1, 0x00);
130197
page(x+6, y+2, 0x00);
131-
drawmonster(--x, y);
198+
drawcharacter(--x, y);
132199
nextmoveevent = getMsTimer() + 50;
133200
}
134201
}
@@ -151,7 +218,7 @@ int main(void)
151218
page(x+5, y+2, 0x00);
152219
page(x+6, y+2, 0x00);
153220
y = y - 1;
154-
drawmonster(x, y);
221+
drawcharacter(x, y);
155222
++jumpcounter;
156223
}
157224
else //fallen
@@ -167,7 +234,7 @@ int main(void)
167234
page(x+5, y, 0x00);
168235
page(x+6, y, 0x00);
169236
++y;
170-
drawmonster(x, y);
237+
drawcharacter(x, y);
171238
}
172239
else //boden oder Plattform erreicht
173240
{

sprites/figure.bmp

1.21 KB
Binary file not shown.

sprites/figure2.bmp

1.22 KB
Binary file not shown.

sprites/figure3.bmp

1.21 KB
Binary file not shown.

sprites/figure4.bmp

1.21 KB
Binary file not shown.

sprites/figure5.bmp

1.21 KB
Binary file not shown.

0 commit comments

Comments
 (0)