Door Open

Blitz3D Forums/Blitz3D Beginners Area/Door Open

I think it is the function doorup() that is not in order.
It is difficult to try this program without any media (models, textures etc.), but in the doorup() function, I wouldn't expect a FOR..NEXT.
The trouble here is, that the function only runs once. It opens the entire door at once, without redrawing the game.
Either use RenderWorld() and Flip() in the function (not recommended, because the rest of the game stops) or figure out how to use flags:
Say, when a key is pressed, (keyhit(something)), a "flag" is set. A flag is a global variable that can be for instance 1 or 0.
When the flag is 1, the door moves up, when the flag is zero, the door stands still.
The flag-checking and door-moving should take place in the main loop. "if flag = 1 then move door"
This would be the way to get it working:
(1) program starts, flag = zero, door doesn't move
(2) key is pressed, flag becomes one, makes the door move
(3) door hits end position, flag resets to zero again.
By expanding/adjusting this method, you can make the door open up while the game keeps on running.