Bounce on Certain Wall

Not sure why this is happening, and this might be a dumb question once I realize the answer, but why won’t the sprite change direction when it hits only the side walls? I also didn’t look too far into it, but I don’t see why my code isn’t working. Just trying to find something other than the “bounce on walls”:

This is for my Corporation submission

4 Likes

I added this:

When a sprite hits a wall, it stops moving, so if you do this:

The sprite is already stopped so it won’t do anything.

At least I think so.

1 Like

Can’t you just say:

Psuedocode:
if block hit wall left: velocity = negative

if block hit wall right: velocity = positive

1 Like

When they hit the wall their speed VX is 0 so 0*-1=0.

I think.

1 Like

Ah!! I feel kind of dumb now :tired_face:
Yeah, that makes sense now. I’ll do @BitBot’s idea and just set their velocity again.

Thanks for y’all’s help guys!

1 Like