#include #include "wall.h" #define BLOCK_WIDTH 128 #define BLOCK_HEIGHT 128 extern struct Texture wall_texture; void add_wall(float xpos, float ypos) { struct entity wall = { .type = Wall_Entity, .flags = (ENTITY_ACTIVE | ENTITY_COLLISION_ACTIVE | ENTITY_VISIBLE), .texture = wall_texture, .sprite_source_rect = (Rectangle) { .x = 0, .y = 0, .width = 128, .height = 128 }, .sprite_dest_rect = (Rectangle) { .x = xpos - BLOCK_WIDTH / 2, .y = ypos - BLOCK_HEIGHT / 2, .width = BLOCK_WIDTH, .height = BLOCK_HEIGHT }, .position = { .x = xpos, .y = ypos }, .velocity = (Vector2) {0}, .collider = (Rectangle) { .x = xpos - BLOCK_WIDTH / 2, .y = ypos - BLOCK_HEIGHT / 2, .width = BLOCK_WIDTH, .height = BLOCK_HEIGHT }, }; add_entity(&wall); }