GameMaker drive a vehicle (how do that)

chabi

Member
Hello everyone. I would like to know which code to use. I would like the player to drive a vehicle. with an animation of entering and leaving. thank you very much for helping me.
 

FrostyCat

Redemption Seeker
Like your other topic, this is yet another overly broad feature that cannot possibly have a single concrete answer.

Do some basic tutorials on how to use GML. Then when you return to this feature, DO NOT stop thinking at the "how to drive a vehicle" level. Go deeper and think about what objects and variables are involved, and how they should interact to produce the system you want.

Here is an example of objects, variables and interactions you would consider for this particular task.
  • There should be a car object and a player object.
  • The car object has a isDriving variable, which the car's Step event checks before processing any keyboard output for steering.
  • The player object should destroy itself when near a car and the "get in the car" key is pressed.
  • The car object should re-create the player when isDriving is true and the "get out of the car" key is pressed, then set isDriving back to false.
For future tasks, think and decompose your needs the same way. DO NOT just imagine a general feature and ask what the code is for it.
 

chabi

Member
I thank you very much, I understood how to act. I would have to understand gml perfectly. do you think i can do this only by reading the gml manual?
 

woods

Member
that would be a good place to start ;o)

how to move your player, how to detect collisions, how to destroy instances...
a basic working knowledge events(create, step, draw, etc)

you will need to break down your idea into the basic building blocks of what needs to happen.. and go from there
 
Top