Jump to content

Search the Community

Showing results for tags 'collision platformer json map'.

  • 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. Hi, I have problem with collision in my simple platformer game. I have map loaded with a JSON file. My character collides only on the top of blocks. I attach my awful image bellow what simmulate my problem. (red lines simmulate's no collision area, on blue lines my player collides and stand into platform. var game = new Phaser.Game(640, 640, Phaser.CANVAS, 'main', { preload: preload, create: create, update: update, render: render }); var player ; var map; var layer; var key; function preload() { game.physics.startSystem(Phaser.Physics.ARCADE) game.load.tilemap('map', 'assets/map.json',null, Phaser.Tilemap.TILED_JSON); game.load.image('mainTileSet', 'assets/maps/tileSet.png'); // game.load.spritesheet('player', 'assets/sprites/tileSet.png',0,0); } function create() { map = game.add.tilemap('map'); map.addTilesetImage('mainTileSet'); map.setCollisionBetween(1, 180); layer = map.createLayer('mainLayer'); layer.resizeWorld(); layer.debug = true; player = game.add.sprite(0,0,'player'); game.physics.enable(player); game.camera.follow(player); player.body.collideWorldBounds = true; player.body.gravity.y = 600; key = game.input.keyboard.createCursorKeys(); } function update() { game.physics.arcade.collide(player, layer); if(key.left.isDown){ player.x -= 7 }if(key.right.isDown){ player.x += 7; }if(key.up.isDown){ player.y -= 15; }if(key.down.isDown){ player.y += 7; } } function render () { game.debug.body(player); }
×
×
  • Create New...