Jump to content

Search the Community

Showing results for tags 'gettileabove'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. 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.
×
×
  • Create New...