chop tree

If I have a level with tree models, and I want the player to have a certain model in their hand (axe) that when you click on the tree model it proceeds to cut it down. This would take lets say 4 tries then the tree falls on the ground. How would I approach this in the game engine? Im familiar a bit with logic bricks but not so much with python. thanks

Set up a logic brick system like this
Collision(axe property) set on TAP–>and controller --> property actuator set to add 1 to property “chops”
Property sensor for “chops” = 4 --> and --> play animation (of tree falling over)
Make a property for the tree named “chops”.
Make property for axe called “axe”.
Now when you click, and the character swings his axe and it hits the tree 4 times, the tree will play the falling over animation.
Of course your character has to have a swing animation set up.

Sorry, it posted twice for some reason.

Cool, thanks. What if I wanna go the cheap route and just show a tree laying on the ground when the chop reaches 4? So tree is standing while he’s chopping then when 4 is reached, standing tree model dissapears and fallen tree model is laying at his feet?

You can replace the tree at the moment he falls.

  1. he will not be detectable for chopping anymore
  2. you can use physics to make him fall if you like