BGE question.

I have applied movement to a cube with apply.movment([0,1,0], True).

How can I stop it if is near a cylinder that is timed to flick from 5 to 5 seconds, and after to continue?

Let's consider the cylinder a barrier.


Do you mean gameplay stop? If yes make a variable.give it a name like gameplay. now make that variable True to make it boolean

import bge
cont = bge.logic.getCurrentController()
own = cont.owner
w_key = cont.sensors["w_key"] # This is to get the keyboard sensor

#The gameplay variable make it playable or not:
gameplay = True

if gameplay == True and w_key.positive:
    apply.movment([0,1,0], True)
elif gameplay == False and w_key.positive:
    print("You can't move!")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.