Balls 1.01

By BlueThen on Jun 20, 2008

Balls... it's not what you think! A simple collision system (again), just to freshen up my memory.

By the way, it's been about a year since I first started scripting.

http://bluethen.the-brotherhood.org/Balls/Balls.htm
Image

Updates:
Fixed a small bug.

;Balls 1.01
;Made by BlueThen on June 20, 2008.
;To install, paste this snippet into your remotes (alt + r)
;Then type /balls or right click the channel or status and click "Balls."
;BlueThen.com
alias Balls window -paoCzdk0 +tnbL @Balls -1 -1 400 400 | window -paohCzdk0 +tndL @balls.buf -1 -1 800 800 | balls.init
alias -l balls.init {
  %bal.x = 5
  while (%bal.x) {
    hadd -m x %bal.x $calc(125 * %bal.x) | hadd -m y %bal.x 400
    hadd -m vx %bal.x $iif($r(1,2) == 1,-,+) $+ $r(1,10) | hadd -m vy %bal.x $iif($r(1,2) == 1,-,+) $+ $r(1,10)
    dec %bal.x
  }
  set %bal.mx 400 | set %bal.my 400 | balls.frame
}
alias -l balls.frame {
  if (%bal.c != y) {
    clear @balls.buf | %bal.y = 5
    while (%bal.y) {
      %bal.c = $calc(255 - ($bal.dist(%bal.mx, %bal.my, $hget(x,%bal.y), $hget(y,%bal.y)) * 0.255))
      drawdot -r @balls.buf $rgb(%bal.c,%bal.c,%bal.c) 50 $hget(x, %bal.y) $hget(y, %bal.y)
      hinc x %bal.y $hget(vx, %bal.y) | hinc y %bal.y $hget(vy, %bal.y) | %bal.z = 5
      while (%bal.z) {
        if ((%bal.z != %bal.y) && ($bal.dist($hget(x,%bal.y),$hget(y,%bal.y),$hget(x,%bal.z),$hget(y,%bal.z)) < 100)) {
          %bal.t1 = $hget(vx, %bal.z) | %bal.t2 = $hget(vx, %bal.y) | %bal.t3 = $hget(vy, %bal.z)
          %bal.t4 = $hget(vy, %bal.y) | hadd -m vx %bal.y %bal.t1 | hadd -m vx %bal.z %bal.t2 
          hadd -m vy %bal.y %bal.t3 | hadd -m vy %bal.z %bal.t4
        }
        dec %bal.z
      }
      if ($hget(x,%bal.y) > 750) hadd -m vx %bal.y $iif(- isin $hget(vx,%bal.y), $v2, $calc($v2 * -1))
      if ($hget(y,%bal.y) > 750) hadd -m vy %bal.y $iif(- isin $hget(vy,%bal.y), $v2, $calc($v2 * -1))
      if ($hget(x,%bal.y) < 50) hadd -m vx %bal.y $iif(- isin $hget(vx,%bal.y), $calc($v2 * -1), $v2)
      if ($hget(y,%bal.y) < 50) hadd -m vy %bal.y $iif(- isin $hget(vy,%bal.y), $calc($v2 * -1), $v2)
      dec %bal.y
    }
    drawtext @balls.buf 0 Tahoma 20 15 15 Made by BlueThen | drawtext @balls.buf 0 Tahoma 20 15 35 BlueThen.com 
    drawcopy @balls.buf 0 0 800 800 @balls 0 0 400 400
    .timer 1 0 balls.frame
  }
  else unset %bal.c
}
on *:close:@balls: { window -c @balls.buf | unset %bal.* | set %bal.c y }
menu @balls {
  mouse: { set %bal.mx $calc($mouse.x * 2) | set %bal.my $calc($mouse.y * 2) }
}
alias -l bal.dist return $sqrt($calc(($3 - $1)^2 + ($4 - $2)^2)) 
menu channel,status {
  Balls: { balls }
}

Comments

Sign in to comment.
Person   -  Jun 10, 2011

LOL @its not what you think!

 Respond  
tzar469   -  Jun 23, 2008

Wow, you learned all this in under a year. That\'s quite impressive. It\'s been a a year and a half for me and I still don\'t have the slightest clue on how to make even a simple dialog...

Great work, as always. :)

 Respond  
EL   -  Jun 20, 2008

Nice well done.`-.-´

 Respond  
BlueThen   -  Jun 20, 2008

Fixed.

 Respond  
EL   -  Jun 20, 2008

Nice BT has a mix of yur other ones but i got this on close of the picwin * /drawdot: invalid window (line 20, script19) not sure if i lagged or what but postin the error anyways well done other wise maybe some color? maybe have each ball change color on ccollision would be a idea.\"Rate it or Hate it?\"...7/10.`-.-´

 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.