Activate event on physics moving up or down?

0 favourites
  • 9 posts
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • Hi

    As the titel implies i am searching for a way to be able to connect an event to the direction movement of the physics, as in (moving up on the Y axis, or moving down on the Y axis.)

    Its for a ball in a sort of pinball game by which i need a set of options relative to when the ball is moving up the leven or down the level.

    I thought of pure angle events but as far as i understand at this point the angle only gives a (is facing towards) gesture.

    Not an (is moving down on Y or up on Y)

    In short the event i am trying to create is:

    If Sprite (Ball) moves Up on Y & mouse click button 1 then: action 1

    If Sprite (Ball) moves Down on Y & mouse click button 1 then: action 2

    Any idear would be very kind.


    <img src="smileys/smiley1.gif" border="0" align="middle" />


  • Ball.Physics.VelocityX > 0 move right

    Ball.Physics.VelocityX < 0 move left

    Ball.Physics.VelocityY > 0 move down

    Ball.Physics.VelocityY < 0 move up

  • Yann!

    Thank u.

    This opens up so much gameplay <img src="smileys/smiley1.gif" border="0" align="middle" />

  • I'm doing something similar, and wondered if there is a way to capture the actual angle of the ball?

    I was hoping to avoid arc cosines and dot products if possible. :)

    Is there an expression to get this variable?

  • JohnnySix

    When looking for something realated to physics in an event just type (spritename).physics.(then a dropdown list apears)

    Just as Yann taught us here: Ball.Physics.VelocityY gives us the Y velocity of the physics of the ball.

    What i did was use the (Compare two values) option.

    I used it as in:

    If: Ball.Physics.VelocityY greater than 300

    Then: Activate action

    The .Physics expression also has angle measurement.

    So my gues is that u could do a similar thing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • angle(0,0,Ball.Physics.VelocityX,Ball.Physics.VelocityY)

    gives you the angle of the movement

    dunno if there's an expression for that now

  • Thanx! <img src="smileys/smiley17.gif" border="0" align="middle" />

  • Savvy001 - I was just using vectors to keep it simple - am placing a target in the path the object is travelling for bug testing and potential collision issues. :)

    Yann - Thanks - just what I was looking for - there is no expression as yet, and it's a useful variable to have.

    Savvy001 again - looking forward to your pinball game. :)

  • JohnnySix


    Its going to be in the google chrome store when ready.

    And probable in the windows store later on in the future.

    So im looking forward to the end result.

    The team working on the game has just grown bigger.

    Today a music producer has joined us.

    And the game already has become quite addicting to testers.

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