Muckluck Posted April 28, 2014 Share Posted April 28, 2014 Hi, I'm starting work on a little project to make a roguelike in Phaser and after a ton of Googling, I still can't figure out for the life of me how to assign tiles from a spritesheet to a dungeon generating algorithm (something simple like cellular automata). I could always try and implement something like rot.js to do the generating, but even still I'm not sure how to take some simple sprites and display them as a tile in the map. If anyone could help me out I'd be truly grateful. I've probably missed something really obvious but I'll be damned if I can figure it out!Many thanks. Link to comment Share on other sites More sharing options...
Heppell08 Posted April 28, 2014 Share Posted April 28, 2014 i would suggest using something like this: https://github.com/prettymuchbryce/easystarjs/tree/master/demo havent used it myself yet but im reading on i and plan to use it in my current dev Link to comment Share on other sites More sharing options...
Rex Rhino Posted April 29, 2014 Share Posted April 29, 2014 I'm starting work on a little project to make a roguelike in Phaser and after a ton of Googling, I still can't figure out for the life of me how to assign tiles from a spritesheet to a dungeon generating algorithm (something simple like cellular automata). You create a 'model' for the dungeon (most likely a javascript object containing a two dimensional array of integer values, with each integer representing a specific tile type). You model wouldn't contain any display logic, it would simply be a representation of your dungeon. This object would also contain a method that would populate the arrays with dungeon data using whatever algorithm you see fit. Then, you create a 'view' that renders your model (by iterating through your model array, and drawing a tile for each location in the array). So, it would look at location 0x0, see that it contains the integer 5 (which might be rock), it would look up the integer '5' in either some sort of array lookup table, or a switch statement, and find the image of a rock defined there, and then draw it. Is that what you are asking? gaelbeltran 1 Link to comment Share on other sites More sharing options...
Geoeo Posted April 29, 2014 Share Posted April 29, 2014 I think this is relevant:http://gamedevelopment.tutsplus.com/tutorials/how-to-make-your-first-roguelike--gamedev-13677Good Luck! Link to comment Share on other sites More sharing options...
Recommended Posts