User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: Optimal way for making enemies respawn

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5+ DLC (Steam)
    vSv's Avatar
    Join Date
    Aug 2010
    Location
    Sweden
    Posts
    118
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)

    Question Optimal way for making enemies respawn

    Hi everyone!

    As for now, my enemies are created from invisible spawners. After the enemy is created, the spawner is destroyed. This means that an enemy can only be spawned once in a level.


    My thought about creating respawning enemies goes like this:
    Spread a unique ID to the spawner when it's created. When the player is within a set distance to the spawner, the spawner creates the enemy and then transfers it's ID to the spawned enemy.
    However, what I don't really know how to do is the next step, which is limiting the spawner from creating an enemy if the spawners enemy already exists and has the same ID as the spawner.

    Does anyone know how to solve this? Any best practice for this perhaps?

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export Module
    Janette5's Avatar
    Join Date
    Dec 2014
    Location
    Western Cape, SA
    Posts
    1,159
    Mentioned
    199 Post(s)
    Tagged
    0 Thread(s)
    I've attached an example - see if it helps you.

    I've left the spawners visible in this example, just so that you can see that it works.
    Attached files Attached files

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLC
    PlayDay's Avatar
    Join Date
    Aug 2018
    Posts
    36
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Jeanette beat me. I made an example too.
    Jeanette's seems to have only one enemy alive at a time.
    Mine has one per spawner at a time. I use for-each loops to set the correct flags.

    I am learning fusion. I don't know that I've done it the best way. I made this so I could learn myself. I hope it helps someone as much as it helped me.
    Attached files Attached files

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5+ DLC (Steam)
    vSv's Avatar
    Join Date
    Aug 2010
    Location
    Sweden
    Posts
    118
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Thank you both for your examples! Really great, I have to dig into those more later!

    One thing I wonder, I saw you both used "Seet X to Fixed("Y")". What exactly is it that "Fixed" does? I have actually never used it before.

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLC
    PlayDay's Avatar
    Join Date
    Aug 2018
    Posts
    36
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    fixed is an ID set by the system. It's unique to each object. I've seen that sometimes people have problems with spread; especially when the number of objects changes during game play.

  6. #6
    Clicker Fusion 2.5 (Steam)Fusion 2.5+ DLC (Steam)
    vSv's Avatar
    Join Date
    Aug 2010
    Location
    Sweden
    Posts
    118
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the answer!

    That seems like a pretty big deal for things like this. Would have been great to know about that one years ago!

  7. #7
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export Module
    Janette5's Avatar
    Join Date
    Dec 2014
    Location
    Western Cape, SA
    Posts
    1,159
    Mentioned
    199 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by PlayDay View Post
    Jeanette beat me. I made an example too.
    Jeanette's seems to have only one enemy alive at a time.
    Mine has one per spawner at a time. I use for-each loops to set the correct flags.

    I am learning fusion. I don't know that I've done it the best way. I made this so I could learn myself. I hope it helps someone as much as it helped me.
    No, I just killed the enemies off after 1.5 seconds - so they didn't stay alive for long, makes it easier to test. There'd be one per spawner alive, if they didn't die so quickly.

  8. #8
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLC
    PlayDay's Avatar
    Join Date
    Aug 2018
    Posts
    36
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Janette5 View Post
    No, I just killed the enemies off after 1.5 seconds - so they didn't stay alive for long, makes it easier to test. There'd be one per spawner alive, if they didn't die so quickly.
    agreed. I changed the time to 1000 and added some movement. It behaves the same as mine; so go with Jeanette's simpler method.

  9. #9
    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,502
    Mentioned
    133 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vSv View Post
    Thanks for the answer!

    That seems like a pretty big deal for things like this. Would have been great to know about that one years ago!
    Yeah, using Fixed is great for 'marrying' specific instances of objects. I've recently started to use this in tandem with an object's Alterable Value ID, which I quite like (this requires 2.5+ ). So just like Janette stored the spouse objects' Fixed IDs in Spawner( "Enemy" ), I might have stored it in Alterable Value ID("Enemy"). For example, here I store my enemies skins (objects used for the enemies' visible animations) with their 'cores' (invisible square blocks that get used for collision, and to store variables):



    There's no massive benefit to doing it this way, but I find it can have a couple of little benefits:

    -Obviously, the "ID" gives it a kind of automatic easy-to-understand meaning. Kind of like how many people like to store an object's X and Y values in Alterable Value X and Alterable Value Y

    -Alterable Value ID is so far down the list that it's likely to always be unused and available for all of your objects. So you can safely get in the habit of using it for all of your objects, which keeps things simple and uniform.

    -Always using the same altVal for IDs could potentially help when combining it with qualifiers. For example, say you want to keep enemies' helmets, armours and shoes together with their bodies. You could just give those 3 items the qualifier "clothes", and then reference them all with a single condition: if Alterable Value ID("Group.Clothes") = fixed("enemy"), then set X("Group.Clothes") to X("enemy")

    -Even though Alterable Value ID is so far down the list, it's actually easy to find in the expression editor because it's on the last 'page' of the drop down menu (when you scroll all the way to the bottom, there it is):


  10. #10
    Clicker Fusion 2.5 (Steam)Fusion 2.5+ DLC (Steam)
    vSv's Avatar
    Join Date
    Aug 2010
    Location
    Sweden
    Posts
    118
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the explanation Volnaiskra!

    The more I think about this, the more I like it. I will probably remake all my enemies to be removed from the game when they are too far away from the player, or if the player enters some new area like in Metroidvanias. Doesn't seem to matter as much since they can just be respawned anyway (which I couldn't do before as the spawners were destroyed).

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Making enemies that can shoot the player.
    By PeanutFish in forum Fusion 2.5
    Replies: 6
    Last Post: 28th July 2015, 08:23 PM
  2. Help with making enemies chase the player
    By Gamemaker10 in forum The Games Factory 2 - Technical Support
    Replies: 8
    Last Post: 23rd September 2010, 09:00 PM
  3. Making enemies flash when hit.
    By camelman in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 19th November 2008, 12:55 AM
  4. My 3D enemies wont respawn *cries*
    By Jacob in forum File Archive
    Replies: 5
    Last Post: 11th March 2008, 05:16 AM
  5. Making enemies find player
    By LazyCoder in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 13th January 2007, 03:50 AM

Posting Permissions

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