Homing missiles using random targets

0 favourites
  • 4 posts
From the Asset Store
Lasers, Blasts, Beams, Bullets, & Missiles! AAA quality Energy FX for your game.
  • Okay. I've seen a few different workarounds for homing behavior, but none are what I need. The player object spawns 10 homing "missiles" (objects with bullet behavior). I want each missile to target a random enemy object, but nothing I've tried works. Here is what I have:

    [CONDITIONS]

    For Each (missile)

    System Pick random instance of Enemies (family)

    [ACTIONS]

    (Bullet Behavior) Set angle of motion to object to Enemies.X, Enemies.Y

    This works when it is targeting one specific instance of an enemy, but when it's random, the missile's target changes with each tick because I suspect that the engine is picking a random enemy every tick. And because I'm not using Construct 3, I can't do the "trigger once" thing. What workaround is there for this?

    Anyway, help me out. I can't quite figure this one out.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try this

  • I think this will work! I will try it once I'm back home. As of now, I have it so that when the missiles are created they indeed pick a random enemy, but they all pick the same random enemy each time they are created. But I will try your method and see how it goes.

  • It works! Thanks! I don't know why it works, but it works!

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