M
MuddyMuddy
Guest
Hi - I have two blocks moving at a speed of 1 toward each other.
One at a speed of 1 and the other -1 (x += dir)
I am trying to make them bounce off each other (reverse direction) with the following code:
Except the first object to hit will change direction, meaning the second one will stay the same direction because the first is no longer colliding (so they both end up going the same way, next to each other).
Any ideas on how I can solve this?
One at a speed of 1 and the other -1 (x += dir)
I am trying to make them bounce off each other (reverse direction) with the following code:
Code:
if place_meeting(x+dir,y,o_solid){
if dir = -1{dir = 1;}else{dir = 1;}
}
x += dir;
Any ideas on how I can solve this?