How do I - Physic Manipulation Basic

0 favourites
  • 6 posts
From the Asset Store
Construct the user interface of your game with these universal buttons.
  • 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


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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 ^^


    ImagePoint(2) = Player Mid (Both X,Y)

  • 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.

  • 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 )

    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

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

    --- 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


Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)