How do I create a multi-targets homing missiles launcher

0 favourites
  • 4 posts
From the Asset Store
Buildings - Isometric view - PNG transparent - multi styles, multi fonctions buildings
  • Greetings!

    I am having a bit of an issue with my shooter here, let me explain :

    • Attached to the body of my hero sprite is a gun/arm
    • This gun/arm move 360 and an aim is attached to it
    • When the right trigger of the controller is down, the gun shots bullets toward the angle of the aim.

    So far so good, but here comes the part I can t really figure out how to do

    • When the left trigger of the controller is down, the hero can lock-on targets within the range and sight of his gun/arm
    • Each time a target is acquired, a locked-on sprite is spawned on each target
    • On left trigger release, X amount (X=number of locked-on target) of homing missiles will be spawned from the player and each missile will go toward is own target.

    I managed to get a semi-working multi lock-on system, but when I release the left trigger, only one missile is spawned and goes toward the first acquired target but not the others.

    Any hint on how I could make that happen.

    Thanks in advance.

    PS : I am a huge beginner so please bare with my possible stupidity

  • That sounds like it's just an error somewhere, since it works with one. But it's hard to find an error with just a description.

    Can you make a stripped down version of just those routines to upload? (you may find the problem when you are stripping it down. Which happens a lot.)

    My off the cuff plan of how I'd do it would be to:

    1. Have the player mark each of the enemy to target.

    2. Then "for each" on the marks, so it will cycle through each.

    3. spawn a missile and give it an instance variable to hold the UID of it's target.

    4. as the missile flies have it turn 1 to 3 degrees toward the target until it hits something.

    I did missiles like that in Orbital Bomb Bounder, and I believe I had a sine affecting the angle, so they wobbled a bit in flight.

  • Thank you very much for your reply Paradox, your plan worked like a charm

    I still have an issue, since the condition is on trigger down, the game spawn an infinite number of target/sprite on targets, I ll have to find a way to limit it at 1. Maybe a variable on the target/sprite itself?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you add "Trigger once while true" to the event?

    Or maybe check to see if that one is already targeted.

    The variable may be easiest to implement.

    (Another thing mine had in that game; they were bullets, so I was able to check distance traveled, which let me time them out when failing to catch the target.)

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