Sunday 8 April 2012

Tutorial 3


Movie: 

Mana and the Fire Hydrants
 

This is Tutorial 3 which is the Fire Hydrant and Mana. When key S is type Mana walk towards the Fire Hydrant but when Mana is equal and less than 1 meter of Fire Hydrant, Mana will turn away and move to the other Fire Hydrant.  Mana wont bang to the Fire Hydrant. 

Processing Doing:

In this tutorial, the objective was to make sure Objects cannot pass through one another.

  • First we create new methods to enable Mana to turn left by pressing Z, right using X or walk forward using S.
  • Under the Method to walk forward [S Key] , we use the 'If Else' function and inserting '[Either [Mana distance to Fire Hydrant1 <= 1] or [Mana distance to Fire Hydrant2 <= 1], or both].
  • If true, Mana turns back and walks forward 1 step.
  • If false, Mana walks forward one step.
  • This way, when Mana is close to the the fire hydrant, she turns around and moves forward when S key is pressed..
  • Thus, she will not pass through any of the fire hydrants. 

No comments:

Post a Comment