Players can only move the character directly, who is then sliding infinitely, until at reaches an obstacles or specific items (coins doesnt stop him for example !).
Crates can be pushed by the chararacter on a direction depending on which direction he is hitting them. In that case, if the player go DOWN, then it stoppes on the empty tile before the crate and this crate “takes” the move from the character and then go down until it reaches the small table. This is working as intended !
Crates also cant be pushed if they are blocked by objects (they are considered as walls).
I do have an issue with multi crates interaction (they are NOT considered as walls).
For examplce, if the character hit the middle crate from the left, he is supposed to be stopped (work as intended) and the middle is not supposed to move, because the spot on its right is already containing another crate. This part is not working as intended. Both crates move for some pixels on the right.
Is there a condition I could add to check the right spot after is empty if it needs to go right, if the top spot is empty if it needs to go up and so… ? Or any better ideas =p ?
The part you are quoting, is working as intended, sorry for the lack of precision.
Before trying what you have sugggested, I’ve tried to delete and puck back the crates (because it was actually working in another layout that I created after posting) and it works Oo
I really dont understand. Maybe the 2 crates were overlapping. But its strange, since I was using the stick to grid feature.
I wanted to try this but using raycast. You could cast a ray in the direction you want to move. Then move the player or crate in that direction and distance minus a grid space. My objects have the points in the center and the grid is 64x64. So, it’s really distance minus half player and half crate which is a whole grid since everything is equal.
I changed my methodology to use the raycasted object. So, X and Y are no longer needed.
I’m not completely clear on the object interactions but to create a chain reaction effect you could use an object boolean and some variables to hold the target coordinates or angle or something. I’m not sure. I’m tempted to use an array as a sort of buffer but for single interactions that would probably be overkill.
Thanks for your tips. I’ll give it a try if I decide to go for chain reaction. Right now, there is only the player who can push crates. They cant passe their move to each other. It’s much or easy for player to deal with and for me to design levels =p
yea its a common issue when checking collision with itself because of the picking list. this is because it can and must count itself in the checking.
is a single caisse picked before doing the checking? in that case, its only the caisse that is picked that will be checked for the condition. no other caisse will be taken into consideration.
to fix this, temporarely save the point to check inside a variable (could be a scene variable or a local one). then do pick all instances and do the checking:
or use a group whoose the same object is in the group (imagine caisse is in obj_group):
this works because group picking goes the same way as if it was another object. the picking of caisse doesnt transfer to the group, even though it is in it.
I’ve double checked my event, cause I dont understand why crates where correctly stopped when colliding with walls but not when colliding with other crates.
Crates are actually stopped after some pixels and then, can be repushed infinitiley (because they are moved away, and so, not colliding anymore right ?) pixels by pixels :
I first thought it was because crates move when pushed, but the one on the right is actually not moving.
So the only issue like you said is because checking an objet again the same object ? But then what is happening ? They are both move away and thats why they are both going to the right ?
But I might be wrong, since I have trouble correctly undestanding this whole thing =p
Cant I deal with this with an object variable, for crates, like “beingspushed”, so I that case, there is one crate with “beingpushed” = 1 at any time. Then I could check if the crate with variable = 1 is in collision with other crates and then, only move this one away ?