ltruelove Posted March 27, 2014 Share Posted March 27, 2014 I just updated to 2.0.1 and I'm getting some really strange behavior. In the example I've posted below, the sprite that I'm adding goes flying off the screen the second it's loaded. If I take out the line that enables physics for the sprite it stays in place, but obviously that's not very useful. In another project I'm working on, if I use cursor keys to control my character to go left after pressing the left arrow key, they go flying left across the screen even if I set velocity.x = 0. That's an issue for a different post though because the code to show that project is too big to paste. Here's the simplified enough version:<!DOCTYPE HTML><html><head> <title>Test!!!</title> <script src="pkg/phaser.js"></script></head><body > <script type="text/javascript"> var game = new Phaser.Game(600,720, Phaser.CANVAS, 'test', { preload: preload, create: create, update: update, render: render }); var arrowSprite = null; function preload() { game.stage.backgroundColor = '#0072bc'; game.stage.scale.maxWidth = 600; game.stage.scale.maxHeight = 720; game.load.atlasJSONHash('sprites', 'sprites.png', 'sprites.json'); } function create() { game.physics.startSystem(Phaser.Physics.ARCADE); arrowSprite = game.add.sprite(game.world.centerX,585,'sprites','arrow'); game.physics.enable(arrowSprite, Phaser.Physics.ARCADE); arrowSprite.pivot.x = 135; arrowSprite.pivot.y = 15; arrowSprite.rotation = 1.57; } function update(){ arrowSprite.body.velocity.x = 0; arrowSprite.body.velocity.y = 0; } function render(){ } </script> </body></html> Link to comment Share on other sites More sharing options...
drhayes Posted March 27, 2014 Share Posted March 27, 2014 Sounds like we're having the same problem: http://www.html5gamedevs.com/topic/5103-sprite-with-negative-scale-falls-through-tilemap/ You could check to see if upgrading to the dev branch fixes your problem? I haven't had a chance to check with mine yet. If so, I think we wait for the 2.0.2 release. ( = Link to comment Share on other sites More sharing options...
temporalix Posted March 27, 2014 Share Posted March 27, 2014 I have the same problem in this topic: http://www.html5gamedevs.com/topic/5071-why-does-a-sprite-move-down-once-physics-is-enabled/ , i have a ball rotating around a sprite, before enabling physics, i can set the pivot and it rotates nicely around the sprite and i can change this pivot which causes the ball to rotate in a larger circle around the sprite, after enabling physics, the balls flies completely off course in a wider circle, and changing the pivot makes it worse. It seems like pivot before and after physics are completely different methods, I've ended up using sprite's base method Overlap to check for some basic collisions until this gets fixed in a later version. Link to comment Share on other sites More sharing options...
Willyfrog Posted March 27, 2014 Share Posted March 27, 2014 try modifiying it inside the update (probably not what you want, but for testing purposes) and if your issue is the same as http://www.html5gamedevs.com/topic/5158-animation-not-played-in-phaser-201/ it should work correctly Link to comment Share on other sites More sharing options...
ltruelove Posted March 27, 2014 Author Share Posted March 27, 2014 Do you mean setting its x and y coordinates in update? I've tried that and it just flickers like it's trying to fly away but I won't let it. Link to comment Share on other sites More sharing options...
adamyall Posted March 27, 2014 Share Posted March 27, 2014 Set your pivots, rotations (and anchors) before enabling physics and see if that helps. I am having "flying sprite" issues as well, but I just started with 2.0.1. Link to comment Share on other sites More sharing options...
rich Posted March 27, 2014 Share Posted March 27, 2014 Just to say that I've been working through this for a few days now. I've fixed most of the causes, but still am stuck in the best way to resolve what happens if you change a body position during an input event. Keep an eye on the dev branch for details. Link to comment Share on other sites More sharing options...
rich Posted March 28, 2014 Share Posted March 28, 2014 Ok I've just pushed 2.0.2 live. Please upgrade to this if you're affected by any of the ArcadePhysics related issues described above. Link to comment Share on other sites More sharing options...
small fish Posted March 28, 2014 Share Posted March 28, 2014 I had the same problem. I fixed it by using, sprite.body.x for physics sprites. Still no luck with the emitter though, just tryed it with 2.0.2. I will try and expand the issue further in my post. Link to comment Share on other sites More sharing options...
rich Posted March 28, 2014 Share Posted March 28, 2014 What's the problem with the emitter? Link to comment Share on other sites More sharing options...
ltruelove Posted March 28, 2014 Author Share Posted March 28, 2014 Thank you!!! Link to comment Share on other sites More sharing options...
Recommended Posts