From ec51d32ea0a30c138e690f637f38d83c086e02b9 Mon Sep 17 00:00:00 2001 From: quou Date: Sat, 6 May 2023 15:50:31 +1000 Subject: Add the main mechanic. --- map.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'map.c') 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, -- cgit v1.2.3-54-g00ecf