Jump to content

Search the Community

Showing results for tags 'Tilesmap'.

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

  1. I have a tilemap with all tiles set to alpha = 0, when my character come close to a tile it becomes visible. The issue is that the tiles seem to update only when my camera moves. Like when the camera needs to scroll to follow the character all is ok, but when the camera doesn't have to move if my character is close to the edge the tiles stay invisible until the camera move. this is in my create function: this.map = this.game.add.tilemap('tilemap'); this.map.addTilesetImage('pixel', 'pixel'); this.layer1 = this.map.createLayer('layer1'); this.layer1.resizeWorld(); this.map.setCollision(1); this.sprite = this.add.sprite(50, 50, 'sheep'); this.game.physics.enable(this.sprite); this.game.camera.follow(this.sprite); var tiles = this.layer1.getTiles(0, 0, 2961, 2961); //I set all the tiles to alpha(0); for (var i = 0; i < tiles.length; i++) { tiles.alpha = 0; and this in the update: var tiles = this.layer1.getTiles(this.sprite.body.x - 20 , this.sprite.body.y - 20 , 80, 80);//I get all the tiles close to me and make them visible for (var i = 0; i < tiles.length; i++) { tiles.alpha = 1; } So this would work fine if the camera were always moving when the character does, but i think phaser don't look at the tiles when the camera isn't moving (since it doesn't need to in normal use of tiles).I tried to see if i could force the update of tiles at every loop but didn't find anything, could use some help, thx.ps: i use typescript.
  2. Hi I'got a problem with collision. After detected collision i modify the tile (witch are colide). Then my sprite stop moving. Working game: http://game1.leszniak.pl Please Help me.. /** * @module AIRPLANE * @version 0.1 */ function Airplane() {var game = Phaser.Game,map,coins,bomb,layer = undefined,sprite = undefined,cursors = undefined,CACTUS = 10 ; function run() {game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); } function preload () { game.load.tilemap('map', 'Maps/test.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('tmw_desert_spacing', 'tmw_desert_spacing.png'); game.load.image('phaser', 'arrow.png'); game.load.spritesheet('coin', 'coin.png', 32, 32); } function dropBomb(x,y){bomb = game.add.sprite(x, y, 'coin');bomb.anchor.setTo(0.5, 0.5);bomb.body.setRectangle(16, 16, 25, 15);bomb.rotation = Math.PI / 2;//bomb.body.maxAngular = 100; //bomb.body.angularDrag = 100; bomb.body.collideWorldBounds = true; bomb.animations.add('walk'); bomb.animations.play('walk', 20, true); } function create () { map = game.add.tilemap('map'); map.addTilesetImage('tmw_desert_spacing'); map.setCollisionBetween(1, 10); map.setTileIndexCallback(10, hitCoin, this); //map.setTileLocationCallback(2, 0, 1, 1, hitCoin, this); //map.replace(10, 11);//s,tile.tile.x, tile.tile.y); layer = map.createLayer('Tile Layer 1'); layer.resizeWorld(); sprite = game.add.sprite(0, 100, 'phaser'); sprite.anchor.setTo(0.5, 0.5); // console.log(sprite); // This adjusts the collision body size. sprite.body.setRectangle(16, 16, 25, 15); // We'll set a lower max angular velocity here to keep it from going totally nuts sprite.body.maxAngular = 100; // Apply a drag otherwise the sprite will just spin and never slow down sprite.body.angularDrag = 100; sprite.body.collideWorldBounds = true; // game.camera.follow(sprite); // cursors = game.input.keyboard.createCursorKeys(); jumpButton = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); dropBomb(100,0);} function hitCoin(sprite, tile) {console.log(tile);//map.replace(10, 11);//s,tile.tile.x, tile.tile.y);map.putTile(0, tile.tile.x, tile.tile.y, layer); //tile.tile.alpha = 0;//map.setTileIndexCallback(10, hitCoin, this); //tile.tile. // layer.dirty = true; return false; } function update() {game.physics.collide(sprite, layer);//game.physics.overlap(sprite, layer); game.physics.velocityFromAngle(sprite.angle, 30, sprite.body.velocity); if (bomb != undefined) game.physics.velocityFromAngle(bomb.angle, 30, bomb.body.velocity);} function render() { game.debug.renderPhysicsBody(sprite.body); } return {run:run,};}
×
×
  • Create New...