Game Maker 1.4 Current Player Location

R

Robotnik91

Guest
Hiya!

I am using Game Maker 1.4. I'm trying to create a homemade sprite transition that will play between my rooms. However, in order to do so, I need to set the sprite to be drawn at the location of my player (obj_player). The view of the room is smaller than the room itself, so I cannot draw it over the entire room without majorly skewing my sprite.

I do not know how to draw a stretched sprite at a specific location of another object (my player).

Here is the code I have so far; I am trying to figure out what to put in the bold section.


///Place in Draw Event

draw_sprite_stretched (spr_transition_after, image_index, the x position, the y position, view_wview, view_hview);
 

kburkhart84

Firehammer Games
You need to get a reference to the player object. If you literally know for sure you only have one of that object, you can reference the instance of that object by the name of the object like obj_player.x, obj_player.y. And that access would work even in other objects. Just remember that if you have multiple instances of that object, you will need to do things differently in some cases depending on what you are doing.
 
R

Robotnik91

Guest
Thank you so much! obj_player.x is exactly what I needed!
 
Top