Need (HELP)

Y

yarala

Guest

There is link

in video my gun is slower than me how i can fix it to stick on character
and i need code about ( if i look right and shoot at left character change side and look at shoot side)
Sorry for my english
Thanks!
 

TsukaYuriko

☄️
Forum Staff
Moderator
Change the gun's position in the End Step event.

This happens when you execute code which relies on another object's Step event (or movement) in the Step event. This results in a 50/50 success chance, depending on which Step event executes first.
 
D

dannyjenn

Guest
An alternative solution would be to use the player's step event to reposition the gun. (Put the player's movement code first... then put the gun's movement code inside a with() statement after that)
 

TsukaYuriko

☄️
Forum Staff
Moderator
An alternative solution would be to use the player's step event to reposition the gun. (Put the player's movement code first... then put the gun's movement code inside a with() statement after that)
Care should be taken with this approach. While it works just fine when custom movement code which directly changes an instance's x/y is used, it will lead to the same effect as the one described in the opening post if the default movement (hspeed, vspeed, direction, speed) is used, as its effects are applied between Step and End Step. Using the End Step event in the following object is fail-safe unless the object being followed is changing its position in the End Step event as well (but at that point nothing aside from centrally controlling the positioning will work reliably, anyway).
 
Top