Bullet Angles of Motion and Actual Angles

0 favourites
  • 6 posts
From the Asset Store
3D Car Pack 1
$2.99 USD
3D models + Rendered Low-Poly Cars in isometric, top-down, and side angles.
  • I've got a bit if a conundrum.

    I would like objects when they collide with bullet behaviour to bounce off each other. I am using there current Angle of Motion plus 180 degrees.

    This works well until I introduce solid objects, once they bounce then I am think that the angle of motion is no longer the angle they are actually going at.

    Am I correct? If so is their anyway of accessing there actual angle of motion?

    Thanks

  • hmm i don't know if i understand what you want but try to use physics on the wall instead of solid or you can check this link it has the bounce with the ball and stuffs like that it may help you :

    (from stemkoski)

    http://www.scirra.com/tutorials/313/cloning-the-classics-breakout-video

  • To calculate an objects angle of motion, create 2 instance variables for the object called 'PreviousX' and PreviousY'

    at the end of your events add

    Every Tick -> Object: Set PreviousX to X

                  Object: Set PreviousY to Y

    Then to calculate the objects actual angle of motion use Angle(Object.PreviousX,Object.PreviousY,Object.X,Object.Y)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If your playing around with it remember that you can check a box on the object in the control panel "bounce off solids" yes/no.

    Set to no then you can make them bounce off whatever you like (with a seperate event) but ignoring solids.

  • To get the angle of motion of an object with the bullet behaviour you can simply use 'Object.Bullet.AngleOfMotion'.

  • Thanks for all the responses! I used this solution and it works like a dream. I went one step further and stored the angle as an instance variable too for easy access.

    To calculate an objects angle of motion, create 2 instance variables for the object called 'PreviousX' and PreviousY'

    at the end of your events add

    Every Tick -> Object: Set PreviousX to X

                  Object: Set PreviousY to Y

    Then to calculate the objects actual angle of motion use Angle(Object.PreviousX,Object.PreviousY,Object.X,Object.Y)

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

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