All pastes #487826 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-05-14 17:50 UTC
rendered paste body
menu * {
  .cross the street:{
    /new2
    .timer 1 1 .timerenemy -m 0 50 /enemy
  }
}
alias new2 {
  window -pdk0 +fxnbt @Cross
  clear @cross
  /drawdot @cross 03 1000 1 1
  /drawline @cross 15 120 1 132 850 132
  /drawline @cross 15 120 1 347 850 347
  /drawline @cross 8 10 1 132 850 132
  /drawline @cross 8 10 1 347 850 347
  /drawdot @cross 12 20 380 500
  set %.x 380
  set %.y 500
}
alias new {
  window -pdk0 +fxnbt @Cross
  clear @cross
  /drawdot @cross 03 1000 1 1
  /drawline @cross 15 120 1 132 850 132
  /drawline @cross 15 120 1 347 850 347
  /drawline @cross 8 10 1 132 850 132
  /drawline @cross 8 10 1 347 850 347
}
menu @cross {
  mouse: echo mouse moved $mouse.x $mouse.y
  sclick {
    if (%gameover) { 
      /new2
    }
  }
}
alias enemy {
  if (!%gameover) {
    /drawline @cross 7 30 1 315 51 315
    /drawline @cross 7 30 101 315 151 315
    /drawline @cross 7 30 201 315 251 315
    /drawline @cross 7 30 301 315 351 315
    /drawline @cross 7 30 401 315 451 315
    /drawline @cross 7 30 501 315 551 315
    /drawline @cross 7 30 601 315 651 315
    /drawline @cross 7 30 701 315 751 315
    /drawline @cross 7 30 801 315 851 315
    if (%rr > 850) {
      set %rr 1
      set %r 31
    }
    if (!%rr) { set %rr 1 }
    if (!%r) { set %r 31 }
    if ((%rr) && (%r)) {
      /drawline @cross 15 30 %rr 380 %r 380
      inc %rr 10
      inc %r 10
      /drawline @cross 7 30 %rr 380 %r 380 
    }
    if (%tt > 850) {
      unset %tt 1
      unset %t 31
    }
    if (!%tt) { set %tt 101 }
    if (!%t) { set %t 131 }
    if ((%tt) && (%t)) {
      /drawline @cross 15 30 %tt 380 %t 380
      inc %tt 10
      inc %t 10
      /drawline @cross 7 30 %tt 380 %t 380 
    }
    if (%vv > 850) {
      set %vv 1
      set %v 31
    }
    if (!%vv) { set %vv 201 }
    if (!%v) { set %v 231 }
    if ((%vv) && (%v)) {
      /drawline @cross 15 30 %vv 380 %v 380
      inc %vv 10
      inc %v 10
      /drawline @cross 7 30 %vv 380 %v 380 
    }
  }
}
on *:keydown:@cross:37,38,39,40:{ 
  if (%gameover) { window -c @cross
    //echo -a The game was over nub
    halt
  }
  if ($keyval == 37) {
    if (%.y isnum 286-407) || (%.y isnum 75-193) {
      set %color 15
    }
    if (%.y !isnum 286-407) || (%.y !isnum 75-193) { set %color 03 
    }
    drawdot @cross %color 20 %.x %.y
    Set %.x $calc(%.x - 15) 
    drawdot @cross 12 20 %.x %.y
  }
  if ($keyval == 38) {
    if (%.y isnum 286-407) || (%.y isnum 75-193) {
      set %color 15
    }
    if (%.y !isnum 286-407) || (%.y !isnum 75-193) { set %color 03 
    }
    drawdot @cross %color 20 %.x %.y
    set %.y $calc(%.y - 15)
    drawdot @cross 12 20 %.x %.y
  }
  if ($keyval == 39) { 
    if (%.y isnum 286-407) || (%.y isnum 75-193) {
      set %color 15
    }
    if (%.y !isnum 286-407) || (%.y !isnum 75-193) { set %color 03 
    }
    drawdot @cross %color 20 %.x %.y
    set %.x $calc(%.x + 15)
    drawdot @cross 12 20 %.x %.y
  }
  if ($keyval == 40) {
    if (%.y isnum 286-407) || (%.y isnum 75-193) {
      set %color 15
    }
    if (%.y !isnum 286-407) || (%.y !isnum 75-193) { set %color 03 
    }
    drawdot @cross %color 20 %.x %.y
    set %.y $calc(%.y + 15) 
    drawdot @cross 12 20 %.x %.y
  }
  if (%col == 225) {  
    /drawtext @cross 4 370 250 Game over, Click to play again!
    set %gameover yes
    unset %col
    .timerenemy off
  }
  if (%.y <= 30) {
    /drawtext @cross 4 370 250 Great, you made it, Click to play again
    set %gameover yes
    unset %col
  }
}
on *:close:@cross:{
  unset %col
  unset %gameover
  unset %r
  unset %rr
  .timerenemy off
  unset %tt
  unset %t
  unset %v
  unset %vv
}