1ipt0n Posted May 11, 2015 Share Posted May 11, 2015 hi,I'm having some odd behaviour.I made simple particle emiter for blood. and it's working awesome...in top half part of the map..no idea why.my code:function bloodEmiter(px,py){ for(var x=0; x<100; x++){ var drop = game.add.sprite(px, py,'bloodTexture'); game.physics.p2.enable(drop); drop.body.setCollisionGroup(bloodGroup); drop.body.collides([tilesGroup, bloodGroup]); drop.body.velocity.y = game.rnd.integerInRange(-100, -500); //drop.body.velocity.x = game.rnd.integerInRange(-14, 14); drop.lifetime=game.rnd.integerInRange(100, 300); drop.update = function(){ this.lifetime--; if(this.lifetime==30) game.add.tween(this).to({alpha: 0},1000).start(); if(this.lifetime<0) this.destroy(true); } }}bloodTexture is just 1x1 red pixel...but to the point: my map height = 900. iff i use my blodEmiter on y < 640 it looks like this: if I use my emiter on y>=640 this is the effect: there are no other differences than y position..... so why? Please help. Link to comment Share on other sites More sharing options...
XekeDeath Posted May 11, 2015 Share Posted May 11, 2015 Only thing I can think of is maybe there is something else affecting your blood drops...Aside from the dual if statements instead of else if, or an onComplete handler instead to deal with killing drops, the code looks fine to me... Your not strangely twisting gravity or something above 640...? Link to comment Share on other sites More sharing options...
1ipt0n Posted May 12, 2015 Author Share Posted May 12, 2015 this.physics.p2.stiffness=100000000; this.physics.p2.friction =1.9; this.physics.p2.gravity.y = 600; Link to comment Share on other sites More sharing options...
schteppe Posted May 12, 2015 Share Posted May 12, 2015 Very odd!Does the same thing if you turn off blood/tile collision?What if you try spreading out the particles a bit when creating them?If you change the collision shape of the blod particles? Link to comment Share on other sites More sharing options...
1ipt0n Posted May 14, 2015 Author Share Posted May 14, 2015 Does the same thing if you turn off blood/tile collision?- no, only when blood tiles collide with each other What if you try spreading out the particles a bit when creating them? - same effect If you change the collision shape of the blod particles? - emm.. how? Link to comment Share on other sites More sharing options...
schteppe Posted May 14, 2015 Share Posted May 14, 2015 From the p2 body debug example (http://phaser.io/examples/v2/p2-physics/body-debug):wizball.body.setCircle(45);By the way, turning on debug rendering for all your physics sprites is probably useful! I still have no idea why you get that strange behaviour :/ Link to comment Share on other sites More sharing options...
Recommended Posts