Search the Community
Showing results for tags 'single'.
-
Hi everyone. I am currently at the beginning phases of creating the portion of my code that will update/create my map from an algorithm I will create later. For now I am randomizing it. I am using the csv option of tilemap but running into a problem I can't figure out and I have read everything I can to no avail. I have this in my preload(): game.load.image('worldMapTiles', '/public/assets/mapspritesheet.png'); function generateWorldTilemapCSV() { ** Random code here - save the space by leaving it out of post here is a copy and paste of its return from the console: "3,1,2,1,1,0,2,3,2,1,2,3,3,2,1\n2,2,1,3,0,2,3,1,0,1,3,2,3,1,2\n1,2,2,3,3,2,2,0,1,1,1,3,3,3,3\n1,1,2,2,1,0,2,2,3,1,3,2,2,2,3\n2,2,3,3,1,1,2,1,3,1,2,1,1,1,2\n1,2,3,1,2,3,1,2,1,2,2,2,1,3,3\n2,2,3,1,1,1,3,1,3,1,1,1,2,3,2\n1,1,1,3,1,3,3,2,1,3,1,2,2,1,3\n3,1,3,2,1,3,2,0,1,2,1,2,3,2,0\n3,2,2,1,1,3,2,3,2,1,2,1,1,1,2\n1,2,3,1,1,2,2,3,0,2,3,2,3,1,1\n3,3,3,1,2,2,1,3,1,2,1,2,2,2,3\n3,1,2,2,3,2,2,1,2,2,1,3,2,1,2\n1,3,1,3,3,1,1,1,1,1,3,2,1,2,1\n1,2,3,3,2,1,2,1,3,3,1,3,3,2,3\n" ** }; game.load.tilemap('worldMap', null, generateWorldTilemapCSV(), Phaser.Tilemap.CSV); ... and in my create() map = game.add.tilemap('worldMap', 200, 200); map.addTilesetImage('worldMapTiles'); However all this does for some reason is create one 200 pixel tall row that is very wide (essentially all the tiles horizontally) as if it is ignoring the '\n'. 'mapspritesheet.png' is a simple 400x400 image ([4] 200x200 squares). I have no errors in the console. I am new so I have a feeling I am missing something obvious but I promise I have spent hours on this already before asking. Thank you in advance for your help. UPDATE: Well it is now been multiple days and this post still has not been approved - figured it out - the string needs to have the new line double escape like this '1\\n' which means that in my random map generator I had to add three slashes like so: '\\\n' when appending it.
-
Hey guys, I'm creating a drag and drop interface and using arcade.overlap with onDragStop to position a sprite with a "drop zone" group. Unfortunately, the draggable sprite is large enough to cover two drop zones at the same ime. I have a custom property ("occupied") that is set to true while the sprite x,y is set to the drop zone x,y when a sprite is dropped and overlapping. Unfortunately, it does this for both drop zones in the group and both are "occupied" although only one x,y is used. Hope that makes sense. But my question is how do I only allow for only one sprite to be triggered on overlay?