Mohammed Salman

  • Content count

  • Joined

  • Last visited

  1. Mouse is down for moble

    it worked thanks:)
  2. Mouse is down for moble

    I have been looking for a solution for a while now! the idea is to move the zombies to the point i hold the mouse in and stop when i release the mouse, this is my movement code: //check mouse down if (game.input.mousePointer.isDown) { //move all zombies zombies.forEach(function(zombie) { game.physics.arcade.moveToPointer(zombie, 400); //if in box reset velocity if ( Phaser.Rectangle.contains( zombie.body, game.input.x, game.input.y ) ) { zombie.body.velocity.setTo(0, 0); } //end if }, this); //end forEach } else { zombies.forEach(function(zombie) { zombie.body.velocity.setTo(0, 0); }, this); //end forEach } //end else if ( > nextFire) { fire(); } basically what i want is to check for the same input in mobile devices, i have tried using: game.input.onDown.add(move , this); but it didn't work well for me because the zombies kept on going on that direction forever. please help:( this is the full code:
  3. Tilemap issue

    thanks, i solved the problem. it turned out that i loaded the wrong json file:) I have another question do you know how to add physics to specific tiles?
  4. Tilemap issue

    Hey guys I'm new to Phaser, I looked on Youtube and phaser examples for answers but didn't find any helpful one. I get this error on the console TypeError: location is undefined[Learn More] phaser.js:97736:25 getIndex getTilesetIndex addTilesetImage create loadComplete finishedLoading processLoadQueue asyncComplete fileComplete loadImageTag/ Here is my code: var game = new Phaser.Game(500, 400, Phaser.AUTO, "", { preload: preload, create: create, update: update }); function preload() { game.load.spritesheet( "marioSmall", "assets/images/marioSmall.png", 34, 34, 6, 1 ); game.load.image("ground", "assets/images/ground.png"); game.load.tilemap( "map_01", "assets/tileset_json.json", null, Phaser.Tilemap.TILED_JSON ); game.load.image("tiles", "/assets/items.png"); } var mario; var ground; var map; var layer; function create() { // ground = game.add.sprite(0, 370, "ground"); // game.physics.arcade.enable(ground); // ground.body.immovable = true; // mario = new Mario(100, 100, 2000, 800, 200); map = game.add.tilemap("map_01"); map.addTilesetImage("items", "tiles"); layer = map.createLayer("Tile Layer 1"); } function update() { // game.physics.arcade.collide(ground, mario.sprite); // mario.checkInput(); }
  5. Flappy Rock, My first game in phaser:)

    Thanks, i changed it:)
  6. Flappy Rock, My first game in phaser:)

    Play the game