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

0 favourites
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I know I can select an area, but I did it in an automatic way that can't easily accept an exception. What makes me feel it's bad practice is that I'm uselessly creating and immediately destroying an object for lack of a better way to do it.

  • Hello, I don't understand what the problem is since you can use the coordinates of the enemies to recreate, if the boss is at X 3000, you will give 2 actions, one where you recreate the characters from X 0 to X 2900 one from X 3100 to whatever you want, so the boss will not be recreated, in case you want to recreate it on some occasions, you will create an action dedicated to the boss in a separate event

  • My game is divided in rooms to which the camera scrolls when you enter them, just like 99% of metroidvanias. For this, I have invisible sprites that represent the limits of a room for detecting where the player is and where the camera should be. Every time the player switches rooms, I destroy every enemy and recreate those from the room the player is now in using the coordinates of said sprite. And that's why it's not that easy to implement a solution like that.

  • Sorry I'm trying to understand. So for example, in the first room there are 2 normal monsters that are destroyed before entering in the second room.

    When you enter in the second room there must be these 2 monsters again in the same coordinates but one must be the boss?

  • No. Imagine room A has no enemies, room B has 2 mice enemies, room C has a bat boss enemy, and room D has 2 of the same bat enemy which are different instances of the same object as the boss, which now that the player is better and has more abilities are therefore as easy as a normal enemy was at the beginning of the game. Player starts at room A, and all enemies are destroyed instantly. Player then moves to room B. The game destroys every enemy and recreates the mice for room B. The player kills one of the mice then returns to room A. All enemies are destroyed again and the game tries recreating the enemies for room A, but there are none, so nothing happens. Player returns to room B, all enemies are destroyed, and room B`s 2 mice are recreated (no matter if the player killed them). Player proceeds to room C. Every enemy is destroyed, the boss bat is recreated, and the room is sealed. The player then defeats the boss and the room is unsealed. Player proceeds to room D. All enemies are destroyed and room D`s bats are recreated, one of which is killed by the player. Player goes back to room C. All enemies are destroyed and the boss is not recreated (but if there were another enemies in the same room, they should have been). Player then goes back to room D. All enemies are destroyed and both bats in room D are recreated. That`s the behavior I`m looking for, but I don`t know how to tell regular bats apart from boss bats not to recreate them. Is it clear? To be honest, I solved this problem by making it so the boss only spawns when the player reaches it`s room, and by not placing it on the layout initially, so it isn`t recreated. That said, I still want to know if there is a way to recreate objects based on if they initially had a bool set to true or something, as this will probably still be of much use, or maybe by whether or not they would meet a condition after recreated. If not, in case the Construct gods are listening, a feature like this would be much appreciated.

  • Instead of giving the boolean to an enemy, you could create a global boolean and call it Boss, then set it to true if the boss will be in the next room, set as conditions: at creation - if Boss is true -> in actions set in the Bat sprite the characteristics of the boss

    If in the room there could be both boss and regular bats, you can add in conditions - if Bat sprite is in X coordinate, so that boss characteristics are only in instance you want

  • Problem here is not the properties, my man. I can just use templates for those and have them ready at layout view. The discussion is about finding a way to not respawn the boss after it is killed but keep al other enemies respawning. I have a family for objects that should act like that, but as a boss can be the same object as a normal enemy, just different instances, as before mentioned, I can't simply remove it from the family.

  • To answer the original question, there is no built in way to do what you want.

    The easiest thing I can think of is keeping track if the boss has been defeated in a given room, then with that information decide if it needs to be destroyed or not after recreating all the instances in the corresponding room.

    This falls in the domain of very specific game logic, so C3 doesn't provide a special way of doing it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you! Would be a very nice feature tho. It could check for properties of the object as they were initially on the layout or for what they'll be if recreated and recreate them or not based on this. Thanks again!

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