Gravity-Bound Projectiles that Trace Position

0 favourites
  • 4 posts
From the Asset Store
Vector illustration of a UFO with an alien in three different positions.
  • In some games, such as Mega Man (again), there are some enemies that have the ability to fire shots that somehow manage to both get your X position and yet at the same time throw shots in an arc.

    https://youtu.be/aZMXvt1kppc?t=1m36s

    Is there any way to possibly emulate this in Construct 2 (either using behaviors or purely through events)?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • maybe every tick create a track sprite at object.x and object.y?

  • What gumshoe said pretty much...

    Every tick; (or every X seconds for a slower angle correction)

    • Set angle of projectile.sprite towards player.X,player.Y

    On "enemy shoot"

    • create projectile.sprite at enemy.X,enemy.Y
    • set angle of projectile.sprite to (something not already aimed towards the player - maybe straight up?)

    Note, the faster your projectile and the slower it angles itself will all affect the arcing motion.

    ~Sol

  • there have been other topics for that. The equations for the motion of a falling projectile is this:

    y1=y0+vy*t+0.5*gravity*t^2

    x1=X0+vx*t

    X0,y0 is the start position

    X1,y1 is the end position

    Vx,Vy is the velocity

    t is time

    If you pick a time and then solve those equations for vx and vy that would do it.

    I think it's referred to elsewhere as predictive aiming. You could also Google kinematics for more tutorials about the equations used.

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