Game Maker 8 Drag and Drop P-Angle and Radius, object follow

Zollock

Member
Hi, I remember that you could make an object stick to another following it with those variables, also spinning around it only changing some values in the step event. I remember all you had to do was establishing 2 variables in the create event and then two actions in the step event.
Please help
 

woods

Member
in the following object step event-
x=obj_whatever.x
y=obj_whatever.y




obj_leg.x =obj_body.x
obj_leg.y =obj_body.y+16

something like this would have the leg object attached to the body object but 16pixels lower
 

kburkhart84

Firehammer Games
For the object that does the following, you have to make sure that it gets set after the object that it is following. This means that you would want the parent object to update itself it its step event, and then in the same code update the child, or have the child update itself(based on the parent) in the End Step event. Otherwise, the positioning will lag behind a step, as there is no guarantee that any object will have step happen before another object, but it IS guaranteed that the End Step will happen after the Step event.
 

Zollock

Member
in the following object step event-
x=obj_whatever.x
y=obj_whatever.y




obj_leg.x =obj_body.x
obj_leg.y =obj_body.y+16

something like this would have the leg object attached to the body object but 16pixels lower
Deal is that it needs to follow it in the same speed, but my object doesn't have a speed value, it just jumps 2 pixels in each direction every step
 

kburkhart84

Firehammer Games
I has nothing to do with the object speed of whatever it is following...it simply sets the x/y based on whatever the object it is following has. If the followed instance goes back and forth, so will the following one. If it teleports, so will the following one. If it moves with some constant speed, so will the following one. The one that does the following doesn't check the speed, or movement code of the object it follows. It only sets the x/y position of itself based on the other object instance that it is following. That's why it has to be done after the followed object does its Step event, so that it accurately reflects whatever movement code the object did.

EDIT*********
If you look for tutorials about having bullets shoot from the tip of a rotating gun, you will find exactly what you need here.
 

woods

Member
main object step event

movement code{ }
with obj_follower
{
x=obj_whatever.x
y=obj_whatever.y
}

or

main object step event
movement code

follower object end step event
x = main object.x
y = main object.y



===
would be easier to see your code ;o)
 

Zollock

Member
main object step event

movement code{ }
with obj_follower
{
x=obj_whatever.x
y=obj_whatever.y
}

or

main object step event
movement code

follower object end step event
x = main object.x
y = main object.y



===
would be easier to see your code ;o)
uuuuuuh.... Where do I write that? in set variable?
 
Top