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

Problem with the "step event"

M

Marko Kajtazi

Guest
Hi everyone, I wanted to make the weapon fixed to the player (as a different object).
The problem is that in the step event I wrote x = oPlayer.x and y = oPlayer.y, I don't know why but there is a small offset when the player moves.
Does someone know what is happening?
Thank you.
 
P

PhenomenalDev

Guest
What do you mean by offset? As in it's lagging behind? That might just be due to there not being enough steps for it to keep up in which case using a chase with a high speed is a better option.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Looks like the event order doesn't like you. This code executes before the player's Step event, so when the player's Step event does execute and you're applying movement and whatnot (or if you're using default movement, that also happens later), the player will be one step ahead.

There are multiple ways to remedy this. The most common ones are to move the affected code above to the End Step event, as that is guaranteed to execute after all other Step events, or to handle positioning of this instance in the player's Step event, after all movement has already been applied.
 
M

Marko Kajtazi

Guest
Looks like the event order doesn't like you. This code executes before the player's Step event, so when the player's Step event does execute and you're applying movement and whatnot (or if you're using default movement, that also happens later), the player will be one step ahead.

There are multiple ways to remedy this. The most common ones are to move the affected code above to the End Step event, as that is guaranteed to execute after all other Step events, or to handle positioning of this instance in the player's Step event, after all movement has already been applied.
Thank you so much.
The end step event did it.
 
Top