Search the Community
Showing results for tags 'deceleration'.
-
Hi everyone, I'm a newbie and I'm having troubles tweaking a game (currently using Phaser format offline on Atom). 1) My player is expected to jump lower and lower as he gets stars along the way, so I'm guessing a kind of deceleration but concerning gravity. 2) He should start flying when he eats a mushroom (gravity here too?). Before getting the mushroom he jumps with the space bar but then he is supposed to start flying by pressing the up cursor. Are there any commands/ codes that could help me with that? I bet it has an easy solution but I can't figure it out. Thank you very much to whoever may respond! xoxo
-
- deceleration
- jumping
-
(and 1 more)
Tagged with:
-
I am trying to create a little game but i have this problem (for now ) : At the "create" state i define this.collisionCircle = new Phaser.Circle(0,0,2);this.playerRectangle = new Phaser.Rectangle (0,0,0,0);this.player = game.add.sprite(game.world.centerX, game.world.height-80,'player');game.physics.arcade.enable(this.player);this.player.body.drag.set(550);this.circleCenter = new Phaser.Point(0,0);this.PointToGo = new Phaser.Point(0,0);At the "update" step i havecollisionCircle.setTo(mycircle.center_x,mycircle.center_y,50);if ((Phaser.Circle.intersectsRectangle(collisionCircle,playerRectangle)) && (touchesPlayerAlready==false)){ touchesPlayerAlready=true; circleCenter.setTo(mycircle.center_x,mycircle.center_y); PointToGo=Phaser.Point.rotate(circleCenter, playerRectangle.centerX, playerRectangle.centerY, 180, true); game.physics.arcade.accelerateToXY(player,PointToGo.x,PointToGo.y,20)} What i am trying to do is using the circular sprite to "push" the player sprite. I define the coordinates of PointToGo as the diametrically opposite point of the circle center using the player sprite coordinates as the middle point of the rotation. My problem is that, even setting the Drag property of player, the player sprite after the first intersection with the circular sprite does not decreases it's velocity but it always ends it's movement at the "borders" of the game (defined with a tilemap). What i want to do is simulate a real-life push, something that at the beginning has an acceleration, caused by a force, but needs to have a deceleration of it's velocity caused by friction. Maybe i am doing it wrong here by using the accelerateToXY method but i cannot find something like applyForce in arcade physics. Can anyone help me with this ?