Quote:
Originally Posted by cbk1994
onKeyPressed is called on default. Basically all of the event if's were converted to "function onEvent", such as "onPlayerTouchsMe", "onCreated", and "onPlayerEnters". There's no need for the if (keypressed) statement.
|
Ok, sorry to ask this again, but I am still having problems with this.. I am trying to use the GS2 solution and it's not working (I'm probably doing it wrong.)
Here is what I got..
PHP Code:
function onKeyPressed(code, key, char) {
if (key == "i") {
temp.img = findImg(209);
img.visible = ! img.visible;
}
}
I have a function doing showimg 209, and trying to use the code snippet you suggested on key i, the image remains shown, and is not hid, as expected.
Is there a way in GS1 to do this?
PHP Code:
if (keypressed) {
if (strequals(#p(1),I)){
if (img 209 is visible){
hideimg 209;
} else {
showimg 209,file,x,y;
}
}
}