I am trying to have a bullet that is moving toward an object, change direction and move away from the object while pressing a key down.

Is there a way to do the opposite of "set angle toward position" and move something away from a specific object?

9 posts
• Page **1** of **1**

In C2 angles are in degrees, basically,an angle + or - 180° is the opposite angle due to the cyclic nature of angles(adding 360°, aka a full rotation, is the same as adding 0, (360+0)/2=180 so you have half a complete turn, thus the opposite direction)

And angle(x1, y1, x2, y2) return the angle between the two points

And angle(x1, y1, x2, y2) return the angle between the two points

Game design is all about decomposing the core of your game so it becomes simple instructions.

**Posts:**2,122**Reputation:**17,123

B

53
S

22
G

18
this page of the manual, in the Math paragraph, is quite useful in some cases (since it shows the predefined math functions you can use in C2 directly): https://www.scirra.com/manual/126/system-expressions

Game design is all about decomposing the core of your game so it becomes simple instructions.

**Posts:**2,122**Reputation:**17,123

B

53
S

22
G

18
Aphrodite wrote:this page of the manual, in the Math paragraph, is quite useful in some cases (since it shows the predefined math functions you can use in C2 directly): https://www.scirra.com/manual/126/system-expressions

That's a fantastic reference, thanks!

**Posts:**5**Reputation:**354

B

4
S

1
9 posts
• Page **1** of **1**

## Who is online |

Users browsing this forum: Cubeeo and 25 guests |