Pong? Really?
Yes, this is Pong. A game I made in a few hours. You might know this as the first game ever made. Well, I recreated it for mIRC, with some additions. A two-player game in which you have to prevent the ball from hitting your side of the border of the screen.
What does it feature?
-Two-player game
-Pause function
-Point system
-Full-screen
-Cool!
-Smooth, buffered.
So how do you play it?
You put the whole script into your remote.ini or a new file.
Then, you can either type /pingpong or click right in a channel and click "Play Pong!".
Player left plays with the up and down arrow keys. Right uses the Home and End keys. For more info, start the game and click "Controls". Gotta pee? Press the spacebar to pause the game. Or press Q to quit the game.
;BOF
;Pong 1.1
;Made by CAsercan3 on February the 9th, 2009.
;To install, paste this script into your remotes (alt+R)
;Then type /pingpong, or right click the channel and click "Play Pong!".
;If you need any help, click on "Controls".
menu channel {
Play pong!: pingpong
}
alias pingpong {
window -paxdok0 +d @pongbuf
window -paxdok0 +d @pong
drawdot @pong 1 3000 0 0
drawtext @pong 0 Algerian 150 400 200 Pong
drawtext @pong 3 Algerian 20 530 200 Sercan's
drawtext @pong 0 Algerian 20 530 400 Start Game
drawtext @pong 0 Algerian 20 541 450 Controls
drawtext @pong 0 Algerian 20 565 500 Quit
}
menu @pong {
mouse: {
if ( %game == 1 ) halt
if ($true == $inpoly($mouse.x , $mouse.y , 560 , 500 , 560 , 540 , 650 , 540 , 650 , 500)) drawdot @pong 9 10 550 510
if ($true != $inpoly($mouse.x , $mouse.y , 560 , 500 , 560 , 540 , 650 , 540 , 650 , 500)) drawdot @pong 1 10 550 510
if ( %game2 == 1 ) halt
if ($true == $inpoly($mouse.x , $mouse.y , 525 , 400 , 525 , 440 , 700 , 440 , 700 , 400)) drawdot @pong 9 10 515 410
if ($true != $inpoly($mouse.x , $mouse.y , 525 , 400 , 525 , 440 , 700 , 440 , 700 , 400)) drawdot @pong 1 10 515 410
if ($true == $inpoly($mouse.x , $mouse.y , 535 , 450 , 535 , 490 , 650 , 490 , 650 , 450)) drawdot @pong 9 10 525 460
if ($true != $inpoly($mouse.x , $mouse.y , 535 , 450 , 535 , 490 , 650 , 490 , 650 , 450)) drawdot @pong 1 10 525 460
}
sclick: {
if ($true == $inpoly($mouse.x , $mouse.y , 560 , 500 , 560 , 540 , 650 , 540 , 650 , 500)) && ( %game2 == 1 ) { window -c @pong | pingpong | unset %game2 }
if ( %game == 1 ) || ( %game2 == 1 ) halt
if ($true == $inpoly($mouse.x , $mouse.y , 525 , 400 , 525 , 440 , 700 , 440 , 700 , 400)) pp
if ($true == $inpoly($mouse.x , $mouse.y , 535 , 450 , 535 , 490 , 650 , 490 , 650 , 450)) {
set %game2 1
drawdot @pong 1 3000 0 0
drawtext @pong 0 Arial 20 450 120 Pong was made by CAsercan3.
drawtext @pong 0 Arial 20 250 140 This is a two-player game. Prevent the ball from hitting the left/right side!
drawtext @pong 0 Arial 20 300 160 Left controls the white paddle with the up and down arrow keys.
drawtext @pong 0 Arial 20 300 180 Right controls the yellow pad with Home and End keys.
drawtext @pong 0 Arial 20 300 200 Press space bar to pause/continue. Press Q to close the game.
drawtext @pong 0 Arial 20 300 220 Thanks to BlueThen for interesting me with his fun picwins :D
drawtext @pong 0 Arial 20 450 240 Be sure to visit IRC.CA-clan.com!
drawtext @pong 0 Algerian 20 565 500 Back
}
if ($true == $inpoly($mouse.x , $mouse.y , 560 , 500 , 560 , 540 , 650 , 540 , 650 , 500)) { window -c @pong
window -c @pongbuf
}
}
}
alias -l pp {
set %game 1
window -paxdok0 +d @Pong
.timerpong -m 0 18 screenupdate
set %y 400
set %2y 400
set %direction 1
set %xball 120
set %yball 0
set %rico 0
set %base 450
set %speed 7
set %colorline 1
}
on *:keydown:@pong:*: {
if ( $keyval == 40 ) set %40down 1
if ( $keyval == 38 ) set %38down 1
if ( $keyval == 35 ) set %35down 1
if ( $keyval == 36 ) set %36down 1
if ( $keyval == 32 ) && ( %game == 1 ) {
if ( %gameover == 1 ) {
unset %gameover %points
pp
halt
}
if ( %pause == 0 ) || ( %pause == $null ) { set %pause 1
.timerpong -p
.drawtext @pong 0 Alba 40 530 400 PAUSED
halt
}
if ( %pause == 1 ) { set %pause 0
.timerpong -r
halt
}
}
if ( $keyval == 81 ) {
window -c @pong
window -c @pongbuf
unset %y %2y %xball %yball %base %direction %game %game2 %pause %gameover %speed %rico %40down %38down %points %35down %36down
.timerpong off
}
}
on *:keyup:@pong:*: {
if ( $keyval == 40 ) set %40down 0
if ( $keyval == 38 ) set %38down 0
if ( $keyval == 35 ) set %35down 0
if ( $keyval == 36 ) set %36down 0
}
on *:close:@pong: {
unset %y %2y %xball %yball %base %direction %game %game2 %pause %gameover %speed %rico %40down %38down %points %35down %36down
.timerpong off
}
alias -l screenupdate {
inc %points .002
if ( %xball < 0 ) {
.timerpong off
set %gameover 1
drawtext @pong 0 Algerian 150 195 200 Game Over
drawtext @pong 4 Tahoma 50 330 410 Right wins! Score: $calc(%points * %speed)
drawtext @pong 0 Algerian 30 300 470 Press spacebar to restart, or Q to quit.
halt
}
if ( %xball > $window(@pong).w ) {
.timerpong off
set %gameover 1
drawtext @pong 0 Algerian 150 195 200 Game Over
drawtext @pong 9 Tahoma 50 330 410 Left wins! Score: $calc(%points * %speed)
drawtext @pong 0 Algerian 30 300 470 Press spacebar to restart, or Q to quit.
halt
}
if ( %yball < 0 ) { set %rico $calc(%rico *-1)
set %base $calc(%yball - %base) }
if ( %yball > $calc($window(@pong).h ) ) {
set %rico $calc(%rico *-1)
set %base $calc( $window(@pong).h - %base + %yball )
}
if ( %direction == 1 ) inc %xball $calc(%speed - $abs(%rico) *3)
if ( %direction == 0 ) dec %xball $calc(%speed - $abs(%rico) *3)
if ( $true == $inpoly(%xball , %yball , 98 , %y , 98 , $calc(%y + 100) , 118 , $calc(%y + 100) , 118 , %y )) {
set %base %yball
set %direction 1
set %rico $calc($calc(%yball - 50 - %y) / $calc(37 - %speed))
if ( %speed < 15 ) inc %speed .25
}
if ( $true == $inpoly(%xball , %yball , $calc($window(@pong).w - 98) , %2y , $calc($window(@pong).w - 98) , $calc(%2y + 100) , $calc($window(@pong).w - 118) , $calc(%2y + 100) , $calc($window(@pong).w - 118) , %2y )) {
set %base %yball
set %direction 0
set %rico $calc($calc(%yball - 50 - %2y) / $calc(37 - %speed))
if ( %speed < 15 ) inc %speed .25
}
if ( %35down == 1) && ( $calc(%2y + 100) !>= $window(@pong).h ) inc %2y 10
if ( %36down == 1) && ( %2y !< 0 ) dec %2y 10
if ( %40down == 1 ) && ( $calc(%y + 100) !>= $window(@pong).h ) inc %y 10
if ( %38down == 1 ) && ( %y !< 0 ) dec %y 10
if ( %direction == 1 ) set %yball $calc(%base + %rico * $calc(%xball - 100) )
if ( %direction == 0 ) set %yball $calc(%base + -1 * %rico * $calc(%xball - $calc($window(@pong).w - 100)))
drawdot @pongbuf 1 3000 0 0
drawline @pongbuf 4 3 $calc($window(@pong).w - 100) %2y $calc($window(@pong).w - 100) $calc(%2y + 100)
drawline @pongbuf 9 3 100 %y 100 $calc(%y + 100)
;if ( %speed >= 8 ) drawdot -r @pongbuf $hsv(%xball ,150, 240 ) 8 %xball %yball
;else drawdot -r @pongbuf $hsv(%xball ,%xball, %xball ) 8 %xball %yball
drawdot -r @pongbuf $hsv(%xball ,240, 200) 8 %xball %yball
drawcopy @pongbuf 0 0 $window(@pong).w $window(@pong).h @pong 0 0
;drawtext @pongbuf 0 Arial 12 30 30 Score: $calc(%points * %speed)
}
alias -l hsv {
var %h $$1,%s $$2,%v $$3,%hi $calc($int($calc(%h / 60)) % 6),%f $calc(%h / 60 - %hi),%p $calc(%v * (1 - %s)),%q $calc(%v * (1 - %f * %s)),%t $calc(%v * (1 - (1 - %f) * %s))
if (%hi = 0) { var %r %v,%g %t,%b %p }
if (%hi = 1) { var %r %q,%g %v,%b %p }
if (%hi = 2) { var %r %p,%g %v,%b %t }
if (%hi = 3) { var %r %p,%g %q,%b %v }
if (%hi = 4) { var %r %t,%g %p,%b %v }
if (%hi = 5) { var %r %v,%g %p,%b %q }
var %r $int($calc(%r * 255)),%g $int($calc(%g * 255)),%b $int($calc(%b * 255))
return $rgb(%r, %g ,%b)
}
;EOF
The AI!
IS SIMPLE! :)
You can do some maths to check where the Ball is. If its within 64 pixels of the second bat make the bat keep adding or taking 5. If you have a direction variable on the ball then you need to check the direction, give it some thought. I'm a games student at college so im willing to help. I'm writing my own version of this in mIRC myself!
try to make a socket to ur self. if it works for you, then it can work for anyone else ;). Looking fofward for your next update :). That wat i did to make my chat script.
PunkTuReD: btw there was a "mario" mirc game i once seen
Actually, there is. You find it at http://www.picwin.tk in the examples place.
You can clean up some of the code. for example change:
alias endgame2 {
.timerpong off
set %gameover 1
drawtext @pong 0 Algerian 150 195 200 Game Over
drawtext @pong 9 Tahoma 50 330 410 Left wins! Score: $calc(%points * %speed)
drawtext @pong 0 Algerian 30 300 470 Press spacebar to restart, or Q to quit.
halt
}
alias endgame1 {
.timerpong off
set %gameover 1
drawtext @pong 0 Algerian 150 195 200 Game Over
drawtext @pong 4 Tahoma 50 330 410 Right wins! Score: $calc(%points * %speed)
drawtext @pong 0 Algerian 30 300 470 Press spacebar to restart, or Q to quit.
halt
}
TO:
alias endgame {
.timerpong off
set %gameover 1
drawtext @pong 0 Algerian 150 195 200 Game Over
drawtext @pong 9 Tahoma 50 330 410 $1 wins! Score: $calc(%points * %speed)
drawtext @pong 0 Algerian 30 300 470 Press spacebar to restart, or Q to quit.
halt
}
And then just type /endgame [left/right]
Instead of putting a separate alias for both.