View Single Post
  #5  
Old 05-30-2010, 12:04 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I should note that the functionality of the default sword is a bit of a special case. You can swing it regardless of whether your player is currently frozen, but only if your gani = sword. This means the checks should go before the movement functions and the check for the player being frozen.

PHP Code:
function onTimeout() {
  
CheckSword();
  if (
player.freezetime == -1Movement();

  
setTimer(0.05);
}

function 
CheckSword() {
  
// this.keyspressed[x] would be an array that tracks the keys pressed(0-9)
  // for situations like below, or else you'd end up being able to just hold down 'S'
  // for quick and repeated swings. That would be most undesirable :P
  
if (keydown(5)) {
    if (
this.keyspressed[5] == false) {
      if (
player.freezetime == -|| player.ani == "sword") {
        
setAni("sword",null);
        
freezeplayer(.25);
      }
      
this.keyspressed[5] = true;
    }
  } else 
this.keyspressed[5] = false;

Reply With Quote