Bouncing Objects

This forum is currently in read-only mode.
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I know this may not be new to many people. I need an object bounce off another object. Well let me explain a few things first.

    I'm making a space fairing game. I have an idea of adding gravitational aspect to the game. So, I installed the custom plugin for gravitation behavior (I found it in the forums). It's exactly what I need but the problem arose when I wanted the ship to bounce off asteroids and other ships I couldn't seem to get it right.

    First I tried adding ball behavior and it seem to completely ruin the controls. So I tried the physics behavior, that too failed.

    So I'm here to ask you guys if you know how to write an event script in CC to make the ship bounce off an asteroid or a wall? (maybe you could tell me the maths behind it too so I can try working out how to bounce two ships that collides).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If it's colliding with a wall set the ship's angle to 2*wall's angle - ship's angle.

    here's a picture explaining the maths:

    dl.dropbox.com/u/52670878/Untitled.png , where b is the wall's angle and a the ship's angle.

    If it's colliding with an asteroid, you can first get the b angle, by using the system angle between points expression.

    I'm not sure if that's the kind of "bounce" you wanted though.

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