During this method, we will add hit points, let the planes explode, and add scores.
1. Check whether the collision group of the first object is equal to
g.grpShot
.Method OnObjectCollision:Int(obj:ftObject, obj2:ftObject) If obj.GetColGroup()=g.grpShot Then
2. Play the sound effect of a plane being hit.
g.sndHit.Play()
3. Check if the second object is the player plane.
If obj2 = g.player Then
4. Add
1
to the player'shits
field.g.hits += 1
5. Check if it took five or more hits.
If g.hits >= 5 Then
6. Add
1
to the computerscore
field.g.scoreC += 1
7. Play the explosion sound effect.
g.sndExplo.Play()
8. Spawn an explosion of
15
particles at the object's position.g.SpawnExplosion(obj.GetPosX(), obj.GetPosY(),15)
9. Remove the second object (the player) and re-spawn the player. After that, close the last two IF checks.
obj2.Remove() g.CreatePlayer() Endif Endif
10. Now, check if the second object is equal to
g.enemy
.If obj2 = g.enemy Then
11...