Thread: Speed Sandals
View Single Post
  #2  
Old 09-24-2011, 07:15 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
If the boots are turned off you should stop the timeout, there's no reason to keep it running every 0.05 seconds (even if it's not doing anything except constantly hiding the images). You can also use hideimgs(200, 201) to hide a range of images.

Something like this:
PHP Code:
function onKeyPressed(temp.codetemp.key) {
  if (
temp.key == "z") {
    
this.on = ! this.on// better to use booleans instead of integers for clarity
    
    
if (this.on) {
      
this.ShowingImage();
      
this.trigger("timeOut"); // this.setTimer(0.05) or this.onTimeOut() is also acceptable
    
} else {
      
this.HidingImage();
      
this.setTimer(0);
    }
  } else if (
temp.key == "=") {
    
// etc
  
}

You might also want to only show the images once (when the boots are turned on), and redraw them only when the screen resizes. You can then do

PHP Code:
findImg(201).text "Speed: " this.speed
after changing the boot speed.
__________________
Reply With Quote