# Angles and impulses.

Get help using Construct 2

### » Sat Aug 24, 2013 11:42 am

I'd like to start by saying that I've learned so much the past few months from this forum! I hope to know enough soon to start contributing/giving back to this fine community! But that's a long ways away me thinks, as there is still much for me to learn.

Like angles.

Disclaimer: I never took maths in high-school, or beyond. I've only just started to come to grips with the most basic calculations. Coding in python and working with Construct 2 is really a fine way to learn how to do math at a later age. So please consider this in your answer: I'm a dumbass.

The question:

For the sake of explaining what I'm trying to do, please imagine the adept's "pull" skill from the "Mass Effect" series. Then imagine a 2D side-scroller.

A projectile is launched at an angle, from the player towards the enemy/object. Upon collision, the enemy/object is then propelled towards the direction the projectile just came from.

I used to solve it like this:

When (push) collides with (object) Apply impulse (value) towards angle (player.x, player.y).

Simple enough eh? Its a rather limited approach though:

I'd like to be able to control the arc of the projectile (any clever thoughts on that will also be much appreciated) so then the player's position is no longer the origin of the projectile.

How would you solve this?
B
7
S
2
Posts: 51
Reputation: 627

### » Sat Aug 24, 2013 11:51 am

In construct you have many choices.

you could use the projectile's angle - projectile.angle
or if the projectile is a bullet - projectile.bullet.AngleOfMotion
you could use the angle between object and projectile - angle(object.x,object.y,projectile.x,projectile.y)

And there are more options depending on behaviours used.
Also you could mess around with sin and cos, but I have never needed those myself. LittleStain2013-08-24 11:52:07
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Sat Aug 24, 2013 11:54 am

To control the arc I would choose to use custom behaviour.
You could set it so that on every step the y-speed decreases.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775