I have and object called Player and another one called Weapon;
Player has a point called Hand;
and I have an event like this:
No conditions > Do =Player.PointX(Hand);=Player.PointY(Hand) to the position of Weapon
So, the Weapon sticks to the Player all the time;
When the Player flips, Weapon flips too; (Don’t need to mention events.)
But the origin point of the Weapon won’t flip. (It should go to the top right corner but It stays at the top left corner.)
Is there any way to position the Weapon by a point except its origin? (Since other points flip with object.)
Is there any other solution for this problem?
Any help would be appreciated.
(English is not my native language so sorry if It was hard to understand.)
I can reposition the origin point of the Weapon to be on the center of the object;
And reposition the Hand point of the Player;
And It should work. (I didn’t test it yet.)
Any other solutions?
It’s a big problem with GD, you can add a second animation to the weapon with the graphics flipped by yourself, or another animation with the same graphics but the origin point flipped / symmetrised
There are conditions to check if the player is flipped or not, so you can use those to adjust the position of the gun. When not flipped just use the “Hand” point, but when they are flipped use the “Hand” point minus a distance. You will probably have to play around with the distance to find the correct value, but you might be able to use Player.Width() if the “Hand” point is on the edge of the sprite.
Here’ s an example where I shifted the position of the gun back by 15 pixels when flipped:
* Player is horizontally flipped > Do =Player.PointX(Hand);=Player.PointY(Hand) to the position of Weapon
Player is horizontally flipped > Do =Player.PointX(Hand)-15;=Player.PointY(Hand) to the position of Weapon