A simple example of classic space invaders.
Resources are based on: https://github.com/leerob/Space_Invaders/
The various objects are defined with Tiled map editor.
Interesting points:
- No gravity.
- The lasers 'is sensor' property is checked. This way they don't push the collided object.
- The enemy laser 'category bits' is set to 2. The enemies 'mask bits' is set to 65533 (Bit.And(0xffff, Bit.Not(2))). This way the enemy laser doesn't hit the enemies.
- The enemies change direction when one of the enemies touches the edges.
- The ship linear damping is set to a high value. This causes the ship to slow down although there is no friction.
Example projects included in the examples pack: https://www.b4x.com/android/forum/threads/xui2d-example-pack.96454/
Last edited: