Hey all
I am trying to make something happen when the user presses a key, and only for that room. I got the code and the claim event, but apparentely I need to include a function or something (the index wasn't clear): on_key_press. how do I create a code that only works for that room? I tried:
if(keycode == eKeyRightArrow){
cEgo.Walk(cEgo.x - 40, cEgo, eBlock, eWalkableAreas);
ClaimEvent();
}
, but it didn't recognize 'keycode'
thanks
Try:
if (IsKeyPressed(377) == 1){
cEgo.Walk(cEgo.x - 40, cEgo, eBlock, eWalkableAreas);
ClaimEvent();
}
377 is the ASCII-code for the right arrow. The Code table can be found in the manual.
But is the player supposed to go to the left when the player uses the right arrow key?
cool, thanks!
function on_key_press(eKeyCode keycode) {
if(keycode == eKeyRightArrow){
cEgo.Walk(cEgo.x - 40, cEgo, eBlock, eWalkableAreas);
ClaimEvent();
}
}
Should work just fine... And IsKeyPressed AKAIK is basically used for rep_exec events.
~Trent