Compare commits
No commits in common. "0cf8b424b26d69cfe27295c86df90f80b64415ea" and "267b9de2f6f284ab967b0ddc86ef56078c35a2f6" have entirely different histories.
0cf8b424b2
...
267b9de2f6
|
|
@ -1 +1 @@
|
|||
Subproject commit ea7f7453133cb3ce231db074986820cbba86c0a6
|
||||
Subproject commit 50dc383e2d027add50672b0003744b7845019780
|
||||
5
TODO.md
5
TODO.md
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
###### Features
|
||||
|
||||
- [ ] Work on entities draw order
|
||||
|
||||
- [ ] Create tilemap management and display
|
||||
- [ ] Find tilemap building format
|
||||
- [ ] Add building support for tilemaps in asset builder
|
||||
|
|
@ -24,9 +26,8 @@
|
|||
|
||||
### In progress
|
||||
|
||||
### Done
|
||||
|
||||
- [x] Work on entities draw order
|
||||
### Done
|
||||
|
||||
- [x] Make entities react to events
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
|
@ -43,7 +43,14 @@ inline int door_component_init(component_t *component)
|
|||
}
|
||||
component_data->hitbox_component_data = hitbox_component->data;
|
||||
|
||||
animation_system_data_t *animation_system_data = component_data->animation_system_data;
|
||||
|
||||
animation_system_data->nb_frames = 8;
|
||||
animation_system_data->frame_delay_ms = DOOR_DEFAULT_ANIMATION_SPEED;
|
||||
if(animation_system_create_frames_clips(animation_system_data)) return EXIT_FAILURE;
|
||||
|
||||
component_data->topic_id = 0;
|
||||
|
||||
event_bus_subscribe(&game.event_bus, component_data->topic_id, door_component_callback, component->entity);
|
||||
|
||||
component_data->state = false;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,14 @@ inline int lever_component_init(component_t *component)
|
|||
}
|
||||
component_data->animation_system_data = animation_system->data;
|
||||
|
||||
animation_system_data_t *animation_system_data = component_data->animation_system_data;
|
||||
|
||||
animation_system_data->nb_frames = 3;
|
||||
animation_system_data->frame_delay_ms = LEVER_DEFAULT_ANIMATION_SPEED;
|
||||
if(animation_system_create_frames_clips(animation_system_data)) return EXIT_FAILURE;
|
||||
|
||||
component_data->topic_id = 0;
|
||||
|
||||
event_bus_subscribe(&game.event_bus, component_data->topic_id, lever_component_callback, component->entity);
|
||||
|
||||
component_data->state = false;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,11 @@ inline int player_system_init(component_t *component)
|
|||
|
||||
system_data->state = PLAYER_MOVING;
|
||||
|
||||
animation_system_data_t *animation_system_data = system_data->animation_system_data;
|
||||
|
||||
animation_system_data->loop = true;
|
||||
animation_system_data->play = true;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,10 +32,8 @@ inline int sprite_component_init(component_t *component)
|
|||
inline int sprite_component_update(component_t *component)
|
||||
{
|
||||
sprite_component_data_t *component_data = component->data;
|
||||
transform_component_data_t *transform_component_data = component_data->transform_component_data;
|
||||
|
||||
component_data->dst_rect = transform_component_data->bounds;
|
||||
component->entity->draw_priority = transform_component_data->bounds.y + transform_component_data->bounds.h;
|
||||
component_data->dst_rect = component_data->transform_component_data->bounds;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
23
src/game.c
23
src/game.c
|
|
@ -41,13 +41,7 @@ int game_init(void)
|
|||
};
|
||||
|
||||
if(!entity_new_component(player_entity, SPRITE_COMPONENT)) return EXIT_FAILURE;
|
||||
|
||||
component = entity_new_component(player_entity, ANIMATION_SYSTEM);
|
||||
if(!component) return EXIT_FAILURE;
|
||||
|
||||
((animation_system_data_t *)component->data)->loop = true;
|
||||
((animation_system_data_t *)component->data)->play = true;
|
||||
|
||||
if(!entity_new_component(player_entity, ANIMATION_SYSTEM)) return EXIT_FAILURE;
|
||||
component = entity_new_component(player_entity, HITBOX_COMPONENT);
|
||||
if(!component) return EXIT_FAILURE;
|
||||
|
||||
|
|
@ -62,7 +56,6 @@ int game_init(void)
|
|||
};
|
||||
|
||||
if(!entity_new_component(player_entity, PHYSICS_SYSTEM)) return EXIT_FAILURE;
|
||||
|
||||
if(!entity_new_component(player_entity, PLAYER_SYSTEM)) return EXIT_FAILURE;
|
||||
|
||||
/* ======== Lever ========*/
|
||||
|
|
@ -84,12 +77,7 @@ int game_init(void)
|
|||
|
||||
if(sprite_component_set_texture(component->data, "lever_sheet")) return EXIT_FAILURE;
|
||||
|
||||
component = entity_new_component(lever_entity, ANIMATION_SYSTEM);
|
||||
if(!component) return EXIT_FAILURE;
|
||||
|
||||
((animation_system_data_t *)component->data)->nb_frames = 3;
|
||||
((animation_system_data_t *)component->data)->frame_delay_ms = LEVER_DEFAULT_ANIMATION_SPEED;
|
||||
if(animation_system_create_frames_clips(component->data)) return EXIT_FAILURE;
|
||||
if(!entity_new_component(lever_entity, ANIMATION_SYSTEM)) return EXIT_FAILURE;
|
||||
|
||||
component = entity_new_component(lever_entity, HITBOX_COMPONENT);
|
||||
if(!component) return EXIT_FAILURE;
|
||||
|
|
@ -138,12 +126,7 @@ int game_init(void)
|
|||
|
||||
if(sprite_component_set_texture(component->data, "barred_door_sheet")) return EXIT_FAILURE;
|
||||
|
||||
component = entity_new_component(door_entity, ANIMATION_SYSTEM);
|
||||
if(!component) return EXIT_FAILURE;
|
||||
|
||||
((animation_system_data_t *)component->data)->nb_frames = 8;
|
||||
((animation_system_data_t *)component->data)->frame_delay_ms = DOOR_DEFAULT_ANIMATION_SPEED;
|
||||
if(animation_system_create_frames_clips(component->data)) return EXIT_FAILURE;
|
||||
if(!entity_new_component(door_entity, ANIMATION_SYSTEM)) return EXIT_FAILURE;
|
||||
|
||||
component = entity_new_component(door_entity, HITBOX_COMPONENT);
|
||||
if(!component) return EXIT_FAILURE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue