• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM How can I make so that I can cut trees in my 3D Survival Game

S

Stefqnutz

Guest
Sorry but I don't understand what you are saying. Im pretty new to 3D in gamemaker and im trying to learn
 

FrostyCat

Redemption Seeker
You're just plain new to programming in general if "cut trees in my 3D survival game" is the limit of your depth of thinking. Please, put your dream project down and actually get some basic skills off simpler projects instead. At this rate you aren't learning, you're just offloading every little bit onto strangers.

If you're actually learning, then you should just see that this is a matter of turning a tree in front of the player into a stump, playing an axe animation and then perhaps incrementing a variable. You can and should handle this yourself, as every project is unique and exact universal solutions don't exist.
 
I'd say begin with the basics, as your question implies you're not thinking of specifics.
What kind of trees? How should they fall? What causes them to fall? Which object interacts with which? What are the variables necessary for such a thing?
How can this be done in a minimal amount of code (If you have like 1000 trees, and each runs a 1000 lines of code, oh boy you will see some lag).
What should happen after a tree is hit, and the game gets paused during?

For even a simple thing like cutting a tree, there are a ton of questions you should ask. But you should always start simple. Don't worry about the end result. Worry about "the next little step towards the goal". Just make that little step work. One at a time. Then go back and optimise.

As for me, and I've only been coding for 9 months now:
In a 2D game at least, but also in a 3D game, I'd give the tree a variable called "TreeHit = false" in its create event.
Then, in the (I suppose) Player object, I'd make the player do a certain action with animation (say Player_Action = "Axe"), that checks for a collision with a tree. If such a collision is found, I'd give that tree the value of TreeHit = true through a "with" statement. Then, in the tree's code, you could do whatever when TreeHit = true.
In 2D games, there are functions like draw_sprite_general that include a sprite's ROTATION, so you could set it up that the sprite "swivels" a bit when the tree is hit, or even fall completely when its HP drops to 0.
Keep in mind, collision checks require some coordinate thinking as they focus on the collision mask of the object (Again, i'm doing 2D, not sure about 3D).
The game I'm making requires the player to gather wood, and I've actually set up spawning trees of multiple kinds, that can be cut with a nice swivel animation, and have depth to them without lag (meaning player can move both in front and behind them at pixel-specific coordinates). Naturally I've done a hell of a lot more after 9 months, the trees are just one of the many things. So just keep at it!

but unless you rephrase the question, my best answer is to start simple. You can learn a lot in even a few months, if you are determined enough. Keep at it, give it your every free second of your free time, and you'll learn quickly.
 
Top