Is there a way to recreate initial objects but only if they meet a condition?

0 favourites
From the Asset Store
Create a boss fight with this easy to follow game pack. Recreate the classic attacks of Mutoid Man from Super Smash TV
  • I have all my enemies in a family and in some occasions I recreate them, but I want bosses not to be recreated, but only in some cases, which I have a boolean for. Is it possible to only recreate if they meet a condition, which would be this boolean?

  • but only in some cases

    They are gonna need more info to give you a more concrete answer as the booleans variables will be according to your specific cases.

    1-What are the cases in which the boss should spawn?

    Providing that info they will be able to help you quicker.

  • It's not that relevant, it's just that this boss, later in the game, will be a regular enemy, so the regular ones should respawn whenever their initial position is on-screen (which is already set up) but the boss one should only be fought once, so I created a boolean only that instance has true, but don't know how to make it so enemies with that set to true won't be recreated

  • It's not that relevant, it's just that this boss, later in the game, will be a regular enemy, so the regular ones should respawn whenever their initial position is on-screen (which is already set up) but the boss one should only be fought once, so I created a boolean only that instance has true, but don't know how to make it so enemies with that set to true won't be recreated

    I dont understand why the regular enemies that are not bosses will have the Boolean true. Normally you will set only the one who is boss to true after all that's why you added the boolean to identify who is the boss, then when the user completes the boss just turn the boolean off for that boss so it becomes regular like the other ones.

    Though you will have to keep the Boss info if it's (completed or not) saved in a "Local storage" to keep up to date with the progress because the objects will always load their default values like (booleans, instance variables, etc...) unless you load from "System Save" which it will save the current state of all the objects on the game including booleans, etc...

    If you dont use the "System save" to save and load the Game then I will recommend you use (local storage + the Boolean you have)

    For example:

    Let's say is Boss1

    1-At the start of the layout loads the info from local storage into a variable or you could have a dictionary holding all the info for all the bosses and just load the whole dictionary from local storage.

    2-To spawn the enemies you can do:

    If Boss Boolean is false: ------------- Spawn as a regular enemy

    Else: Is boss completed: ------------- Spawn as a regular enemy

    Else: ------------- Spawn as Boss

  • I'm very thankful of your attempt to help me but I'm afraid you didn't quite get the situation:

    I have an enemy (an object), which will sometimes be used as a boss and sometimes as a regular enemy (they will be different instances of the same object). My boolean is "IsRespawnInfinitely". My game is a Metroidvania where, when you go to a new area, all enemies that were there respawn (and the ones from the area you were in are destroyed) using the "Recreate initial objects" action. There is an Area, a single room, in which there is a boss the player should only be able to fight once, but is the same object that will then be used as a normal enemy in the future. Instances that have this bool set to true should act as normal enemies, and respawn and be destroyed according to whether the player is going to a new area or not, but an instance with this bool set to false should not be affected by any of this. Therefore, I wanna know if there is a way to check for whether the bool was true or false for an instance of an object that is currently destroyed, so I have a way to identify if this is an instance that should be recreated or not.

  • If it's that different then clone the object and call it the boss, easy fix.

  • Feels like a bad practice

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What you are describing above is the Persist behaviour. When you create the boss object, give it the Persist behaviour then it will remain destroyed after you destroy it.

  • Persist would make it not come back when reloading the layout, not when I use the "Recreate initial objects" action. My "Areas" are not different Layouts.

  • Making a metroidvania in one layout? Feels like a bad practice

  • Bro, by area I mean room. I don't have like, a forest area, an underwater area... all in one Layout, no. I'm just talking about rooms, the enemies should respawn when you enter a room again. I didn't mean to be mean to you when I said it felt like bad practice, I'm very thankful of your help actually, I really am.

  • What the other guy described above then seems like a part of the fix. You need a variable set from 0 to 1. Then you can have an event - boss on created, if var = 1, destroy. If you recreate that initial boss there's no way to know you destroyed it already unless you set another variable.

  • Then maybe just

    On created

    Is not IsRespawnInfinitely -----> Destroy

    But again, this feels like very bad practice. It sure would be nice if construct would add a way to only recreate objects that met a specific condition on their original properties. Do you think I'm maybe just too bothered with this "bad practice" thing?

  • Also with recreate initial objects you can select a section of the layout so maybe you can incorporate that somehow into what you already have to ignore the area that contains the boss.

  • Then maybe just

    On created

    Is not IsRespawnInfinitely -----> Destroy

    But again, this feels like very bad practice. It sure would be nice if construct would add a way to only recreate objects that met a specific condition on their original properties. Do you think I'm maybe just too bothered with this "bad practice" thing?

    Yes. Very bad practice to destroy the boss when a variable is set ?

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