GameMaker: Studio

GameMaker: Studio

View Stats:
How To Make A Object Move In One Direction
How Do I Make A Object Move To The Left Without Using That Drag And Drop Code?
< >
Showing 1-9 of 9 comments
Zappy Dec 8, 2018 @ 7:10am 
Decrease the x[docs.yoyogames.com] variable of the instance, give it a negative hspeed[docs.yoyogames.com] variable value, or give it a positive speed[docs.yoyogames.com] variable value along with a leftwards direction[docs.yoyogames.com] variable angle.

Examples:
x-=4; //Move the object 4 pixels to the left
hspeed=-4; //Give the object a horizontal speed of minus 4 pixels per step, meaning 4 pixels left per step
speed=4; //Give the object a speed of 4 pixels per step... direction=180; //...and make that speed go leftwards
Last edited by Zappy; Dec 8, 2018 @ 7:10am
Sappy Secretary Dec 8, 2018 @ 12:17pm 
Originally posted by Zappy:
Decrease the x[docs.yoyogames.com] variable of the instance, give it a negative hspeed[docs.yoyogames.com] variable value, or give it a positive speed[docs.yoyogames.com] variable value along with a leftwards direction[docs.yoyogames.com] variable angle.

Examples:
x-=4; //Move the object 4 pixels to the left
hspeed=-4; //Give the object a horizontal speed of minus 4 pixels per step, meaning 4 pixels left per step
speed=4; //Give the object a speed of 4 pixels per step... direction=180; //...and make that speed go leftwards


What Are The Events?
Zappy Dec 8, 2018 @ 2:13pm 
Originally posted by Dan:
What Are The Events?
Whichever you'd like (although keep in mind that if you use the first option that I suggested, it'll only be in effect whenever the code gets run (so once every step in any of the Step events, but not every step for collision events or such, while potentially maybe even multiple times in a single step in that case too), whereas the "speed-setting" ones will automatically be in effect once per step for every step after they're used, until you set hspeed and/or speed back to 0).
The Winter Bud Dec 8, 2018 @ 3:34pm 
Originally posted by Dan:
What Are The Events?

Events[docs.yoyogames.com]
Sappy Secretary Dec 8, 2018 @ 6:12pm 
Originally posted by Zappy:
Originally posted by Dan:
What Are The Events?
Whichever you'd like (although keep in mind that if you use the first option that I suggested, it'll only be in effect whenever the code gets run (so once every step in any of the Step events, but not every step for collision events or such, while potentially maybe even multiple times in a single step in that case too), whereas the "speed-setting" ones will automatically be in effect once per step for every step after they're used, until you set hspeed and/or speed back to 0).



Well Can You Reccomend The Event And The Code?
Zappy Dec 9, 2018 @ 12:48am 
Originally posted by Dan:
Well Can You Reccomend The Event And The Code?
No, because whichever way you do it is up to you yourself.
Sappy Secretary Dec 9, 2018 @ 3:47pm 
Originally posted by Zappy:
Originally posted by Dan:
Well Can You Reccomend The Event And The Code?
No, because whichever way you do it is up to you yourself.

But what event do i put it in and which one of those codes that you gave as a example is the best to work with.
The Winter Bud Dec 9, 2018 @ 4:01pm 
Originally posted by Dan:
But what event do i put it in and which one of those codes that you gave as a example is the best to work with.
that's the thing. There is no "Best case". It's up to you to click the links Zappy supplied to read about the different ways to move. Then you have to decide which would be best for you. Depending on which one you pick is what events you would put them in.
Sappy Secretary Dec 9, 2018 @ 4:01pm 
Originally posted by The Winter Bud:
Originally posted by Dan:
But what event do i put it in and which one of those codes that you gave as a example is the best to work with.
that's the thing. There is no "Best case". It's up to you to click the links Zappy supplied to read about the different ways to move. Then you have to decide which would be best for you. Depending on which one you pick is what events you would put them in.

okay i will see what works the best
< >
Showing 1-9 of 9 comments
Per page: 1530 50

Date Posted: Dec 8, 2018 @ 6:04am
Posts: 9