Search the Community
Showing results for tags 'tile'.
-
Hello! So I'm working on this game on my spare time. I'm trying to merge alot of what I think resembles a good game with some(alot?) own ideas. You might find it close looking like Tibia. Features Spells Quite unique spell system (in my opinion). You craft spells, so the same spell can have different abilities or have different cast styles. Here's an example of magic wall and poison cloud: https://i.gyazo.com/fcd7ed547a9116c2b0d1c359c2b9381f.mp4 Here's another example, but from your spellbook. In the spellbook you have all your spells that you know. They all have different properties, which are random when learned. You can have 2 spells selected at the same time (as of now, might increase in the future). https://i.gyazo.com/4539a561f97cb90029643a45637b66ee.mp4 As you can see in the vid, the spells have different properties: Draw/Single: Different throwing styles, either point and shoot, or draw, where you draw where you want to shoot the spell, and hit space to fire it off. CD: Cooldown, how long it takes until you can shoot this spell again. MAC: Max Affected Coords - Crappy name, but if you have a draw with MAC of 5, you can pick 5 tiles to fire the spell on. Mobs Fight of undefined mobs that are attacking you. Are capable of throwing spells and are of various size. The Red Dragon is 3x3 tiles big and throws scary fireballs. Harvesting Chop down trees, mine ores or grab a machete to get som wheat or even flax. Crafting Use your harvested items to create weapons, armors Towns Create your own town, claim land(tiles) and build walls around it. Invite your friends to your town. Inventory Drag and drop inventory system Large map The map can be quite large, tested with 25 000 000 tiles so far. (5000 x 5000). Technical details The game is made with HTML5 and mostly VanillaJS. Some Vue.js to structure different modules such as the inventory. Would be happy with some feedback/ideas whatever to keep my motivation up Still BIGWIP..
-
I've got a tilemap created in Tiled and there is a platform with ladder on the map. How to make player stop when it tries to move from platform to group layer? Also how to make player collide with tiles pointed by green arrow when player approaches then from left, bot not collide when player approaches from right. Simply, is there `checkCollision` property for a tile?
-
Hi everyone, This is my first post in here but I generally read most of the topics in this forum. I couldn't find anything about this topic. So this is the question; I'm trying to generate a random world with a tile map in phaser. I want to extend Tile class to use in my needs for example; clicking a tile or when you hovering mouse on a tile it will give the information depending on the tile type. So I want to get those infos from extended class itself. Addtionally when you click on a tile maybe you I will trigger some actions and every different extended tile class has its own implementation for onclick function (you know the idea here...). But when I do this and using the putTileAt() function, in the layer data I still see the tile object type as Phaser.Tilemaps.Tile, because in the source code it's just copying the attributes of the extended Tile class to Phaser Tile class. This is done on purpose I believe but I want to use some polymorphism in my code and don't want to write custom code (by puting the extended tile object to its cordinatte with layer.data[j] = new XTile()) for this because I want to be depended on phaser 3 framework with tilemaps. How I can achieve this? Thanks in advance for your opinions Bests Deniz
-
Hello, If I have a tilemap with a dynamic layer, a player with collisions enabled with this layer - how do I manually check whether the player is overlapping specific tile? I try this way: scene.physics.world.enable(player); scene.physics.add.collider(player, layer); ... var tile = layer.getTileAtWorldXY(Xpos, Ypos, true); console.log(scene.physics.world.overlap(player, tile)); .. but I always get False printed, even if selected tile is right behind the player. Same result with calling collide(), same result if tile's index is -1 or something else. What am I missing?
-
Hello! I've noticed, that if I modify exact tile's collisions with tile.setCollision(false, false, true, false) - it also disables neighbor tiles collisions (left-right directions). A screenshot is attached. Red arrow shows a modified tile, blue arrow shows a tile which's left-right collisions have disappeared. Lab's modified example that you can copy-paste into https://labs.phaser.io/edit.html?src=src/game objects/tilemap/collision/tile callbacks.js : var config = { type: Phaser.WEBGL, width: 800, height: 576, parent: 'phaser-example', physics: { default: 'arcade', arcade: { gravity: { y: 300 } } }, scene: { preload: preload, create: create, update: update } }; var game = new Phaser.Game(config); var map; var cursors; var debugGraphics; var text; var player; var groundLayer; function preload () { this.load.image('ground_1x1', 'assets/tilemaps/tiles/ground_1x1.png'); this.load.tilemapTiledJSON('map', 'assets/tilemaps/maps/tile-collision-test.json'); this.load.image('player', 'assets/sprites/phaser-dude.png'); } function create () { map = this.make.tilemap({ key: 'map' }); var groundTiles = map.addTilesetImage('ground_1x1'); map.createDynamicLayer('Background Layer', groundTiles, 0, 0); groundLayer = map.createDynamicLayer('Ground Layer', groundTiles, 0, 0); groundLayer.layer.data[8][8].index = 11; groundLayer.layer.data[8][9].index = 1; groundLayer.setCollisionBetween(1, 10); // This breaks the collisions with the neighbor tiles groundLayer.layer.data[8][8].setCollision(false, false, true, false); player = this.physics.add.sprite(80, 70, 'player').setBounce(0.1); // We want the player to physically collide with the ground this.physics.add.collider(player, groundLayer); this.cameras.main.setBounds(0, 0, map.widthInPixels, map.heightInPixels); this.cameras.main.startFollow(player); cursors = this.input.keyboard.createCursorKeys(); text = this.add.text(16, 16, 'Arrow keys to move. Space to jump', { fontSize: '20px', fill: '#ffffff' }); text.setScrollFactor(0); text.setText('Arrow keys to move. Space to jump'); } function update (time, delta) { // Horizontal movement player.body.setVelocityX(0); if (cursors.left.isDown) { player.body.setVelocityX(-200); } else if (cursors.right.isDown) { player.body.setVelocityX(200); } // Jumping if ((cursors.space.isDown || cursors.up.isDown) && player.body.onFloor()) { player.body.setVelocityY(-300); } } Here important is line 48: groundLayer.layer.data[8][8].setCollision(false, false, true, false); If you comment it out - everything is OK - you can walk through red arrow's tile and blue tile's collisions works fine. If you run it as is - you can walk through red arrow's tile and through neighbor blue tiles too - this is wrong. How this can be fixed? Thanks!
-
Here is the tile spritesheet : Example: https://labs.phaser.io/edit.html?src=src\game objects\tilemap\collision\csv map arcade physics.js These white stripes appear when the camera moves in this example, I have this problem in my own game, any idea what one can do about it? The only thing I could think of doing about it was to add empty tiles to the tile sprite sheet so that transparent tiles would not get stripped by the tile beside it.
-
This sounds really stupid considering Phaser.Tilemap has built in getTileBelow and getTileAbove functions. However, I still can't get this to work. I am creating a Pacman clone in Phaser, and have ran into trouble. I have a method moveUp() that looks like this moveUp: function() { if (cursors.up.justPressed() && this.pathUpAvailable()) { pacman.body.velocity.x = 0; pacman.body.velocity.y = -(gameStats.pacmanVelocity); pacman.frame = 6; pacman.animations.stop(); pacman.animations.play('pacmanUp'); } }, In short, I have four different animations defined depending on which direction Pacman is going in. As such, it doesn't make since to play the animation for moving right when he's moving up and there is a wall to the right. As such, I decided I needed to create four separate functions to determine whether there is a wall in each direction. Here is what the pathUpAvailable() method looks like. pathUpAvailable: function() { return map.getTileAbove(0, (pacman.x / map.tileWidth) | 0, (pacman.y / map.tileWidth) | 0).index == -1; }, If you look at the documentation here http://phaser.io/docs/2.4.4/Phaser.Tilemap.html#getTileAbove It says that this method takes in the following three parameters. layer: The index of the current layer. In my case, I only have one, which defaults to 0. x: The x coordinate to get the tile from. It's important to note that this is measured in tiles not pixels. The x position for a sprite is measured by pixels. As such, we need to divide this value by the tile width as defined in a Tiled JSON file. This value will be a number with decimal points, so it needs to be rounded. Since arrays are zero-indexed in JavaScript we must take the floor of this value, which shorthands to | 0. y: See above. Measured in tiles not pixels This returns a Tile object, of which it seems like the index property determines whether there is a tile there or not. If there isn't, -1 will be returned. This has led to some unpredictable results. Sometimes, it will work, but for example, when the x coordinate of the character is above 400, I will receive the following in my console. Cannot read property 'index' of undefined at Object.pathUpAvailable at Object.moveUp at Object.movePacMan at Object.update I have attached a screenshot demonstrating where the issue occurs Here are a couple of things to keep in mind. It might look like I made a mistake using map.tileWidth twice for the x and y axis and it probably was a mistake. That said, both my tileWidth and tileHeight are set to 6 pixels, so that wasn't the problem here I would like to eventually display the score at the top, so I decided to center the map. I called map.fixedToCamera = false; and then set the position property of the map to center it. Given that I received the above message at a high x coordinate position, this would seem to indicate the problem was with that. I think showing my map1.json file could also be helpful here. { "height":76, "layers":[ { "data":[621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 621, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 0, 621, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 0, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 0, 621, 0, 0, 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621], "height":76, "name":"WallLayer", "opacity":1, "type":"tilelayer", "visible":true, "width":64, "x":0, "y":0 }], "nextobjectid":1, "orientation":"orthogonal", "renderorder":"right-down", "tileheight":6, "tilesets":[ { "columns":61, "firstgid":1, "image":"..\/images\/pacman_tiles.png", "imageheight":384, "imagewidth":368, "margin":0, "name":"pacman_tiles", "spacing":0, "tilecount":3904, "tileheight":6, "tilewidth":6 }], "tilewidth":6, "version":1, "width":64 } Specifically, check the number of tiles which equals 3904. Here was my buildMap function. buildMap: function() { map = this.game.add.tilemap('map1'); map.addTilesetImage('pacman_tiles', 'pacmanTiles'); wallLayer = map.createLayer('WallLayer'); map.setCollisionBetween(1, 5000, true, 'WallLayer'); }, I set the collision to 5000, which is more than the number of tiles.
-
Hi! I am fairly new to Phaser 3 and I have 1 very simple game under my belt (a bulldozer moving rocks around). I am now trying my hand a tile maps so I downloaded Tile and made my map following a few tutorials and now I have my map I have everything set but I keep getting "Uncaught TypeError: Cannot read property 'TILED_JSON' of undefined". I have done alot of reading and I can't seem to find anything helping me with problem. This is all the code I have for right now I am just trying to get my head around tile maps. I have been trying to figure this out for about 2 hours now and I am starting to get a headache, also not asking for anyone to code it for me but pointing me in a direction would be AMAZING! function preload () { this.load.tilemap('store1', 'assets/images/untitled.json', null, Phaser.Tilemap.TILED_JSON); this.load.image('tileS','assets/images/spriteSbuild.png'); } function create () { this.map = this.add.tilemap('store1', 32, 32, 64, 32 ); this.map.addTilesetImage('tileS','assets/images/spriteSbuild.png'); this.map.createLayer('Tile Layer 1').resizeWorld(); }
- 5 replies
-
- tiled_json
- phaser 3
-
(and 2 more)
Tagged with:
-
Code pen: I am moving a NPC back and forth on a plattform by checking if the end tile is one of the tiles that are edges in the tilemap and if so swicthing the x velocity. I am having trouble with getting the moving sprite to move equally as far out of the edge of the plattform on both sides, but it seems the sprite is only colliding with one tile at the time, namely the tile that is touching the right bottom corder of the sprite, can I set the collide to be on the tile that is under the middle of the sprite?
-
Hi I am new to Phaser and building my first game with Phaser CE. I am trying to build rows and column of images that will dragged and drop. I am having hard time understanding various ways to build tiles and can't find any resources of exactly what I am doing. So I build squares in row but don't know how can I lay it in multiple rows like tiling and then how to put the images inside the thumbnailBg.Can someone please advice. var thumbnails; var thumbnailBg; var thumbnailsHolder = this.game.add.group(); thumbnailsHolder.x = 400; thumbnailsHolder.y = 100 for(var i=0; i<imageName.length; i++){ this.createThumb(thumbnailBg, i); // thumbnailBg.x = 100*i; if(imageName[i].indexOf('_mask') < 0 && imageName[i] !== 'bw_1'){ thumbnails = this.add.sprite(100*i, 0, imageName[i], null, thumbnailsHolder); } } function createThumb (thumbnailBg, i){ console.log('thumbCreator'); thumbnailBg = this.game.add.graphics(100*i, 0); thumbnailBg.lineStyle(2, 0x276998, 0.6); thumbnailBg.beginFill(0xFFFFFF); thumbnailBg.drawRoundedRect(330, 50, 100, 100, 10); // draw a rounded rect mask thumbnailBg.endFill(); }
-
hi, after get the examples from : https://phaser.io/examples/v2/tilemaps/tile-properties i'm searching to modify the object of the tiles, but i can't modify the alpha and the scale (=> see //HERE THE PROBLEM). how do you do to reach that ? var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update ,render: render}); function preload() { // tiles are 16x16 each game.load.image('tiles', 'tiles.png'); } var cursors; var currentDataString; function create() { // Create some map data dynamically // Map size is 128x128 tiles var data = ''; for (var y = 0; y < 128; y++) { for (var x = 0; x < 128; x++) { data += game.rnd.between(0, 20).toString(); if (x < 127) { data += ','; } } if (y < 127) { data += "\n"; } } // console.log(data); // Add data to the cache game.cache.addTilemap('dynamicMap', null, data, Phaser.Tilemap.CSV); // Create our map (the 16x16 is the tile size) map = game.add.tilemap('dynamicMap', 16, 16); // 'tiles' = cache image key, 16x16 = tile size map.addTilesetImage('tiles', 'tiles', 16, 16); // 0 is important layer = map.createLayer(0); // Scroll it layer.resizeWorld(); game.physics.startSystem(Phaser.Physics.ARCADE); cursors = game.input.keyboard.createCursorKeys(); // Our painting marker marker = game.add.graphics(); marker.lineStyle(2, 0xffffff, 1); marker.drawRect(0, 0, 32, 32); game.input.addMoveCallback(updateMarker, this); game.input.onDown.add(getTileProperties, this); cursors = game.input.keyboard.createCursorKeys(); } function getTileProperties() { var x = layer.getTileX(game.input.activePointer.worldX); var y = layer.getTileY(game.input.activePointer.worldY); var tile = map.getTile(x, y, layer); console.log(tile) //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //HERE THE PROBLEM tile.scale.x=.1 tile.alpha=.1 // Note: JSON.stringify will convert the object tile properties to a string currentDataString = JSON.stringify( tile.properties ); tile.properties.wibble = true; } function updateMarker() { marker.x = layer.getTileX(game.input.activePointer.worldX) * 32; marker.y = layer.getTileY(game.input.activePointer.worldY) * 32; } function update() { if (cursors.left.isDown) { game.camera.x--; } else if (cursors.right.isDown) { game.camera.x++; } if (cursors.up.isDown) { game.camera.y--; } else if (cursors.down.isDown) { game.camera.y++; } } function render() { if(currentDataString){ game.debug.text('Tile properties: ' + currentDataString, 16, 550); } else { game.debug.text("Click on a tile to reveal the properties of the tile", 16, 550); } }
-
Im using 2.0 arcade physics for a platformer i'm making but my player keeps colliding with invisible overhead tiles , running through tiles ,and sinking into the floor. I've tried changing around numbers in my setCollisionBetween and setCollisionByExclusion but collision detection is all over the place. I never really ran into this problem with the earlier phasers. Its to the point where the game is kinda unplayable. The links below are to hastebin.com Here is my tilemap.json. I only want the player to collide with "ground"And here is my actual game code game.js is there anything i can do to fix this?
-
I want to fill the color in specific tile. The method available in phaser is putTile(), But I want to fill any color I want. In canvas there is method called fillrect(). Please suggest me some solution.
-
Ok, so things are starting to come together with a system I have been working on. I have most of the things figured out, Im just putting together tools to make editing the assest/levels easier. I have the prototype/alpha of the tileAtlas Sheet editor almost done, the only thing to add is speed settings for the animations and to export the SHEET object for later use in a PROJECT file. The editor lets you select a tile, and choose the animation type which the frame progressions are explained here: https://github.com/Pryme8/TileMaster This is all very early in the development but all the dots are being connected and soon this will be a full fledged 2.5D Scene editor extension for bjs. Here is the Sheet editor prototype: https://pryme8.github.io/TileMaster/editor/index2.html Arrows scroll the sheet around Select a Tile and an animation type to see the preview. This is all in preparation for the final editor, where you will be able to edit your assets and levels all under one roof visually then export as a single TILEMASTER file that will later be load the project into a DOM with a single function. The tileAtlas shader features 4 layers per plane, of course Animations, Paralax effects, and Mode7 like transforms. I will be adding more features later (like plans for LightMapping and pixel perfect shadows) Here is a really shotty demo showing the animations and layers working: https://pryme8.github.io/TileMaster/dev/demo.html Here is a bad demo of the Paralax effect: https://pryme8.github.io/TileMaster/ I have been trudging away at this and have a ton of features that I have already figured out I just have to deploy now. Plans are to eventually include my fishsticks library as well to handle the 2D physics. Ill keep posting updates on this as they come available! Questions, Comments, Concerns, Criticism is appreciated.
-
I am making a platformer game with Phaser 2.9.2 where the map is loaded from a JSON file and am having difficulty trying to make interactive tiles which are replaced by a new tile with a collision from a single-direction. I have found a function which allows me to control the direction of collision direction of tiles, so I am hoping to find out how to activate a function and replace individual tiles when there is the sprite and tile are overlapping. I have been thinking of adding the tiles individually in JSON with unique properties and using the .createFromObjects method, but I want every tile to have the same properties and the potential to make multiple stages. So I am hoping there is way to activate a function when the players sprite overlaps with the tile, and in the function it replaces that individual tile with another tile from the tilemap.
-
Hey guys, please help with my collision problem. https://github.com/Matheus-Bard/invaders_life/tree/master/invaders_V0.2 thks for the help! gameState.js load.js
-
Hello I want to collect coins in my platformer game, so i need to remove coin tile when my player overpap it. So, in create function i add this map.setTileIndexCallback(50, this.collectCoin, this); And create new collectCoin method map.putTile(-1, layer.getTileX(player.x), layer.getTileY(player.y)); score += 10; And thats work, but the number of points is accumulated too much, when the player is standing next to the coin itself, it does not disappear, and points are scored at a high speed I try to use new TilemapLayer , but its causes an error alpha = 0 now work or I am doing something wrong
-
So I am trying to make a platformer game using Phaser. The game contains a lot of blocks (tiles) which are loaded from the tilemap. Now what I want is that these blocks can be moved dynamically during the game (for ex. if the player bangs their head against it). The thing is, I don't know how? My first question is, is this possible? Because I tried changing the position, it didn't work (but I successfully changed its alpha). Moreover, I tried using Physics P2, but it has a null sprite value, so all the changes done are done to the body and the sprite still remains there. I can use any physics system, I am open to all. All I need is a way to work this out.
-
510/5000 Good night people! I'm developing a game where the character needs to climb a ladder. The problem I am facing is when he needs to enter a tile that is down the ladder, as I try to illustrate in the image below. When hitting the tile the pesonagem stops to move because the tile needs to be solid so the character can walk on it, but when he is on the stairs he must pass over this tile. Could someone show an example of how I can do this? Since then, thank you very much.
-
Hey guys, I'm having trouble swapping tiles in a Tilemap. In all the examples it seems like to get a tile object (to pass into map.putTile) it has be selected from an already instantiated tile that's part of the map. What I'd like to do is create a new tile from the map's tileset. Is this possible?
-
Hi Guys there, There is a game with multiple layers. The lowest one is the water. Camera is above. The layers are scaled differently and moving with different speed imitating that its a 3D world. I want to use only a screen size tile sprite rectangle for the water to avoid full world broad animated tile map. There is a zoom navigation tool which scales all the layers up and down based the on the centre of the screen and I want to zoom the water as well. Question one: Can I set the "anchor" base point for the scale on a tile sprite? I couldn't find any property for it. And the base point is the top left corner by default. Question two: Does it make sense to try saving hardware resources in this way? The water surface has to be about 20 times bigger than the screen. Many thanks for any help.
-
Hi Everyone, I need guidance on how can I approach this problem: Would like to apply a tiled texture to complex polygons. I'm using P2 for the physics and tiled for the level editor. I would like to get something similar to worms where the terrain has a tiled texture, the top has grass and the bottom is darker. These are some examples of what I would like to achieve: I don't care at all about destructible terrain. This is how my level looks now with polygons from tiled: http://puu.sh/wMwsg/28b1609d74.jpg
-
Hi. I'm using tiled to create maps for my game. I want to create polygons in the tile collisions editor so when I place a certain tile, lets say a curve with a fence I always want a collision poly along the fence. Currently my curve is made of 6x6 tiles so I load the curve as a tile map in tiled. The tile collisions editor only allow me to add objects per tile. I want a object on the entire tile map instead so whenever I place a curve I get the collision part too. If I would make my tile map into a single tile the problem is that I have to draw 6x tile columns and rows outside the camera or track pieces will popup when the top left 64 x 64 tile enters the camera. (This is my own drawing function created before I found phaser, will phaser drawing do it different?) So basically I want to treat my tile map as 64 x 64 tiles that my game draw while I want collision objects to be active as soon as part of the tile map is drawn. I would prefer if I don't have to create my collision polys as a separate layer after creating the map. Any tips on how to solve this problem?
-
Trying to help this topic The problem is scaling texture on the caps of an extrusion. What is needed is something like this on the caps what I get is http://www.babylonjs-playground.com/#TF811Y#5 any suggestions
-
Hi, I'm making a tile based mahjong clone, you can check the attached image for reference. basically I need a smart way to implement the mechanic of mahjong, that checks when I tap a tile if he has neighbours ( left or right ) and if he has a tile ontop of him. The way these are placed makes it very difficult for me to come up with a system. The sprites/buttons are all overlapping already I have my buttons(tiles) in an array and the references to which tile it is in a seperate array so I can create them easily for more levels. Is there someone who can help me tell phaser to check this without giving each tile in each level a reference to neighbours ( would take forever ) If you want me paste some code just ask