I am trying to make a treasure chest on one tile in my game and you cant go on that tile unless you have the key.
So basically I need something that looks like this
and I need the python script to go something like: when it is touching make the up arrow to DLoc=0 that way when I am sitting on that tile I can’t go forwards, It would be cool if the script would be easy to read because then I can adapt it to different situations. Thanks.
while you wait for a python guru to answer, I’ll try to show you how to do it
with Logic Bricks
There’s different ways of course, here’s one:
you can protect the treasure tile with an “invisible” wall/cube and when the player
have the key just move the wall/cube with an IPO
The second request I don’t understand it well, so:
add a “boolean” property to the object that uses the “up arrow” sensor ( the player probably) with FALSE enabled.
Then use a “Expression” ( or replace the AND) controller with “Exp:nameofbooleanpropertyhere == TRUE”, linked to the motion actuator
Now you must change this boolean property when the palyer is in the tile to “TRUE”…easy probably with collision Sensor
When I am on the tile that is supposed to disable the up arrow it would make the boolean property false, there I would not have any space to put an up arrow keyboard sensor that has no DLoc. Do you know what I am saying?