diff options
Diffstat (limited to 'src/objects.c')
| -rw-r--r-- | src/objects.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/objects.c b/src/objects.c index 7b3b7a0..fdb0daa 100644 --- a/src/objects.c +++ b/src/objects.c @@ -48,7 +48,7 @@ void draw_objects_at_row(platform_window* window, int row) { if (!o.active) continue; box box = get_box_of_object(window, o); - renderer->render_image(img_drop, box.tl_u.x, box.tl_u.y, + renderer->render_image(o.image, box.tl_u.x, box.tl_u.y, box.br_d.x - box.tl_d.x, box.br_d.y - box.tr_u.y); /* render_quad_with_outline(box.tl_d, box.tr_d, box.bl_d, box.br_d, rgb(200,200,0)); @@ -58,7 +58,7 @@ void draw_objects_at_row(platform_window* window, int row) { } } -void create_box(float x, float y, float h) { +void create_box(float x, float y, float h, image* img) { for (int i = 0; i < max_objects; i++) { object o = objects[i]; if (o.active) continue; @@ -67,6 +67,7 @@ void create_box(float x, float y, float h) { objects[i].position = (vec2f){x, y}; objects[i].h = h; objects[i].size = (vec3f){1,1,2}; + objects[i].image = img; break; } } @@ -75,24 +76,24 @@ void create_objects() { // rechts naar links op map. for (int i = MAP_SIZE_X-1; i >= 0; i--) { - create_box(i, 0, 0); - create_box(i, MAP_SIZE_Y-1, 0); + create_box(i, 0, 0, img_obj_wall1); + create_box(i, MAP_SIZE_Y-1, 0, img_obj_wall1); } for (int i = MAP_SIZE_Y-1; i >= 0; i--) { - create_box(0, i, 0); - create_box(MAP_SIZE_X-1, i, 0); + create_box(0, i, 0, img_obj_wall1); + create_box(MAP_SIZE_X-1, i, 0, img_obj_wall1); } - create_box(16, 8, 0); - create_box(14, 8, 0); - create_box(11, 8, 0); - create_box(10, 8, 0); + create_box(16, 8, 0, img_obj_plants); + create_box(14, 8, 0, img_obj_plants); + create_box(11, 8, 0, img_obj_plants); + create_box(10, 8, 0, img_obj_plants); - create_box(15, 10, 0); - create_box(14, 10, 0); - create_box(13, 10, 0); - create_box(11, 10, 0); + create_box(15, 10, 0, img_obj_plants); + create_box(14, 10, 0, img_obj_plants); + create_box(13, 10, 0, img_obj_plants); + create_box(11, 10, 0, img_obj_plants); create_spawner((vec2){15, 5}); create_spawner((vec2){3, 8}); |
