Is it possible to set the angle of motion of a bullet to a non-linear direction?

0 favourites
  • 6 posts
From the Asset Store
Character Sprite Pack: Walk 4 Directions made in illustrator
  • I'm creating a quiz game and when the user answers correctly, 3 small coins are spawned and I've used the bullet behaviour to move these and collide with the score which then adds 10 points. So far, all the bullets move in a linear direction (230 degrees) but I think it would look better if they were slightly different.

    E.g. Coin 1 is spawned and the angle of motion is 180 degrees but then after 0.3 secs it changes to 90 degrees. Coins 2 and 3 would then be slightly different to this.

    I also need the angle change to be smooth and not sudden so the coins don't jolt.

    Can this be done in C3?

    Tagged:

  • have you considered Tween as opposed to bullet behavior? I'm still a beginner as well. It's just that I was using Bullet and MoveTo for everything, then somebody introduced me to Tween and it changed my world.

    It's an amazing way to smoothly move stuff around.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can tween the angle of motion of the bullet behavior as well.

    Alternatively, give each of them a random angle to start and lerp the angle towards the target angle every tick.

  • Cheers guys. How would I go about tweening the angle of motion?

    I've never used lerp before, can you give an example equation and explain how it works?

  • Here's an example for lerp. dropbox.com/s/wlan9439hmvz584/lerpangletargetexample.c3p

    Tween didn't work out very well, since it is better for a fixed start and end value. It doesn't take into account the change in target angle as the object moves.

  • Thanks so much for the example! I would have really struggled to put together that equation myself - really appreciate it!

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