Catapult

By BlueThen on Apr 04, 2009

Catapult is mostly experiments with isometric rendering and particle physics. Feel free to play around.
Image

;Catapult
;Made by BlueThen on April 4, 2009.
;To install, paste this snippet in your remotes (alt + r)
;then type /catapult or right click the channel or status and click "Catapult"
;Simply click anywhere in the window to shoot.
alias Catapult {
  window -paoCzdk0 +tnbL @Catapult -1 -1 400 400 
  set %cat.a 10
  set %cat.x 392.5
  set %cat.y 70.2
  set %cat.z 275
  set %cat.stage 0
  cat.frame 
}
menu channel,status {
  Catapult: catapult
}
alias -l cat.frame {
  if ($window(@catapult)) {
    clear -n @catapult
    drawfill -n @catapult 0 0 1 1
    if (%cat.stage) {
      if (%cat.stage == 1) {
        if (%cat.a < 80) set %cat.a $calc(%cat.a * 1.25)
        else {
          set %cat.stage 2
          set %cat.p 1
        }
      }
      if (%cat.stage == 2) {
        dec %cat.x 15
        $iif($cos(%cat.p).deg < 1, dec, inc) %cat.y $calc($cos($calc(%cat.p + 180)).deg *10)
        inc %cat.p 10
        if (%cat.x < 190) {
          set %cat.stage 3
          %cat.w = 50
          while (%cat.w) {
            hadd -m x %cat.w $calc($r(1,4) + %cat.x)
            hadd -m y %cat.w $calc($r(1,4) + %cat.y)
            hadd -m z %cat.w $calc($r(1,4) + %cat.z)
            hadd -m lx %cat.w $calc($r(1,4) + %cat.x)
            hadd -m ly %cat.w $calc($r(1,4) + %cat.y)
            hadd -m lz %cat.w $calc($r(1,4) + %cat.z)
            hadd -m vx %cat.w $iif($r(1,2) == 1, - ,+) $+ $r(5,10)
            hadd -m vy %cat.w $iif($r(1,2) == 1, -, +) $+ $r(3,7)
            hadd -m vz %cat.w $iif($r(1,5) == 1, -, +) $+ $r(5,15)
            hadd -m blue %cat.w 0
            hadd -m fade %cat.w $r(5,20)
            hadd -m dead %cat.w no
            hadd -m width %cat.w $r(1,5)
            dec %cat.w
          }
          set %cat.dead 0
        }
      }  
      if (%cat.stage == 3) {
        %cat.w = 50
        while (%cat.w) {
          if ($hget(dead, %cat.w) == no) {
            drawline -nr @catapult $rgb($hget(blue, %cat.w), $hget(blue, %cat.w), 255) $hget(width, %cat.w) $cat.iso($hget(x, %cat.w), $hget(y, %cat.w), $hget(z, %cat.w)) $cat.iso($hget(lx, %cat.w), $hget(ly, %cat.w), $hget(lz, %cat.w))
            hadd -m lx %cat.w $hget(x, %cat.w)
            hadd -m ly %cat.w $hget(y, %cat.w)
            hadd -m lz %cat.w $hget(z, %cat.w)
            hinc x %cat.w $hget(vx, %cat.w)
            hinc y %cat.w $hget(vy, %cat.w)
            hinc z %cat.w $hget(vz, %cat.w)
            hdec vy %cat.w 1.5

            hinc blue %cat.w $hget(fade, %cat.w)
            if ($hget(blue, %cat.w) > 250) {
              hadd -m dead %cat.w yes
              inc %cat.dead 1
            }
          }
          dec %cat.w
        }
        if (%cat.dead == 50) {
          set %cat.stage 0 
          set %cat.a 10
          set %cat.x $calc(363 + (30 * $cos(%cat.a).deg))
          set %cat.y $calc(65 + (30 * $sin(%cat.a).deg))
          set %cat.z 275
        }
      }
    }
    cat.plat
    cat.cat
    cat.hum
    if (%cat.stage != 3) drawdot -n @catapult 12 10 $cat.iso(%cat.x, %cat.y, %cat.z)
    drawtext -n @Catapult 1 Tahoma 30 190 10 BlueThen.com
    drawline @catapult
    .timer 1 0 cat.frame
  }
  else {
    unset %cat.*
    hfree x | hfree y | hfree z | hfree lx | hfree ly | hfree lz | hfree vx | hfree vy | hfree vz | hfree blue | hfree fade | hfree dead | hfree width
  }
}
menu @catapult {
  sclick: {
    if (%cat.stage == 0) set %cat.stage 1
  }
}
alias -l cat.hum {
  drawline -n @catapult 1 4 126.4 152.5 109 132.5
  drawline -n @catapult 1 4 91.7 172.5 109 132.5
  drawline -n @catapult 1 4 109 132.5 109 92.5
  drawline -n @catapult 1 4 109 109.5 83 137.5
  drawline -n @catapult 1 4 109 109.5 135 107.5
  drawdot -n @catapult 1 17 109 92.5
}
alias -l cat.plat {
  drawline -n @catapult 1 2 156.7 115 373.2 240
  drawline -n @catapult 1 2 373.2 240 243.3 315
  drawline -n @catapult 1 2 243.3 315 26.8 190
  drawline -n @catapult 1 2 26.8 190 156.7 115
  drawfill -n @catapult 0 1 152.4 122.5
  drawline -n @catapult 1 2 26.8 190 26.8 450
  drawline -n @catapult 1 2 243.3 315 243.3 575
  drawline -n @catapult 1 2 373.2 240 373.2 500
  drawfill -n @catapult 0 1 35.4 355
  drawfill -n @catapult 0 1 329.9 355
}
alias -l cat.cat {
  ;drawcatapult - edges
  drawline -n @catapult 1 1 273.6 247.5 256.3 257.5
  drawline -n @catapult 1 1 299.6 262.5 273.6 247.5
  drawline -n @catapult 1 1 282.3 272.5 299.6 262.5
  drawline -n @catapult 1 1 256.3 257.5 282.3 272.5
  drawline -n @catapult 1 2 276.2 259 $cat.iso($calc(363 + (30 * $cos(%cat.a).deg)),$calc(60 + (30 * $sin(%cat.a).deg)),275)
  drawline -n @catapult 1 1 284.9 254 267.5 264
  if (%cat.stage == 1) {
    set %cat.x $calc(363 + (30 * $cos(%cat.a).deg))
    set %cat.y $calc(60 + (30 * $sin(%cat.a).deg))
  }
  drawline -n @catapult 1 1 269.3 265 273.6 242.5
  drawline -n @catapult 1 1 286.6 255 282.3 237.5
  drawline -n @catapult 1 1 282.3 237.5 273.6 242.5
  drawline -n @catapult 1 1 273.6 242.5 256.3 257.5
  drawline -n @catapult 1 1 282.3 237.5 273.6 247.5
}
alias cat.iso return $calc((($1 - $3) * $cos(30).deg) + 200) $calc(($1 + $3)* $sin(30).deg - $2)

Comments

Sign in to comment.
sercan386   -  Apr 05, 2009

rofl in yo face :D
nice, well done

 Respond  
Prelude   -  Apr 05, 2009

Cool stuff BT.

 Respond  
Blitzjager   -  Apr 04, 2009

It's neat again but I was expecting the splash to show up in front of the cube but not behind it. Is that what you were going for?
All these 'experiments'. Can't wait til you stick em all together. :P

 Respond  
Aucun50   -  Apr 04, 2009

Was wondering what you would come up with next, great work as always.

 Respond  
Basillisk   -  Apr 04, 2009

random, but awesome. You never cease to amaze, Bluethen :P

 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.