[SOLVED] Fix object behind another

I’ve a car that change angle when change direction.
If i put a fire behind the car, and when the car rotate, the fire change of the same angle of the car.
The problem is than when the car rotate, the fire doesn’t stay behind the car in the correct position.

Events are :
change angle of fire1 : set to Car1.Angle()
Change the position of fire1 : set to Car1.PointX("fire_position") (x axis), set to Car1.PointY("fire_position") (y axis)

I can’t understand how do…

thank you very much!!!

when you change the position of an object are you use its origin point. when you rotate an object you are use its center point by default. check these for both objects. if you find everything okay (and yet not good), try the object linking feature (see Wiki).

It’d be easier to rotate the fire around the car object. Try something along the lines of:

Put fire1 around Car1 with an angle of Car1.Angle() + 180 degrees and 30 pixels distance

You may also need an additional action to rotate the fire itself, so it faces the right direction. Or modify your fire sprite.

Thank you MrMen, but this is not the solution. I tried, and you can see the result here.

example1

Thank you Gyuszko. I’ve changed the fire point, Center point. Now all these are = Origin point.
I linked the Car1 to Fire1… but the problem doesn’t change. :cry:

Here’s one way which works where I tied the rotation to the key presses

(There is probably a better way to do it but it works)

like Gyuszko said : "

when you change the position of an object are you use its origin point. when you rotate an object you are use its center point by default.

So, for the object car1, set “center point” = “origin point”, then i create “fire_point” to the back of the car.
In the object “fire”, set “center point” = “origin point”.

Change the position of fire1 : set to Car1.PointX("fire_point"),set to Car1.PointY("fire_point")

Thanks to all!!!

1 Like

@grappale, you did not try my solution. You butchered my suggestion.

I said to ROTATE the FLAME AROUND the CAR.
You rotated the car and the flame individually.

There is a big difference.

Here is a screen shot of the code :

and here is the result:

RotateAroundObject

1 Like