In my game one, when one ship collides with a player ship, the player loses one hp and the enemy ship resets position randomly. This works perfectly when the enemy ship hits the left side of the ship, but when it hits the right side of the playership, nothing happens. What do i need to change?
Here the code snippet for collisions:
Here the code snippet for collisions:
If player\x >= computer\x And player\x <= computer\x + StringWidth(computer\ship) If player\y >= computer\y And player\y <= computer\y + 10 Then computer\x = Rand(1,640) computer\y = Rand(1,480) player\hitpoints = player\hitpoints - 1 If player\hitpoints <= 0 Then DeathScreen() End If End If End If If computer\x >= player\x And computer\x <= player\x + StringWidth(player\ship) If computer\y >= player\y And computer\y <= player\y + 10 Then computer\x = Rand(1,640) computer\y = Rand(1,480) player\hitpoints = player\hitpoints - 1 If player\hitpoints <= 0 Then DeathScreen() End If End If End If