wareja

Members
  • Content Count

    3
  • Joined

  • Last visited

About wareja

  • Rank
    Newbie

Profile Information

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. hi, I've been using phaser for some time now but am having some issue with my game when I press the restart button. My game goes into an infinite loop and my player can't jump as high as he used to before. Its like as if gravity increased on the stage. and other objects disappear too like they go all the way down to the screen Can somebody tell me whats wrong here retry: function () { //this.clearCurrentState() this.levelSong.pause() this.winSong.pause() this.gameOverSong.pause() this.shutdown() this.game.state.start('Level2') }, shutdown:function() { this.game.world.removeAll() }, here is the link to my game (My problem is in level 2): https://exit-exitar.firebaseapp.com
  2. I just checked and my program does not go inside those two functions Also for "jumpButton", "left" and "right" variables I declared in my main.js file. I don't know if I'm having a keyboard ghosting problem coz I used WASD as the keys for moving but I had the same issue Can you help me? Thanks
  3. Hello I am new to phaser and I'm having a problem with my player who seems to not be able to jump left and right but can jump up and down when I just press the jump button. Can somebody help me? //-------------------player rendering------------------------------------- this.player = this.game.add.sprite(10, 282, 'exitar'); this.game.physics.arcade.enable(this.player, Phaser.Physics.ARCADE); this.player.body.gravity.y = 300; this.player.body.collideWorldBounds = true; this.player.anchor.setTo(0, 0); this.player.body.setSize(50, 100, 20, 0); this.game.camera.follow(this.player); this.player.animations.add('right', [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], 10, true); this.player.animations.add('left', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12], 10, true); this.player.animations.add('jump_left', [26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36], 7, true); this.player.animations.add('jump_right', [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47], 8, true); this.player.animations.add('win', [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65], 17, false); this.player.animations.add('still', [48, 49], 2, true); //-------------------cursor settings--------------------------------------- this.cursors = this.game.input.keyboard.createCursorKeys(); jumpButton = this.game.input.keyboard.addKey(Phaser.Keyboard.UP); left = this.game.input.keyboard.addKey(Phaser.Keyboard.LEFT); right = this.game.input.keyboard.addKey(Phaser.Keyboard.RIGHT); }, update: function () { this.game.physics.arcade.collide(this.player, this.groundLayer); this.game.physics.arcade.collide(this.player, this.stairsLayer); this.game.physics.arcade.collide(this.player, this.trash); //this.my_time(); if (state_direction) { if (left.isDown && this.player.body.blocked.down) { this.player.body.velocity.x = -100; this.player.animations.play('left'); } else if (right.isDown && this.player.body.blocked.down) { this.player.body.velocity.x = 100; this.player.animations.play('right'); } else if (jumpButton.isDown && left.isDown && this.player.body.blocked.down) { this.jumpLeft(); } else if (jumpButton.isDown && right.isDown && this.player.body.blocked.down) { this.jumpRight(); } else if (jumpButton.isDown && this.player.body.blocked.down) { this.jump(); } else if (this.game.physics.arcade.distanceToXY(this.player, 744, 510) < 92) { this.player.alpha = 0; this.train.animations.play('close') this.time.events.add(1000, this.go, this); } else { this.player.animations.play('still'); this.player.body.velocity.x = 0; } } }, jumpLeft: function () { state_direction = false; this.player.body.velocity.y = -200; this.player.body.velocity.x = -100 this.time.events.add(2000, this.my_time, this); this.player.animations.play('jump_left'); //state_direction = true; }, jumpRight: function () { state_direction = false; this.player.body.velocity.y = -200; this.player.body.velocity.x = 100; this.time.events.add(1900, this.my_time, this); this.player.animations.play('jump_right'); //state_direction = true; }, jump: function () { state_direction = false; this.player.body.velocity.y = -150; this.time.events.add(1900, this.my_time, this); //this.player.animations.play('jump_right'); },