askariwa

Members
  • Content Count

    23
  • Joined

  • Last visited

About askariwa

  • Rank
    Member

Contact Methods

  • Twitter
    askariwa

Recent Profile Visitors

740 profile views
  1. askariwa

    Phaser Arcade Slopes Plugin

    Great work Hexus, i really like the sprite scale support, btw i think you meant May (not June 2017). Any thought about what you're thinking to add to the v0.3.0 ?
  2. Could anyone tell me why the p2 physics example don't collide with world bounds ? I have tried to add game.world.setBounds(0, 0, 1600, 1200) before game.physics.startSystem(Phaser.Physics.P2JS) but moving the player to the left keeps moving him out of the screen. :-( Updated : i had to add instead game.physics.p2.setBoundsToWorld(true, true, true, true, false); after "placing" the player sprite just as the example here http://phaser.io/examples/v2/p2-physics/tilemap :)
  3. askariwa

    Phaser Arcade Slopes Plugin

    Hi hexus, any thoughts about Circle body support ?
  4. askariwa

    Arcade physics circle body scale

    Thank you for your suggestion VitaZheltyakov, i saw that i had to modify the update function by adding this (the second line keeps the body centered on the sprite) sprite.body.setCircle(45*sprite.scale.x); sprite.anchor.set(0.5*(sprite.scale.x/2));
  5. askariwa

    Arcade physics circle body scale

    I tried to modify the Arcade physics Body scale example online this way : game.load.image('wizball', 'assets/sprites/wizball.png'); modifying the sprite in the create function like this: //sprite = game.add.sprite(200, 300, 'gameboy', 2); sprite = game.add.sprite(200, 300, 'wizball', 2); then adding this line after game.physics.enable : sprite.body.setCircle(45); and finally activating the debug in the render function game.debug.body(sprite); Why the circle body does not scale ? The only thing that scales is the sprite.
  6. askariwa

    Get tile value from a tilemap

    Hi,what do you mean by "certain location" ? if the coordinates are given in tile values then you have to get the tile using the getTile method, if they are in pixel values then use the getTileWorldXY method. After getting the tile, you can read its index property to get its type or its properties public property to get its "properties" (defined in Tiled) See this example for tile properties.
  7. askariwa

    Get Tile type (index?) clicked on a Tilemap ?

    Ok, it was my fault My map had too many layers and i was expecting results from the wrong layer. I should have tried to use a simple tilemap with just one level because getTileWorldXY works as advertised
  8. Hi, i am trying to get the type of a tile once clicked on but i get inconsistent results, i have made an example of my case here : http://jsfiddle.net/fkossyvas/7Lybhpda/ The code which displays the type is this one : this.currentTile = this.map.getTileWorldXY(pointer.worldX,pointer.worldY,32,32,this.layer); this.text1="pointer.worldX:"+pointer.worldX; this.text2="pointer.worldX:"+pointer.worldX; this.text3="currentTile index:"+this.currentTile.index; Any help ? Thank you
  9. I was using explosionsCollisionGroup after the code i've posted (i didn't wanted to make a long post) that's why but i just didn't saw missing the increment during the loop ! I am going to study your example, which seems to be exactly what i was trying to do. Thank you for sharing this stvrbbns and for your help
  10. I have finally defined the collision groups as i had to, at least i think var ship; var map; var layer; var cursors; var result; var tilesCollisionGroup; var shipCollisionGroup; var explosionsCollisionGroup; function create() { game.physics.startSystem(Phaser.Physics.P2JS); tilesCollisionGroup = game.physics.p2.createCollisionGroup(); shipCollisionGroup = game.physics.p2.createCollisionGroup(); explosionsCollisionGroup = game.physics.p2.createCollisionGroup(); ship = game.add.sprite(200, 200, 'ship'); game.physics.p2.enable([ship],true); ship.body.clearShapes(); ship.body.loadPolygon('physicsData', 'player'); ship.body.fixedRotation = false; ship.body.setCollisionGroup(shipCollisionGroup); ship.body.collides([tilesCollisionGroup]); game.camera.follow(ship); explosions = game.add.group(); explosions.enableBody = true; explosions.physicsBodyType = Phaser.Physics.P2JS; explosions.createMultiple(5, 'explosion'); explosionTouchSound = game.add.audio('explosionTouchSound'); map = game.add.tilemap('map'); map.addTilesetImage('ground_1x1'); map.addTilesetImage('walls_1x2'); map.addTilesetImage('tiles2'); layer = map.createLayer('Tile Layer 1'); layer.resizeWorld(); game.physics.p2.convertTilemap(map, layer); // ********* 1 : insert members of tilesCollisionGroup for (var i = 0; i < map.layer.bodies.length; i++) { var tileBody = map.layer.bodies; tileBody.setCollisionGroup(tilesCollisionGroup); tileBody.collides([shipCollisionGroup]); } // By default the ship will collide with the World bounds, // however because you have changed the size of the world (via layer.resizeWorld) to match the tilemap // you need to rebuild the physics world boundary as well. The following // line does that. The first 4 parameters control if you need a boundary on the left, right, top and bottom of your world. // The final parameter (false) controls if the boundary should use its own collision group or not. In this case we don't require // that, so it's set to false. But if you had custom collision groups set-up then you would need this set to true. game.physics.p2.setBoundsToWorld(true, true, true, true, false); // Even after the world boundary is set-up you can still toggle if the ship collides or not with this: // ship.body.collideWorldBounds = false; cursors = game.input.keyboard.createCursorKeys(); game.input.onTap.add(addexplosion, this); } Still, now the explosions do not collide with the tilemap but neither the ship does (even if i defined the collision between their collision groups). Any help?
  11. I am trying to modify the p2.js example (http://phaser.io/examples/v2/p2-physics/tilemap). I have added a group named explosions which i want to have it's members to collide with the ship but not with the tilemap. From what i've read in the forum, i need to use the collision groups but i cannot understand how (in this case). Using them for the ship is easy and think that using a loop could be ok for the explosions group but for the tilemap it's not that easy. I have read nearly all posts in this forum but i didn't find anything for this case. Any hint ? function preload() { game.load.tilemap('map', 'assets/tilemaps/maps/collision_test.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('ground_1x1', 'assets/tilemaps/tiles/ground_1x1.png'); game.load.image('walls_1x2', 'assets/tilemaps/tiles/walls_1x2.png'); game.load.image('tiles2', 'assets/tilemaps/tiles/tiles2.png'); game.load.image('ship', 'assets/sprites/player.png'); game.load.atlas('explosion', 'assets/atlas/explosions.png', 'assets/atlas/explosions.json'); } var ship; var map; var layer; var cursors; var result; var tilesCollisionGroup; var shipCollisionGroup; var explosionsCollisionGroup; function create() { game.physics.startSystem(Phaser.Physics.P2JS); tilesCollisionGroup = this.physics.p2.createCollisionGroup(); shipCollisionGroup = this.physics.p2.createCollisionGroup(); explosionsCollisionGroup = this.physics.p2.createCollisionGroup(); explosions = game.add.physicsGroup(Phaser.Physics.P2JS); explosions.createMultiple(5, 'explosion'); // explosions.body.setCollisionGroup(explosionsCollisionGroup); ? // explosions.body.collides([shipCollisionGroup]); ? map = game.add.tilemap('map'); map.addTilesetImage('ground_1x1'); map.addTilesetImage('walls_1x2'); map.addTilesetImage('tiles2'); layer = map.createLayer('Tile Layer 1'); layer.resizeWorld(); map.setCollisionBetween(1, 12); game.physics.p2.convertTilemap(map, layer); // how can i define tilesCollisionGroup ? ship = game.add.sprite(200, 200, 'ship'); game.physics.p2.enable([ship],true); ship.body.clearShapes(); ship.body.loadPolygon('physicsData', 'player'); ship.body.fixedRotation = false; ship.body.setCollisionGroup(shipCollisionGroup); ship.body.collides(tilesCollisionGroup); game.camera.follow(ship); game.physics.p2.setBoundsToWorld(true, true, true, true, false); cursors = game.input.keyboard.createCursorKeys(); game.input.onTap.add(addexplosion, this); }
  12. Thank you very much for your answer (and the good news ). I'll go to study the example right away.
  13. Is it possible to apply a shader (filter) to a spr├Čte, get the resulting image and "send it again to the shader" , ie apply the filter to the new image ? I have already asked this question at the Phaser forum (here) but i have got no answer, maybe it can't be done ?
  14. askariwa

    Refresh sprite.texture of a Filter ?

    I guess not
  15. askariwa

    Chrome not rendering the phaser canvas.

    It's fine for me too, Chrome on Android.