Testing if an instance of this object with a certain instance variable value exists

0 favourites
  • 2 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I'm making a random level generator, and I assign two special room with the instance variable order as "start" and "end". But from the random nature of my gen system and the way I delete duplicate rooms on the same coordinate, there's a small chance the start room will be overlapped by other rooms (including the end room)

    What I want to do is, after there's only one room per grid position (done, working fine), I test if there's a room with the instance variable order = "start" and, if false, restart the gen process.

    If it helps, I understand the (condition ? returniftrue : returniffalse) expression, so if the solution uses it I'm not afraid to try.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use system pick by evaluate : pick all room objects where room.order=start, set a local or global variable to room.pickedcount. Then you say if the local or global variable = 0 (i.e. there are no rooms with order set to start) then restart the process.

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