Applying an Impulse from one Sprite to another

Get help using Construct 2

Post » Sat Feb 16, 2013 4:46 pm

Hi all,

I'm extremely new to Construct 2 and could do with a little help.

I'm trying to create a simple football (soccer) game with a top down view. I have the player sprite working correctly and have also succeeded in creating a ball sprite that the player can push around the screen.

So far so good.

However I would like the player to be able to kick the ball in whatever direction they are currently facing whenever I press the "s" key.

At the moment the kicking function is irregular and does not go in the direction required.

This is what I'm trying to achieve:



Here is my capx file:

http://www.mediafire.com/?vv0j93myv5qzmhz

Any help would be greatly appreciated.

Cheers.
B
4
Posts: 3
Reputation: 356

Post » Sun Feb 17, 2013 7:28 pm

Please help!

Anyone with any thoughts on this?

B
4
Posts: 3
Reputation: 356

Post » Mon Feb 18, 2013 5:42 am

I am a newbie myself.. but here's how i would try to do it.

umm use physics on both of the colliding objects and play around with density and elasticity. Also try adding something like this maybe ?

on collision -> apply physics impulse (1) at angle (object.angle) at image point (0)
B
8
S
3
G
3
Posts: 39
Reputation: 2,560

Post » Mon Feb 18, 2013 8:54 am

try this: create new image point for TeamA object at x-15, y-0, in every action of player control change image point to newly created, turn off "Prevent rotation" property at physics settings of your player, change Angular damping to 3, and then set angle of impulse to teamA.Angle-90
here's an exemple - https://www.dropbox.com/s/3qjoyv66pmegb2w/Football2.capxGT882013-02-18 09:10:18
B
21
S
4
Posts: 29
Reputation: 1,253

Post » Mon Feb 18, 2013 4:11 pm

Thanks you the replies guys, and thanks GT88 for the capx.

After much trial and error I managed to crack it myself last night.

Thanks again though. :)xop2013-02-20 14:18:26
B
4
Posts: 3
Reputation: 356


Return to How do I....?

Who is online

Users browsing this forum: Colorfish, Waltuo and 4 guests