drawing walls
This commit is contained in:
parent
fba8ac8e52
commit
c1001437b2
|
@ -11,6 +11,7 @@ find_package(Gint 2.1 REQUIRED)
|
|||
|
||||
set(SOURCES
|
||||
src/main.c
|
||||
src/levels.c
|
||||
# ...
|
||||
)
|
||||
# Shared assets, fx-9860G-only assets and fx-CG-50-only assets
|
||||
|
@ -23,6 +24,7 @@ set(ASSETS_fx
|
|||
)
|
||||
set(ASSETS_cg
|
||||
assets-cg/img/player.png
|
||||
assets-cg/img/wall.png
|
||||
# ...
|
||||
)
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
player.png:
|
||||
type: bopti-image
|
||||
name: img_player
|
||||
name: img_player
|
||||
|
||||
wall.png:
|
||||
type: bopti-image
|
||||
name: img_wall
|
Binary file not shown.
Before Width: | Height: | Size: 151 B After Width: | Height: | Size: 145 B |
Binary file not shown.
After Width: | Height: | Size: 127 B |
|
@ -0,0 +1,18 @@
|
|||
const int level[16][16] = {
|
||||
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
||||
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
|
||||
{1, 0, 1, 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, 0, 0, 0, 1},
|
||||
{1, 0, 0, 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, 0, 0, 0, 1},
|
||||
{1, 0, 0, 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, 0, 0, 0, 1},
|
||||
{1, 0, 0, 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, 0, 0, 0, 1},
|
||||
{1, 0, 0, 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, 0, 0, 0, 1},
|
||||
{1, 0, 0, 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, 0, 0, 0, 1},
|
||||
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
|
||||
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
|
||||
};
|
15
src/main.c
15
src/main.c
|
@ -4,6 +4,9 @@
|
|||
int main(void)
|
||||
{
|
||||
extern bopti_image_t img_player;
|
||||
extern bopti_image_t img_wall;
|
||||
|
||||
extern int level[16][16];
|
||||
|
||||
int running = 1;
|
||||
|
||||
|
@ -15,12 +18,22 @@ int main(void)
|
|||
while(running) {
|
||||
|
||||
dclear(C_BLACK);
|
||||
|
||||
// drawing the player
|
||||
dimage(player_x, player_y, &img_player);
|
||||
|
||||
// drawing the level
|
||||
for(int m = 0; m < 16; ++m){
|
||||
for(int n = 0; n < 16; ++n){
|
||||
if(level[m][n]) {
|
||||
dimage(m * 12, n * 12, &img_wall);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dupdate();
|
||||
|
||||
clearevents();
|
||||
|
||||
// trying to move the player >w<
|
||||
player_x += keydown(KEY_RIGHT) - keydown(KEY_LEFT);
|
||||
player_y += keydown(KEY_DOWN) - keydown(KEY_UP);
|
||||
|
|
Loading…
Reference in New Issue