(Solved) How to move X and Y position of sprite in Game Maker Studio 2?

Dan92

Member
In the tutorial it told me to add the sprite to the object and then add an event called step. The GML code i used in the step event is x = x + 4; to move to the right but when i run the game it does not move at all. I'm not sure what you mean by drag and instance but i created an object and added the sprite to it. This is the screenshot.Movement.png
 
Last edited:

curato

Member
can you post all the code of the events? Also did you drag and instance of the object into the room? What you are saying sounds like it should work.
 

Dan92

Member
Did you put the object in the room? You'd be surprised how often that trips me up.
wow i put the sprite in the room instead of the object that contains the sprite lol thank you! and how do i remove the sprite from the room? lol
 
Yea I think I see the issue. You're missing a "Layers" window. That one looks like this:
1612562826938.png
Where it says "Instances" and "Background". That's the window you need to get back. To do that, go up to the top menu option called "Room" and click on "Layer View". Once you see that, click on the "Instances" layer. With that selected - you should be able to left click on the objects and then delete them with the delete key on the keyboard.
 

Dan92

Member
Yea I think I see the issue. You're missing a "Layers" window. That one looks like this:
View attachment 37792
Where it says "Instances" and "Background". That's the window you need to get back. To do that, go up to the top menu option called "Room" and click on "Layer View". Once you see that, click on the "Instances" layer. With that selected - you should be able to left click on the objects and then delete them with the delete key on the keyboard.
Thank you!
 

ParodyKnaveBob

The Laughing Rogue
Your solution is what curato said in the first place:

Also did you drag and instance of the object into the room?
You see, you don't drag objects into the room.

Analogy: In a physical building, you don't go into a room and sit on a blueprint. You sit on a chair. Objects are blueprints. A blueprint for a chair is used to make lots of instances of chairs.

You drag an instance into a room; curato asked (properly) if you added an instance to the room. To everyone else reading, please don't confuse matters and call instances "objects," which they are not.

I hope this helps! $¦^ J
 

Liquid

Member
You see, you don't drag objects into the room.
actually, you drag the object.... i click on it and drag it into the room...and when it enters the room an instance of its class is created :p
lol so actually you drag the object... but surely your point is right through! Sorry i dont want confuse but i think this is funny :p

ObjectCLASS vs ObjectINSTANCE

The Class is the description with all code and variables all definitions... but it is abstract like an idea, algorithm.... and the instance is a copy of the idea with actual data that can be changed on the run ... data is modified while program is running. multiple copies with different variable content exists at a time all made after the "blueprint" of a single objectCLASS.
 

Dan92

Member
Thanks for the help you guys, I do have an instance layer in the room editor, then I added an object to that instance layer and it worked for me.
 
Top