Rocket Crazy 1.01

By BlueThen on Nov 02, 2008

Rocket Crazy is a game demonstrating some of mIRC's capabilities in PicWins. Your job is try to shoot all the red enemies out of the sky before they get to the end of the screen.
Controls:
Restart: R
Movement: Arrow Keys
Aim: Mouse
Shoot: Left Click

Enjoy.
Image

Updates:
No more left-over variables

;Rocket Crazy 1.01
;Made by BlueThen on November 2, 2008.
;To install, paste this script into your remotes (alt + r)
;Then type /rocket, or right click the channel or status and click "Rocket"
;Controls: R restarts, arrow keys for movement, mouse to aim, left click to shoot. Enjoy.
menu channel,status {
  Rocket: rocket
}
alias rocket {
  window -paozCdk0 +fbnL @Rocket -1 -1 400 400
  window -paohCzdk0 +ndL @Rocket.buf -1 -1 800 800
  %rocket.x = 7
  while (%rocket.x) {
    window -paohCzdk0 +ndL @rocket.ex $+ %rocket.x -1 -1 100 100
    drawfill -r @rocket.ex $+ %rocket.x $rgb(255,0,255) $rgb(255,0,255) 1 1
    drawdot -r @rocket.ex $+ %rocket.x $rgb(50,50,50) 40 50 50
    if (%rocket.x < 6) drawdot -r @rocket.ex $+ %rocket.x $rgb(150,150,150) $calc(40 / (%rocket.x - 3)) 50 50
    if (%rocket.x < 5) drawdot -r @rocket.ex $+ %rocket.x $rgb(255,0,0) $calc(40 / (%rocket.x - 2)) 50 50
    if (%rocket.x < 4) drawdot -r @rocket.ex $+ %rocket.x $rgb(255,100,0) $calc(40 / (%rocket.x - 1)) 50 50
    if (%rocket.x < 3) drawdot -r @rocket.ex $+ %rocket.x $rgb(255,255,0) $calc(40 / %rocket.x) 50 50
    %rocket.z = $calc((%rocket.x - 1) * 20)
    while (%rocket.z) {
      drawdot -r @rocket.ex $+ %rocket.x $rgb(255,0,255) %rocket.x $r(10,90) $r(90,10)
      dec %rocket.z
    }
    dec %rocket.x
  }
  set %rocket.limit 0
  set %rocket.enemies 0
  set %rocket.flares 0
  set %rocket.rockets 0
  set %rocket.explosions 0
  set %rocket.mx 100
  set %rocket.my 100
  set %rocket.mvy 0
  set %rocket.mvx 0
  set %rocket.time 0
  set %rocket.fcounter 0
  set %rocket.fps 0
  set %rocket.fticks $ticks
  set %rocket.fmin2 1
  set %rocket.emin2 1
  set %rocket.wmin2 1
  set %rocket.rate 60
  set %rocket.health 10
  set %rocket.kills 0
  .timerrock -m 0 100 inc %rocket.time
  .timerrock2 0 3 dec %rocket.rate $iif(%rocket.rate > 10, 0, 2)
  rocket.frame
}
alias -l rocket.frame {
  if ($window(@rocket)) {
    if ($r(1,%rocket.rate) == 1) rocket.enemy
    inc %rocket.fcounter
    set %rocket.ltime $calc($ticks - %rocket.oticks)
    if ($calc($ticks - %rocket.fticks) > 999) {
      set %rocket.fps %rocket.fcounter
      set %rocket.fcounter 0
      set %rocket.fticks $ticks
    }
    clear @rocket.buf
    drawfill -r @rocket.buf $rgb(10,50,240) $rgb(10,50,240) 1 1
    drawline @rocket.buf 3 1 0 650 800 650
    drawfill @rocket.buf 3 3 700 700
    drawdot @rocket.buf 8 100 750 50
    drawtext @rocket.buf 1 Tahoma 35 10 55 Kills: %rocket.kills
    drawtext @rocket.buf 1 Tahoma 35 10 90 Health: %rocket.health
    drawtext @rocket.buf 1 Tahoma 35 10 20 Made by BlueThen
    if (%rocket.health < 1) { 
      drawtext @rocket.buf 1 Tahoma 50 284.5 350 GAMEOVER
      drawcopy @rocket.buf 0 0 800 800 @rocket 0 0 400 400
      halt
    }
    if ($calc($ticks - %rocket.limit) < 1000) drawtext @rocket.buf 1 Tahoma 35 500 700 Reloading
    if (%rocket.my < 620) {
      inc %rocket.mvy 4
    }
    elseif (%rocket.mvy > 0) set %rocket.mvy 0
    if ((%rocket.mx < 50) && (%rocket.mvx < 0)) set %rocket.mvx 0
    if ((%rocket.mx > 750) && (%rocket.mvx > 0)) set %rocket.mvx 0
    set %rocket.mx $calc(%rocket.mvx + %rocket.mx)
    set %rocket.my $calc(%rocket.mvy + %rocket.my)
    drawdot @rocket.buf 14 30 %rocket.mx %rocket.my

    %rocket.z = %rocket.rockets
    while (%rocket.z >= $calc(%rocket.min2)) {
      if ($hget(rocket.dead, %rocket.z) != y) { 
        drawline @rocket.buf 1 60 $hget(xr, %rocket.z) $hget(yr, %rocket.z) $calc($hget(xr, %rocket.z) + (40 * $cos($calc($hget(angle, %rocket.z) $iif($r(1,2) == 1,-,+) $r(5,10))).deg)) $calc($hget(yr, %rocket.z) + (40 * $sin($calc($hget(angle, %rocket.z) $iif($r(1,2) == 1,-,+) $r(5,10))).deg))
        rocket.flare $calc($hget(xr, %rocket.z) $iif($r(1,2) == 1,-,+) $r(5,15)) $calc($hget(yr, %rocket.z) $iif($r(1,2) == 1,-,+) $r(5,15))
        rocket.flare $calc($hget(xr, %rocket.z) $iif($r(1,2) == 1,-,+) $r(5,15)) $calc($hget(yr, %rocket.z) $iif($r(1,2) == 1,-,+) $r(5,15))
        hadd -m Xr %rocket.z $calc($hget(xr, %rocket.z) + (20 * $cos($calc($hget(angle, %rocket.z) $iif($r(1,2) == 1,-,+) $r(10,30))).deg))
        hadd -m Yr %rocket.z $calc($hget(yr, %rocket.z) + (20 * $sin($calc($hget(angle, %rocket.z) $iif($r(1,2) == 1,-,+) $r(10,30))).deg))
        if ($hget(Explode, %rocket.z) < $rocket.gd($hget(Xr, %rocket.z), $hget(yr, %rocket.z), $hget(start.x, %rocket.z), $hget(start.y, %rocket.z))) {
          hadd -m rocket.dead %rocket.z y
          rocket.explosion $hget(xr, %rocket.z) $hget(yr, %rocket.z)
        }
        if (%rocket.z != 0) set %rocket.min %rocket.z
      }
      dec %rocket.z
    }
    set %rocket.min2 %rocket.min

    %rocket.q = %rocket.flares
    while (%rocket.q >= $calc(%rocket.fmin2)) {
      if ($hget(flare.dead, %rocket.q) != y) {
        set %rocket.rand $r(45,55)
        drawcopy -mt @rocket.ex $+ $hget(stage, %rocket.q) $rgb(255,0,255) 0 0 95 95 @rocket.buf $calc($hget(xf, %rocket.q) - %rocket.rand) $calc($hget(yf, %rocket.q) - %rocket.rand) 100 100
        hinc Stage %rocket.q 1
        if ($hget(stage, %rocket.q) == 8) {
          hadd -m Flare.Dead %rocket.q Y
        }
        if (%rocket.q != 0) set %rocket.fmin %rocket.q
      }
      dec %rocket.q
    }
    set %rocket.fmin2 %rocket.fmin

    %rocket.u = %rocket.enemies
    while (%rocket.u >= $calc(%rocket.wmin2)) {
      if ($hget(enemy.dead, %rocket.u) != y) {
        drawdot @rocket.buf 4 $hget(size, %rocket.u) $hget(xw, %rocket.u) $hget(yw, %rocket.u)
        hdec xw %rocket.u $hget(speed, %rocket.u)
        if ($hget(xw, %rocket.u) < -100) {
          dec %rocket.health 1
          hadd -m enemy.dead %rocket.u y
        }
        if (%rocket.u != 0) set %rocket.wmin %rocket.u
      }
      dec %rocket.u
    }
    set %rocket.wmin2 $iif($calc(%rocket.wmin) == 0, 1, %rocket.wmin)

    %rocket.r = %rocket.explosions
    while (%rocket.r >= $calc(%rocket.emin2)) {
      if ($hget(explosion.dead, %rocket.r) != y) {
        %rocket.t = $calc($hget(ring, %rocket.r) * 2)
        while (%rocket.t) {
          rocket.flare $calc($hget(xe,%rocket.r) + ((($hget(ring, %rocket.r) * 20) $iif($r(1,2) == 1, +, -) $r(5,10)) * $cos($calc(((360 / ($hget(ring, %rocket.r) *2)) * %rocket.t) $iif($r(1,2) == 1, +, -) $r(5,10))).deg)) $calc($hget(ye,%rocket.r) + ((($hget(ring, %rocket.r) * 20) $iif($r(1,2) == 1, +, -) $r(5,10)) * $sin($calc(((360 / ($hget(ring, %rocket.r) *2)) * %rocket.t) $iif($r(1,2) == 1, +, -) $r(5,10))).deg))
          dec %rocket.t
        }
        hinc -m ring %rocket.r 1

        if ($hget(ring, %rocket.r) == 5) {
          %rocket.i = %rocket.enemies
          while (%rocket.i >= $calc(%rocket.wmin2)) {
            if ($rocket.gd($hget(xe, %rocket.r),$hget(ye, %rocket.r),$hget(xw, %rocket.i),$hget(yw, %rocket.i)) < 150) {
              hadd -m enemy.dead %rocket.i y
              inc %rocket.kills
            }
            dec %rocket.i
          }
        }
        if ($hget(ring, %rocket.r) > 5) {
          hadd -m explosion.dead %rocket.r y
        }
        if (%rocket.r != 0) set %rocket.emin %rocket.r
      }
      dec %rocket.r
    }
    set %rocket.emin2 %rocket.emin

    drawcopy @rocket.buf 0 0 800 800 @rocket 0 0 400 400
    set %rocket.oticks $ticks
    .timer 1 0 rocket.frame
  }
}
on *:close:@rocket: {
  .timerrock* off
  window -c @rocket.buf
  %rocket.y = 7
  while (%rocket.y) {
    window -c @rocket.ex $+ %rocket.y
    dec %rocket.y
  }
  unset %rocket.*
}
on *:keydown:@rocket:*: {
  if ($keyval == 37) {
    if (%rocket.mx > 50) set %rocket.mvx -15
  }
  if ($keyval == 39) {
    if (%rocket.mx < 750) set %rocket.mvx 15
  }
  if ($keyval == 38) {
    if (%rocket.mvy == 0) set %rocket.mvy -30
  }
  if ($keyval == 82) {
    .timerrock* off
    window -c @rocket.buf
    %rocket.y = 7
    while (%rocket.y) {
      window -c @rocket.ex $+ %rocket.y
      dec %rocket.y
    }
    unset %rocket.*
    rocket
  }
}
on *:keyup:@rocket:*: {
  if (($keyval == 37) || ($keyval == 39)) {
    set %rocket.mvx 0
  }
}
menu @rocket {
  sclick: {
    rocket.shoot %rocket.mx %rocket.my $rocket.ga(%rocket.mx, %rocket.my, $calc($mouse.x * 2), $calc($mouse.y * 2)) $calc($mouse.x * 2) $calc($mouse.y * 2)
  }
}
alias -l rocket.enemy {
  inc %rocket.enemies 1
  hadd -m Xw %rocket.enemies 850
  hadd -m Yw %rocket.enemies $r(100, 600)
  hadd -m Size %rocket.enemies $r(20,60)
  hadd -m Speed %rocket.enemies $r(5,10)
  hadd -m Enemy.Dead %rocket.enemies n
}
alias -l rocket.explosion {
  inc %rocket.explosions 
  hadd -m Xe %rocket.explosions $1
  hadd -m Ye %rocket.explosions $2
  hadd -m Ring %rocket.explosions 1
  hadd -m Explosion.Dead %rocket.explosions n
}
alias -l rocket.flare {
  inc %rocket.flares
  hadd -m Xf %rocket.flares $1 
  hadd -m Yf %rocket.flares $2
  hadd -m Stage %rocket.flares 1
  hadd -m Flare.Dead %rocket.flares n
}
alias -l rocket.shoot {
  if ($calc($ticks - %rocket.limit) > 1000) {
    set %rocket.limit $ticks
    inc %rocket.rockets
    hadd -m Start.X %rocket.rockets $1
    hadd -m Start.Y %rocket.rockets $2
    hadd -m Xr %rocket.rockets $1
    hadd -m Yr %rocket.rockets $2
    hadd -m Angle %rocket.rockets $calc(360 - $3)
    hadd -m Explode %rocket.rockets $rocket.gd($1, $2, $4, $5)
    hadd -m rocket.dead %rocket.rockets n
  }
}
alias -l rocket.ga { 
  %rocket.p1.x = $1 | %rocket.p1.y = $2 | %rocket.p2.x = $3 | %rocket.p2.y = $4 | %rocket.p3.x = %rocket.p2.x | %rocket.p3.y = %rocket.p1.y | %rocket.opposite = $sqrt($calc((%rocket.p2.x - %rocket.p3.x)^2 + (%rocket.p2.y - %rocket.p3.y)^2)) 
  %rocket.hypotenuse = $sqrt($calc((%rocket.p2.x - %rocket.p1.x)^2 + (%rocket.p2.y - %rocket.p1.y)^2)) | %rocket.angle = $asin($calc( %rocket.opposite / %rocket.hypotenuse )).deg 
  if (%rocket.p1.y < %rocket.p2.y) %rocket.angle = $calc(360 - %rocket.angle) | if ((%rocket.p1.x > %rocket.p2.x) && (%rocket.p1.y > %rocket.p2.y)) %rocket.angle = $calc(180 - %rocket.angle) 
  elseif ((%rocket.p1.x > %rocket.p2.x) && (%rocket.p1.y < %rocket.p2.y)) %rocket.angle = $calc(180 +(360 - %rocket.angle)) | return %rocket.angle
}
alias -l rocket.gd return $sqrt($calc(($3 - $1)^2 + ($4 - $2)^2))

Comments

Sign in to comment.
Hawkee   -  Feb 28, 2009

It seems pretty smooth on my system, but I don't really see the point to moving left or right. Maybe if the red dots were dropping bombs or something it might come into play. Also was a bit tough as the dots just fly by too quick.

 Respond  
guest598594   -  Nov 04, 2008

Very cool, I like the explosions :)

 Respond  
BlueThen   -  Nov 02, 2008

I'll see if I could optimize it anymore, ^Neptune.

 Respond  
Eugenio   -  Nov 02, 2008

/me ponders

 Respond  
^Neptune   -  Nov 02, 2008

It's certainly very laggy. Great effects though.

 Respond  
BlueThen   -  Nov 02, 2008

Update: No more left-over variables.

 Respond  
BlueThen   -  Nov 02, 2008

Let me know if you find any bugs or have any issues with this. I spent about 4 hours on this, and I don't want anyone having a bad time with it.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.