How do I - Physic Manipulation Basic

Get help using Construct 2

Post » Sun Dec 14, 2014 6:18 pm

Hello,
I need help applying Physic Impulses while On Collision with an Enemy. The Player should be pushed back if on collision...

As I read the Manual and several Tutorials things should be easy to apply but still doesn't work.

I attached some Files showing what I've done right now. The Physics for the enemies is applied through its Family "Enemies". I tried several different ways of setting this up but even if I set up an Impulse of (1, 10, 100, 1000) - in the End, the player won't move...

Although I implemented some forces for loot which work very well...

Would be glad if someone could help me :D

Cheas
You do not have the required permissions to view the files attached to this post.
B
5
Posts: 15
Reputation: 255

Post » Sun Dec 14, 2014 6:28 pm

When you call "Apply impulse", it applies an impulse to the object that is calling the action. The way you have it, the enemy is applying an impulse towards the player position on itself. Instead, have the player apply a negative impulse(away from the enemy) on itself toward the enemy position.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,116

Post » Sun Dec 14, 2014 7:13 pm

Thanks 4 the quick reply...

Now I changed my Event:

Player ---> On Collision with (Enemies) ---> Player apply Impulse (-10) towards (Enemies.X,Enemies.Y), (ImagePoint 2)

Nothing happens...

For testing purposes I added the same Event with an "On Key Pressed" trigger... This wont work as long as I keep moving (Platform Behavior). On floor I'll dash through the level. Not on floor - nothing happens... This seems restrictiv as I have to disable the Platform Behavior to perfom some physics. Though, disabling Platform istn't the solution for my problem:


Player ---> On Collision with (Enemies) --->Player.DisablePlatformBehavior ---> Player apply Impulse (-10) towards (Enemies.X,Enemies.Y), (ImagePoint 2)

Nothing Happens...

As I start my game in Debug Mode, Physics for the player are "sleeping" - on collision they are set "true"... I'm confused ^^


//EDIT
ImagePoint(2) = Player Mid (Both X,Y)
B
5
Posts: 15
Reputation: 255

Post » Sun Dec 14, 2014 9:05 pm

The physics behavior doesn't tend to work well with other movement behaviors, for various reasons. If you absolutely need the physics behavior, you would probably be better off implementing your own platform movement with just the physics behavior. If you're just using the physics behavior for knock-back, you'd be much better off -- and save a lot of headaches -- altering the motion vectors of the platform behavior to represent that.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,116

Post » Sun Dec 14, 2014 11:45 pm

This is exactly what I ment ... But now I know things won't work as expected. Thanks for this little wake up call (and sorry for my bad english :D)

I not really need the physics - I just thought it would be an easy to use and ready to use feature to polish my (maybe ur) gameing experience... Never worked with those Vector Motion Things - i gonna figure out which method fits best for my programming skills and feels the way I imagine.

Thanks a lot Dude :D
B
5
Posts: 15
Reputation: 255

Post » Mon Dec 15, 2014 12:47 am

So ... I tried out this Vector X Y thing. It works great for me - thanks again. Further adjustments but still fits perfectly. :D




--- Attachment ---

Often I used to look for such things - I found a lot of questions - less answers. So I attached my solution in case somebody will find it helpful.

As u will see - I took a boolean var. "Timer_OnHit" as a condition and to reset Player Platform Movement. This is not really necessary - like the "Stat_Freeze" boolean (which I use to make my enemies feel real cold...) or the "Physics_PlayerOnCollision". I use this to toggle physic simulation independently for each enemy. But - u have to reset ur Platform Movement.

-

If u keep it the way it is --> add:

Player ---> On Timer "OnHit" ---> Set Player.BooleanVar.Timer_OnHit ---> False

If u wanna remove unnecessary things ---> add:

Player ---> On Timer "OnHit" ---> Set Player.Platform ---> Stop Ignoring Input



Cheas
You do not have the required permissions to view the files attached to this post.
B
5
Posts: 15
Reputation: 255


Return to How do I....?

Who is online

Users browsing this forum: Shenkai the ssj and 27 guests