First I want to say that I had read the stuff about optimisation:
scirra.com/blog/83/optimisation-dont-waste-your-time
scirra.com/manual/34/best-practices
scirra.com/manual/134/performance-tips
But I want to make my "ode as "clean" as I can.
So I have the following questions:
1. Health, lifes and Game Over screen:
Every Tick:
-Update the HUD information about Health
-Check if the Health is 0 -> restart the layout and place the Player at SavePoint
-Check if Lifes is 0 -> go to Game Over layout
or
To make a function that will be used every time the player is hit by the enemy
- Substract 1 from Health
- Update the HUD information about Health
- Check if the Health is 0 -> restart the layout and place the Player at SavePoint
- Check if Lifes is 0 -> go to Game Over layout
or
Have the previous instructions in every collision with an enemy (sounds kind of dumb but is still an option)
2. Player collide with object or the object collide with the player
Should I check if the Player has the collision with the Object/Enemy and then execute the actions ?
or
Should I check if the Object/Enemy has the collision with the Player and then execute the action ?
3. Pop-up Menu
For Pop-up Menu (like the About Menu or Pause Menu) I made a layer above all layers and made it invisible by default. When About or Pause is activated, the layer becomes visible.
Is this the recommended way or is there a better method ?