• 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!

How to make player sprite move? (GM2)

S

Stormmon

Guest
I have the sprite, but when I run the game I can't move it around. I've seen people use a code page, but for the life of me I can't find it.
 
D

dannyjenn

Guest
You need to use an object rather than a sprite. In the object make an event. If you're in GML mode then the code page will automatically come up, but if you're in Drag and Drop mode then you'll need to use the "Execute a piece of code" action (under "Common").
 

Yal

šŸ§ *penguin noises*
GMC Elder
Yeah, in GM a sprite is a graphical resource - objects are needed for functionality, and objects can execute actions, execute code, and call scripts as a way to structure up your code (since scripts are named and can be reused without you having to copypaste code everywhere etc). Objects do stuff in rooms, the game always is in exactly one room and leaving a room will reset it to its initial state. Objects can have a sprite assigned to them, making them use that to represent themselves visually, use it as a collision mask, and so on. Several objects can use the same sprite without conflict, and an object can change its sprite at any time using code, so don't see sprites as something linked firmly to objects... sprites are basically a resource objects can use, just like code is.
 
Top