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.
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)
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)
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)”.
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?
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