Jump to content

Search the Community

Showing results for tags 'read'.

  • 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 3 results

  1. Here is the code from an example. I have separte tiles images. <!doctype html> <html> <head> <script src="phaser.min.js"></script> </head> <body> <script> var game = new Phaser.Game(1024, 1024, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create }); function preload() { game.load.tilemap('map', 'bsdmap.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('terrain', 'terrain.png'); game.load.image('p1', 'p1.png'); game.load.image('p2', 'p2.png'); game.load.image('bg_tile', 'bg_tile.png') //game.load.image('phaser', 'assets/sprites/arrow.png'); //game.load.spritesheet('coin', 'assets/sprites/coin.png', 32, 32); } var map; var layer; function create() { map = game.add.tilemap('map'); map.addTilesetImage('terrain'); map.addTilesetImage('p1'); map.addTilesetImage('p2'); map.addTilesetImage('bg_tile'); layer = map.createLayer('Tile Layer 1'); layer.resizeWorld(); } </script> </body> </html> Here is a tiled map in json format { "height":32, "infinite":false, "layers":[ { "data":[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 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 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 4, 3, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2147483652, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], "height":32, "name":"Tile Layer 1", "opacity":1, "type":"tilelayer", "visible":true, "width":32, "x":0, "y":0 }], "nextobjectid":1, "orientation":"orthogonal", "renderorder":"right-down", "tiledversion":"1.1.2", "tileheight":32, "tilesets":[ { "columns":0, "firstgid":1, "grid": { "height":1, "orientation":"orthogonal", "width":1 }, "margin":0, "name":"tileset", "spacing":0, "tilecount":4, "tileheight":32, "tileproperties": { "0": { "blocked":"" }, "1": { "blocked":"" }, "2": { "platform":"" }, "3": { "platform":"" } }, "tilepropertytypes": { "0": { "blocked":"string" }, "1": { "blocked":"string" }, "2": { "platform":"string" }, "3": { "platform":"string" } }, "tiles": { "0": { "image":"..\/..\/..\/..\/Users\/Andrew\/Desktop\/totem burners assets\/tiles2\/terrain.png", "imageheight":32, "imagewidth":32 }, "1": { "image":"..\/..\/..\/..\/Users\/Andrew\/Desktop\/totem burners assets\/tiles2\/bg_tile.png", "imageheight":32, "imagewidth":32 }, "2": { "image":"..\/..\/..\/..\/Users\/Andrew\/Desktop\/totem burners assets\/tiles2\/p1.png", "imageheight":32, "imagewidth":32 }, "3": { "image":"..\/..\/..\/..\/Users\/Andrew\/Desktop\/totem burners assets\/tiles2\/p2.png", "imageheight":32, "imagewidth":32 } }, "tilewidth":32 }], "tilewidth":32, "type":"map", "version":1, "width":32 } All the tiles are embedded in Tiled. But I got an error: Uncaught TypeError: Cannot read property '2' of undefined at Object.parseTiledJSON (phaser.min.js:3) at Object.parse (phaser.min.js:3) at new i.Tilemap (phaser.min.js:3) at i.GameObjectFactory.tilemap (phaser.min.js:3) at Object.create (index.html:33) at i.StateManager.loadComplete (phaser.min.js:3) at i.Loader.finishedLoading (phaser.min.js:3) at i.Loader.processLoadQueue (phaser.min.js:3) at i.Loader.asyncComplete (phaser.min.js:3) at i.Loader.fileComplete (phaser.min.js:3)
  2. Hi, I use a Graphics object as a Sprite mask. How can I read the value of a pixel from the mask ? (given its x and y coordinates) Thanks Teo var sprite; var mask; function create() { sprite = game.add.sprite(0, 0, 'smoke'); mask = game.add.graphics(0, 0); mask.beginFill(0xffffff); mask.drawCircle(100, 100, 50); sprite.mask = mask; }
  3. Hi guys, i'm having trouble with this code , the error is "Cannot read property 'velocity' of null" in player.body.velocity.y = Math.abs(playerSpeed); <!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Drop Wizard</title> <script type="text/javascript" src="phaser.min.js"></script> <style type="text/css"> body { margin: 0; } </style></head><body><script type="text/javascript">var game = new Phaser.Game(480, 320, Phaser.CANVAS, '', { preload: preload, create: create, update: update });var playerSpeed = 150;var player;var platformGroup;function preload() { game.load.image("platform180","platform180.png"); game.load.image("platform120","platform120.png"); game.load.image("player","player.png"); game.load.image("ground","ground.png");}function create() { platformGroup = game.add.group(); game.physics.startSystem(Phaser.Physics.ARCADE); player = game.add.sprite(240,0,"player"); player.anchor.setTo(0.5); game.physics.enable(player,Phaser.Physics.Arcade); game.physics.arcade.gravity.y = playerSpeed; addPlatform(240,60,"platform180"); addPlatform(340,140,"platform120"); addPlatform(140,140,"platform120"); addPlatform(420,220,"platform120"); addPlatform(60,220,"platform120"); addPlatform(100,316,"ground"); addPlatform(380,316,"ground"); game.input.onDown.add(changeDir,this);}function addPlatform(posX,posY,asset){ platform = game.add.sprite(posX,posY,asset); platform.anchor.setTo(0.5); game.physics.enable(platform,Phaser.Physics.ARCADE); platform.body.allowGravity = false; platform.body.immovable = true; platformGroup.add(platform);}function update() { player.body.velocity.y = Math.abs(playerSpeed); player.body.velocity.x = 0; player.body game.physics.arcade.collide(player, platformgroup, movePlayer); if(player.y>320){ player.y = 0 } if(player.x<12){ player.x=12; playerSpeed*=-1 } if(player.x>468){ player.x=468; playerSpeed*=-1 }trace(player); trace(player.body) trace(player.body.velocity)}function movePlayer(){ player.body.velocity.x = playerSpeed} function changeDir(){ playerSpeed *= -1; }</script></body></html>
×
×
  • Create New...