Posted By: xbox
elevator problem - 04/28/11 21:46
Hi all, I am trying to create a simple elevator to lift my player up to the next level. I have a mock up code to do this.
What happens is, my elevator poses as a "wall", when I change variable to 1, it lowers to the ground, I walk onto it, change the variable to 0, and instead of taking the player up, the player just passes right through the block as it moves up leaving me still on the first floor.
If I hold down the space bar to continually jump however, I am able to ride the elevator up. How can I fix this so I don't have to jump?
Code:
Entity* elev; var operate = 0; action elevator { elev = my; while(1) { if(operate == 1) { while (my.z > -72) { my. z -= 2* time; wait(1); } } if(operate == 0) { while (my.z < 72) { my.z += 2 * time; wait(1); } } wait(1); } }
If I hold down the space bar to continually jump however, I am able to ride the elevator up. How can I fix this so I don't have to jump?