Search the Community
Showing results for tags 'phaser 2.3.0'.
-
I'm having a problem in my game that i cant make my player jump when he is on an platform. Can anyone help me, here is the code (i dont know what part is wrong so i'll put the full code) Ps: I'm using phaser 2.3.0, and i dont speak english very well, so sorry if i write something wrong. game.physics.startSystem(Phaser.Physics.ARCADE); game.stage.backgroundColor = '#000000'; game.world.setBounds(0, 0, 4000, 400); campo = game.add.tileSprite(0, 0, 4000, 400, 'fundo'); cursors = game.input.keyboard.createCursorKeys(); jumpButton = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); game.physics.arcade.gravity.y = 100; player = game.add.sprite(100,300 , 'boneco'); game.physics.arcade.enable(player) player.body.collideWorldBounds =true; player.animations.add('frente' , [0,1,2], 4); player.animations.add('tras' , [3,4,5], 4); player.animations.add('puloe' , [6]); player.animations.add('pulod' , [7]); player.animations.add('parado' , [8]); game.camera.follow(player); platforms = this.add.physicsGroup();platforms.create(50, 350, 'terra');platforms.create(200, 180, 'terra');platforms.create(400, 296, 'terra');platforms.create(600, 412, 'terra');platforms.setAll('body.allowGravity', false);platforms.setAll('body.immovable', true);platforms.setAll('body.velocity.x', 0)platforms.setAll('body.velocity.y', 0)platforms.setAll('body.collideWorldBounds', true); }, update: function () { player.body.bounce.y = 0.2; player.body.gravity.y = 200; player.body.velocity.x = 0; if (cursors.left.isDown) {player.body.velocity.x = -150; if (facing != 'left') { player.animations.play('tras'); facing = 'left'; }} else if (cursors.right.isDown) {player.body.velocity.x = 150; if (facing != 'right') { player.animations.play('frente'); facing = 'right'; } } else {if (facing != 'idle') {player.animations.play('parado'); facing = 'idle';}} if (jumpButton.isDown && player.body.onFloor() && game.time.now > jumpTimer) { player.body.velocity.y = -250; jumpTimer = game.time.now + 750;} if (jumpButton.isDown && player.body.onFloor() && game.time.now > jumpTimer) { player.body.velocity.y = -250; jumpTimer = game.time.now + 750;} game.physics.arcade.collide(platforms, player)
-
Hello, I'm seeing that the physics.arcade.collide between a sprite and a group fires more than once (2-3 times) each time the sprite collides with a group member (the callback says it is the correct and same group member). Is this normal in the new version? Mind that I'm killing and removing the group member the first time of the collision but the next 2-3 times happen anyways. Can anyone confirm that this is happening and whether or not this is normal? Thanks!