Tuto tiny-ecs beatemup Part 12 You Win
From GiderosMobile
The Systems 3
A couple more systems to add and we are done. We also add the Debug Systems to help us visualize all the boxes (hitbox, hurtbox, collsion box, ...).
sDestructibleObjects.lua
Please create a file "sDestructibleObjects.lua" in the "_S" folder and the code:
The System removes a breakable object when destroyed and spawn a collectible in the onRemove function:
- it runs every frame
- it affects only entities with an isdestructibleobject id
- on hurt adds an hit fx
- on destroyed adds particles
- onRemove spawns a collectible
sCollectible.lua
"sCollectible.lua" in the "_S" folder. The code:
This System spawns a collectible:
- runs once on init and every game loop (process)
- there are two kind of collectibles: health and jump attacks (updated in the HUD)
There are quite a bit of commented code you can delete as this Entity is immediately removed
sSpritesSorting.lua.lua
"sSpritesSorting.lua.lua" in the "_S" folder. The code:
Finally this System sorts the actors on the y axis:
- runs once on init and every game loop (process)
- there is a distinction between the actor being on floor and jumping
Next?
Congratulations! We have finished our game.
Let's add the final scene: YOU WIN!
Prev.: Tuto tiny-ecs beatemup Part 11 Systems 3
Next: Tuto tiny-ecs beatemup Part 13 XXX