Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Immovable sprites


Pepa489
 Share

Recommended Posts

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

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...