Bullet code pls help

How would i make a ball go the direction my character is pointing?

What have you tried Daniel?

Have you done this tutorial Creating Animated Apps ? I believe it shows how.

Yes ive tried.

Explain in more detail and I might be able to give you a starting point.
Here is code to rotate an arrow (a character ) and make a ball move in the heading the arrow points. Is that what you want to do? The Canvas is set to 300 x 300 pixels.


The red ball is Ball3; Buttons 8 and 9 rotate the character (arrow). Recreate the Blocks and try the example. :slight_smile:

How would i make a sprite shoot a ball in the direction my sprite is pointing and the ball return to sprite over and over

The code Blocks in Button3 should return Ball3 to its original position. This works manually to return the ball.

To write code to get the ball to return automatically, you need to use something like one of these depending on what you want to happen.returnToSender

EdgeReached will return the Ball when it hits an Edge. CollidedWith returns the Ball when it hits another object (like one of the two other Balls provided as targets).

If the sprite does not move from its position, then the ball can reverse direction by adding 180 degrees to its heading when it touches its target.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.