Motion Scripts for GMS2
A downloadable asset pack
These scripts allow you to "replace" the following built-in variables in GMS2.
- hspeed -> hsp (or whatever you want)
- vspeed -> vsp (or whatever you want)
- speed -> whatever you want
- direction -> whatever you want
- motion_set() -> motion_set_custom()
- motion_add() -> motion_add_custom()
note: to make this work you need to add some code to any objects that use this.
to create event:
hsp = 0
vsp = 0
to step event (I usually put it at the end of the regular step, but you can put it in any step or draw event, or even in a script):
x += hsp
y += vsp
main why you might want to use this:
1 - if you turn on the built-in physics system, it completely disables hspeed/vspeed/speed/direction, this lets you get around that.
2 - this gives you better control over speeds, which makes things like pausing the game a lot easier.
An example of what makes this useful is if you are adding pausing to your game, to pause an objects movement all you need to do is check if the game is paused, if it is, do not run the x+=hsp and y+=vsp.
This lets you pause your game while still preserving those values, rather than needing to save them and reset them like you would with the default system.
This is provided "as is". I do not guarantee it won't cause issues with your projects and I do not promise to provide support if you have issues with it. That being said, you can ask me questions on my Discord Server, or in the comments on this page.
Marketplace link: Motion Scripts by Avis | GameMaker: Marketplace (yoyogames.com)
Donations aren't encouraged, but if you want to give me money, I'm happy to take it :)
Click download now to get access to the following files:
Leave a comment
Log in with itch.io to leave a comment.