joseym Posted February 18, 2014 Share Posted February 18, 2014 I'm new to phaser and really just trying to familiarize myself with it. I've got a sprite group moving across the screen from right to left and when it reaches certain locations I would like it to perform certain actions; for now I'm just having it log to the console.game.physics.collide(group, triggerWall, function(){ console.log('it hit the wall');}, null, this);The wall is an invisible sprite that 1px wide and 100% the height of the game. It logs to the console as expected (about 100x, due to the width of the group) The issue I'm having trouble with is there's a "jitter" when the group crosses the line. Each sprite in the group is moved a few pixels and then moves back. Heres how I've set up the sprites in the group:group = game.add.group();for (var i = 0; i < 5; i++){ var sprite; sprite = group.create(x, y, 'block', 1); sprite.name = 'block' + i; sprite.height = 30; sprite.width = 30; sprite.body.allowCollision = true; sprite.body.immovable = false;}and my "wall"triggerWall = game.add.sprite((game.world.width/2), 1, 'barrier'));triggerWall.name = 'triggerWall';triggerWall.scale.setTo(1, game.world.height);triggerWall.body.immovable = true;triggerWall.visible = false;So I'm wondering how to avoid the "jitter", or if there's a better way to detect the location of a sprite/group besides using a collision. Link to comment Share on other sites More sharing options...
joseym Posted February 18, 2014 Author Share Posted February 18, 2014 This may not be the best solution but I managed to get past the "jitter" withtriggerWall.body.checkCollision.left = false;triggerWall.body.checkCollision.right = false;If not the proper solution, please advise Link to comment Share on other sites More sharing options...
joseym Posted February 22, 2014 Author Share Posted February 22, 2014 Nope, not a good solution - unreliable. Help would be fantastic. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts