# Kick Ball

Get help using Construct 2

### » Wed Feb 12, 2014 3:12 pm

I wanted to throw a ball with impulse the selected direction. try to do but fail
Anyone know how to do?
B
11
S
5
G
1
Posts: 410
Reputation: 2,802

### » Wed Feb 12, 2014 6:33 pm

B
11
S
5
G
1
Posts: 410
Reputation: 2,802

### » Wed Feb 12, 2014 6:47 pm

Apply physics component to the ball, then on mouse click choose "Apply impulse towards position:
Impulse: whatever value you want, you can use distance(ball.x,ball.y,mouse.x,mouse.y) for example
PositionX: mouse.x
PositionY: mouse.y
image point: 0
B
11
S
4
G
1
Posts: 272
Reputation: 1,643

### » Thu Feb 13, 2014 10:19 am

I have several problems:
- When you click-on the ball shoots out in any direction, I would like to create an arrow to indicate the direction
- With the ball falls physical gravity, I want this stopped.

B
11
S
5
G
1
Posts: 410
Reputation: 2,802

### » Thu Feb 13, 2014 10:24 am

If you are launching the ball from a tube or similar, it could be that the impulse force is bouncing off of the object it's launching from. In which case it would be an idea to move it a few pixels away so it has a 'clean' launch area before the impulse force. This shouldn't be too obvious due to the quick frame refresh.

With regards to the arrow - that's a different question to what you originally posted, it's worth a separate topic.

If you don't want to ball to fall, then set gravity to 0. Physics works without gravity as well i.e. as in space.
B
6
S
2
Posts: 92
Reputation: 688

### » Thu Feb 13, 2014 10:54 am

This might give you a starting point
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,902

### » Thu Feb 13, 2014 11:05 am

The arrow is in the picture I posted, so also wanted tips or tutorial
B
11
S
5
G
1
Posts: 410
Reputation: 2,802

### » Thu Feb 13, 2014 11:31 am

@RamPackWobble When launched the ball does not stop at all and tell me you would know how to make a directional arrow

B
11
S
5
G
1
Posts: 410
Reputation: 2,802

### » Thu Feb 13, 2014 1:00 pm

create the image of the arrow, set it's angle to:

angle(sprite.x,sprite.y,mouse.x,mouse.y)+180

Arrow done!

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

### » Thu Feb 13, 2014 1:26 pm

Not stopping ?

Look at the balls density, friction and dampening setting to alter how quickly it will stop.

(I have altered these setting the original capx and re-uploaded it. Also added a second ball to hit)

demo
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,902

Next