Search a tilemap for a tile

  • Hi guys,

    the solution I got is a bit (too) rudimentary (plus very random in duration and questionable in effectiveness, no doubt):

    Does someone know a more accurate way? Im generating a map (dungeon) randomly and the player should be placed somewhere on a walkable spot (the worldgeneration starts in the middle of the generated field). I would like to use that routine also for spawning enemies, interactive objects, stairs, etc.. With my "solution" it *might* be possible to place the player (somewhat between instant and X minutes, depending on whats generated).

    Does someone can offer a player- and time-friendlier solution?

    Have a great day,

    Proxy

    Edit: also thought about extracting the JSON of the tilemap and search in that for the ID I want, but this likely will take the first match every time - so the player will always start in the top left corner, what I dont really want - and placing the enemies with that way would end in a massacre (without an exit )

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your dungeon generation routine should keep tracks of positions that are candidate to receive additional objects. Once generation is done, pick a random position in the list of candidates and create your sprite on it.

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