[solved] Objects are off the coordinates after creation

Ok, so I tried to do the Beginners Tutorial
and I got nearly the result I wanted to. The Problem is that the explosions, that are genereated when a bullet hits a tank or a tank hits the players turret, are a little off the position.

Here is a dropbox-link to the exportet project.
please try it and tell me if the sprites are at the right position or if you have the same problem. (The explossion should appear at the exact position of the tank)

Maybe its only a bug on my computer or I did somthing wrong.

Here is a screenshot of the Eventsheet.

I already tried to to create the Sprites at Enemy.X(Centre); Enemy.Y(Centre), but that makes it even worse (the explosion appear further away from the tank than befor).

I hope someone can help me.

(sorry for the bad grammer but I am not a native speaker. I hope I could make myself clear)

Could you provide the project file.

Maybe the sprite point for the explosion pictures are still on the top left of the image?

EDIT: You can probably just offset the position of the explosion if nothing else :smiley:

I deleted the Origin-Point of the explosion-animation. No Change. And here is the requestet project-file

Might be a bit hackey but just set the origin point of the explosions to the center of the image which in this case is 120x120.

Thank you, this seems to work.
Is there any way to change the point that GAMEDEVELEOP uses for creation?

for example: on condition:[...] | create new object "explosion" (use the point: "Centre") | at position:[...] ?

any suggestions?

I don’t think it’s a good idea because it can easily confuse the user as the origin point “is” the position of the object.

The origin point (correct me if I’m wrong) determines the position where (e.g.) you create an object, it means when you create an object at 100;100, GD will put the object the way its origin is placed in 100;100.
Sometimes is util to place the Origin point at the sprite’s center, so if you create the sprite at X;Y, the sprite will be centered at X;Y.

You are using Object.X(Centre), but you should use Object.PointX(Centre) for points, maybe GD reads this bad syntaxis as 0 (zero) :wink:

Then if you want to center the explosion on the tank:
1- Set the origin of the explosion sprite’s first image at the center.
2- Add the action “Create the object Explosion at Enemy.PointX(Centre); Enemy.PointY(Centre)”.

Lizard explanations are indeed the proper way to achieve what you want to do :slight_smile:

Thank you very much, this helps a lot and it works.
I have one last question. Is it posible to rotate a image around a certain point?
So e.g. I create a new point at an sprite at the right side of it and then I want to rotate around that custom point.

Is there a simple solution? I imagine that I have to work with an extra object or somthing like that?

again, thanks for the quick response. : )

Nice Forum!

Strange, I was sure there was action for movement around position. But as it stands now, you’ll need dummy object. Then use All Objects->Movement->Add force so object moves around another.

Or change the Center point: GD rotates a sprite over its Center point. GD warns you about modifying this point, so I can’t recommend it, but I change the Center very often :slight_smile: