aboutsummaryrefslogtreecommitdiff
path: root/map.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2023-05-06 15:50:31 +1000
committerquou <quou@disroot.org>2023-05-06 15:50:31 +1000
commitec51d32ea0a30c138e690f637f38d83c086e02b9 (patch)
tree95570a567cc34ef5255a845391178d8649cd56a4 /map.c
parent9e28af25b8fb5c9474ccbec2bd4dff26f1871075 (diff)
Add the main mechanic.
Diffstat (limited to 'map.c')
-rw-r--r--map.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/map.c b/map.c
index d8b6e1c..b9eb0ac 100644
--- a/map.c
+++ b/map.c
@@ -7,13 +7,13 @@ void init_map(Map* map, World* world) {
const Sprite* floor, * bricks;
const Bitmap* fbmp, * bbmp;
Bitmap bitmap;
- int i, x, y;
+ int i, x, y, r;
bitmap.pixels = map->pixels;
bitmap.w = mbmp_w;
bitmap.h = mbmp_h;
- floor = get_sprite(sprite_floor_tile);
+ floor = get_sprite(sprite_floor_tile_1);
bricks = get_sprite(sprite_bricks);
fbmp = get_bitmap(floor->bitmap);
bbmp = get_bitmap(bricks->bitmap);
@@ -22,8 +22,12 @@ void init_map(Map* map, World* world) {
bitmap.pixels[i] = make_black();
}
- for (x = 1; x < map_width - 1; x++) {
- for (y = 1; y < map_height - 1; y++) {
+ for (y = 1; y < map_height - 1; y++) {
+ for (x = 1; x < map_width - 1; x++) {
+ r = rng() % 60;
+ if (r > 50) {
+ floor = get_sprite((r % 4) + sprite_floor_tile_1);
+ }
blit(
&bitmap,
fbmp,