View Single Post
  #4  
Old 05-03-2009, 12:41 PM
Raelyn Raelyn is offline
the Professional.
Raelyn's Avatar
Join Date: Sep 2003
Location: Zormite
Posts: 964
Raelyn will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
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(codekeychar) {
  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;
      }
   }

__________________
*Don't let the door hit you on the way out.*

Last edited by Raelyn; 05-03-2009 at 02:05 PM..
Reply With Quote