How do you make an object impossable to walk through, but still able to climb on? I'm making a platformer game (sort of) and I want crates that the guy can climb on and jump between etc. Thanks!
Offline
I've never tried something quite like that and don't have access to Scratch at the moment, but try this:
when gf clicked set [yvel v] to (0) forever change [yvel v] by (-0.2) // gravity change y by (yvel) if<touching [any solid objects v]?> set [yvel v] to ((yvel)/(-2)) change y by (yvel) if<touching [any solid objects v]?> change y by (yvel) end if<<key [up arrow v] pressed?> and <(yvel) > (0)>> set [yvel v] to (5) // jump end if<key [right arrow v] pressed?> change x by (2) if<touching [any climbable objects v]?> change x by (-2) change y by (2) set [yvel v] to (0) else if<touching [any solid objects v]?> change x by (-2) end end if<key [left arrow v] pressed?> change x by (-2) if<touching [any climbable objects v]?> change x by (2) change y by (2) set [yvel v] to (0) else if<touching [any solid objects v]?> change x by (2) end end
Offline