Hi,
In this game, when the mouse is pressed, I want the ball to be shot in the shooter’s angle. However, it is being shot in a different direction. Where should I modify the code to achieve the desired behavior?
The ball is moving this direction:
Hi,
In this game, when the mouse is pressed, I want the ball to be shot in the shooter’s angle. However, it is being shot in a different direction. Where should I modify the code to achieve the desired behavior?
The ball is moving this direction:
Looks like you need to change the application point of the impulse. Right now it is applied at ball.X, ball.Y which is normally the top-left of the bounding box. If you change that to ball.CenterX(), ball.CenterY() it should work.
I modified the force applied to the center of the ball, but it still has no effect!!!
I place a link to the game.
https://gd.games/lingo1357/try1
I’m not able to open it, just gives 404. Maybe it isn’t public?
I just noticed in your events, the “left mouse button is pressed” condition is inverted. So it will fire when mouse is NOT pressed.
This works:
hmm, and you’re sure that shooter.Angle() is correct?
It looks like if you were to subtract 90 then it would work…
EDIT: Ah, I’ve run into this so many times… the sprite needs to be facing to the right, in other words 0 degrees is due East. Did you happen to draw it facing north?