Pepa489 Posted October 18, 2015 Share Posted October 18, 2015 Hello,I must have two immovable sprites colliding(eg. two players in multiplayer game). How do I do that? Link to comment Share on other sites More sharing options...
bruno_ Posted October 18, 2015 Share Posted October 18, 2015 If they don't move how are they suppose to collide?Or are you using arcade physics and want to set the bounce on both to 0? Link to comment Share on other sites More sharing options...
Pepa489 Posted October 18, 2015 Author Share Posted October 18, 2015 If they don't move how are they suppose to collide?Or are you using arcade physics and want to set the bounce on both to 0?Image: https://ctrlv.cz/2h3nI creating game like age of war and i creating units with diffent speed. I have problem on image Link to comment Share on other sites More sharing options...
bruno_ Posted October 18, 2015 Share Posted October 18, 2015 If you are using the Collide method, try using process callback (see the docs) to set both speeds there. Return true or false in that callback according to what you need. Link to comment Share on other sites More sharing options...
Pepa489 Posted October 18, 2015 Author Share Posted October 18, 2015 If you are using the Collide method, try using process callback (see the docs) to set both speeds there. Return true or false in that callback according to what you need.What other options would you suggest? I need refresh speed after kill second unit Link to comment Share on other sites More sharing options...
bruno_ Posted October 18, 2015 Share Posted October 18, 2015 How do you kill him? Maybe using the onkilled event or in the update itself Link to comment Share on other sites More sharing options...
AzraelTycka Posted October 18, 2015 Share Posted October 18, 2015 Hello, can you describe your problem a bit more? So far I don't understand what is on the picture, could you describe by word what exactly are you trying to achieve (describe the situation you are currently having a problem with please)? Also, why are your players set as immovable? Link to comment Share on other sites More sharing options...
Pepa489 Posted October 20, 2015 Author Share Posted October 20, 2015 Hello, can you describe your problem a bit more? So far I don't understand what is on the picture, could you describe by word what exactly are you trying to achieve (describe the situation you are currently having a problem with please)? Also, why are your players set as immovable?Hello,I set players to immovable, because i need remove "pushing effect" between units. How can I remove the pushing effect? Link to comment Share on other sites More sharing options...
AzraelTycka Posted October 20, 2015 Share Posted October 20, 2015 Well I would suggest creating a custom function for your collision. But I guess you could go with some more simple approach - thought maybe not so nice for you as a programmer ;-).Because we don't know how you handle assignement of velocities and processing of other things I'll just illustrate an example and you adjust it to whatever you need.// warning: following is just a pseudo-code!var A, B // your players, not immovableif (A collides with { var velocity = max(A.body.velocity, B.body.velocity); A.velocity = velocity; B.velocity = velocity;}else{ // here set velocities to your objects as you regularly do}Well it's not the nicest method but your objects will move in a same direction with the same speed, just adjust it to whatever suits your needs (if you don't want the objects to seem pushing perhaps use min instead of max function or whatever suits your desires - you haven't given much information so I still don't know what exactly are you doing :-)). Don't forget to se bounce to zero on your objects. Link to comment Share on other sites More sharing options...
Skeptron Posted October 21, 2015 Share Posted October 21, 2015 Maybe you could do something like Starcraft : the units do "push" each other when they collide (and you can use it as a gameplay feature), or you can press h (for hold), and then they are immovable and can't be moved. The player will have to smartly use one or the other. Link to comment Share on other sites More sharing options...
Recommended Posts