The_dude8080 Posted November 8, 2016 Share Posted November 8, 2016 Hey. I am using phaser arcade physics. I want to make many sprites acts as one. That means that when I press one of my cursor keys (that adds velocity) all of the sprites should be applied the same properties. I did that with a group that included all the sprites (they were about 100) and did a for each when clicked on a cursor to get each of the group children. However I think it was too slow because the sprites didn't actually move at the same (the code didn't seem to tweak fast enough). I can't add them to a "null" parent sprite because I don't want them to get fixed-in-place positions related to the parent. I want them to freely interact with each other as individual sprites but the movement should be applied to all of them when cursor keys are clicked. Any idea on how to do this? Thank you Link to comment Share on other sites More sharing options...
drhayes Posted November 9, 2016 Share Posted November 9, 2016 When you say "I think it was too slow" what does that mean? Setting the velocity on each sprite individually is what Phaser would do under the covers, there's not magic available to it that isn't also available to you. If you set their velocities in a single function then all their velocities were set at the same time, full stop. Nothing can run in between when you set the velocity of one sprite and when you set another. Link to comment Share on other sites More sharing options...
The_dude8080 Posted November 9, 2016 Author Share Posted November 9, 2016 1 hour ago, drhayes said: When you say "I think it was too slow" what does that mean? Setting the velocity on each sprite individually is what Phaser would do under the covers, there's not magic available to it that isn't also available to you. If you set their velocities in a single function then all their velocities were set at the same time, full stop. Nothing can run in between when you set the velocity of one sprite and when you set another. Yeah you are right. Wasn't think clearly at the time. Related to this I am facing this problem... Well when you change sprites velocity to big values and they collide in a small space they will start bouncing and getting bugged all over the place. One of the things I would like to be able to do is to make multiple sprites not overlap with each other like really rigid bodies even if they collide at really high speeds. Can you help me with this? Link to comment Share on other sites More sharing options...
drhayes Posted November 10, 2016 Share Posted November 10, 2016 Arcade physics isn't so great at the rigid body thing, especially around getting things to believably stack and not be weird about it. One thing you could try is calling the physics routines multiple times per update... but if things are moving at high speeds then they're gonna bounce in big ways. I wish I could help more! The_dude8080 1 Link to comment Share on other sites More sharing options...
The_dude8080 Posted November 10, 2016 Author Share Posted November 10, 2016 21 minutes ago, drhayes said: Arcade physics isn't so great at the rigid body thing, especially around getting things to believably stack and not be weird about it. One thing you could try is calling the physics routines multiple times per update... but if things are moving at high speeds then they're gonna bounce in big ways. I wish I could help more! I see. That already clarifies some things Thank you Link to comment Share on other sites More sharing options...
Recommended Posts