User Tag List

Results 1 to 2 of 2

Thread: Help dealing with multiple enemies.

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export Module
    Retrobolt's Avatar
    Join Date
    Mar 2016
    Posts
    415
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Help dealing with multiple enemies.

    I have a jet that shoot a missile that follows your turns 3 times. The jet flies back and forth, turning when hitting the edge of the screen. On it's own it works fine, but when there's more than one it doesn't work right.

    The missiles turn at the same time and one of the jets fly off screen even though it shouldn't and didn't when there was only one.

    How do I make them unique.

    Here's an example-

    Thanks!
    Attached files Attached files

  2. #2
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,558
    Mentioned
    133 Post(s)
    Tagged
    0 Thread(s)
    Here's one problem.



    The above event says:

    if dragon is in line with any plane
    & if that particular (scoped) plane is not dead
    then go off somewhere else and fire of an event called "Missile Y"




    Now we come to the "Missile Y" event. This is a new event, so it starts off with no scoping. It hasn't remembered any scoping from the previous event. So, it says:

    If any plane has an Xdir of 3,
    and if the player is to the left of that plane (ie. any plane with an Xdir of 3)
    and if that plane can shoot,
    then shoot.





    This next event is also a "Missile Y" event. It also gets run, and it also has no scoping. It says this:

    If any plane has an Xdir of 4,
    and if the player is to the right of that plane (ie. any plane with an Xdir of 4)
    and if that plane can shoot,
    then shoot.

    Do you see what's happening? The first event identifies only planes that have the same Ycel as the player. But the next events don't care about Ycel - they run for any planes, so long as their Xdir and X position is right. So the "Missile Y" event will only trigger if the player is in line with at least one of the planes. But once it triggers, it no longer takes into account anyone's Ycel. So any planes that are facing the player (but not necessarily in line with it) fire:








    There are a number of solutions you could employ. You could incorporate forEach loops. Or you could turn a flag on for the scoped planes in event #7 and then test for that flag in events #10 and #11. Or you could just retest for Ycel in events #10 or 11 like this:





    I haven't looked closely at your bullets code, but it probably has similar problems requiring similar solutions. And my guess is that you'll want to use forEach loops at some stage.

Similar Threads

  1. Still having trouble dealing with multiple instances of one object
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 31st December 2013, 10:33 PM
  2. Multiple enemies with same AI rules
    By gws923 in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 18th August 2011, 12:03 AM
  3. Multiple enemies
    By Blackwolfdave in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 14th February 2011, 01:55 PM
  4. Please help with multiple enemies
    By ionside in forum Multimedia Fusion 2 - Technical Support
    Replies: 15
    Last Post: 19th November 2008, 06:01 AM
  5. Multiple platform enemies using PMO
    By fodo in forum File Archive
    Replies: 3
    Last Post: 25th June 2008, 12:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •