Here’s my little test tree cutting game:
- Pick up Axe - axeOwned = true;
- Pick up Saw - axeOwned = true;
- Then some weapon switch code to select saw or axe.
- Tree code
- grown = true;
- OnMouseEnter - IF weaponHeld == axe, apply “outline highlight” shader
- OnMouseDown - IF weaponHeld == axe, cut down tree, woodAmount++ (static variable), grown = false, Destroy
- Saw Bench code
- OnMouseEnter - IF weaponHeld == saw woodAmount > 4, apply “outline highlight” shader
- OnMouseDown - IF weaponHeld == saw woodAmount > 4, plankAmount++
Is this a decent way to do this?
One issue I’m having is the tree. Right now it’s a parent cylinder for the trunk, with child spheres as the leaves. This script is only attached to the parent trunk, so only that highlights OnMouseOver. I want the entire tree to highlight OnMouseOver. I could import a single tree model, but I don’t want to right now.
Also, what’s the best way to display a “stump” after the tree is cut?
The tree should also needs to grow back after a while, so should I “hide” it instead of using “Destroy”?
Download - Here is the GameMaker version I made - no install required. Click the axe/saw, and then 1/2 switches between them.