DeckardKane / HiVoltsProject

This is a repo for our HiVolts assignment in our AP Computer Science Class.
1 stars 1 forks source link

Collision Detection #5

Closed DeckardKane closed 10 years ago

DeckardKane commented 10 years ago

We need to be able to detect when the player character comes into contact with an electric fence or a mho, or when mhos come into contact with fences. This can be easily implemented by comparing the coordinates of said obstacles with the coordinates of the player. The assignment pages lists the movement and collision detection rules as this:

If you move to an adjacent square, one of three things can happen:

You move onto an electric fence and lose. You move onto a Mho and lose. You move onto an empty square. When you jump, you move to a random square, but you are guaranteed that you will not land on an electric fence. When you jump, it remains your turn to move. So, there are only two possibilities if you jump. You jump onto a Mho and lose. You jump onto an empty square.

DeckardKane commented 10 years ago

Update: I have successfully implemented the collision detection for fences against fences (i.e. fences can no longer spawn on top of each other). Next step is to reverse-engineer the code and use it so Mhos and the Smiley do not spawn on top of the fences or each other.

DeckardKane commented 10 years ago

Ok, spawn collision detection is fully implemented as of 10/6. What we need to do from here on out is make collision detection for the Mhos and the Smiley (so they can't move through fences or each other, etc.).

DeckardKane commented 10 years ago

10/8: When the Smiley attempts to move onto a fence, it is an immediate game over. Perhaps for clarity we can actually show the Smiley moving there and then ending the game? Mhos have no issue moving onto fences at the moment. All that needs to be done is check for isFence in the mhoMovement section.

DeckardKane commented 10 years ago

Fully implemented. The comment I previously wrote has been solved with the dialogue box that tells you what happened when you die (You moved onto an electric fence. Do you want to play again?). Issue closed.