Check out Amazon.com!

BlitzCoder WorklogsMain Worklogs Page
"Code"
Owner: code maker
Showcase Entry: Extreme Pong (Beta Version)
Total Entries: 2
code maker
Entry: 2
11/16/2004
04:31 AM
;;;;;;;;;;;;;;;;;;;;;;;;;
;; Extreme Pong ;;
;; Part 1 ;;
;; Made by Code Maker ;;
;; aka: Code Master ;;
;; *beta version* ;;
;; DO NOT STEAL ;;
;;;;;;;;;;;;;;;;;;;;;;;;;
AppTitle"Extreme Pong"
Graphics 800,600,0,1
SeedRnd(MilliSecs())
SetBuffer BackBuffer()
AutoMidHandle True
Const UPKEY = 200 ;Up
Const DOWNKEY = 208 ;Down
Const PKEY = 25 ;P
Const ZKEY = 44 ;Z
Const AKEY = 30 ;A
Const NUM4 = 75 ;4
Const NUM6 = 77 ;6
Const coma = 51 ;,
Const peri = 1 ;.
Const humanspeed = 7
Const computerspeed =6
Type player
Field y,score
End Type
Type score
Field y
End Type
Type pad
Field x,score
End Type
Type ball
Field x,y,xv,yv
End Type
Global scoreimage = LoadImage("b.bmp")
Global player1image = LoadImage("player1.bmp")
Global player2image = LoadImage("player1.bmp")
Global player3image = LoadImage("player3.bmp")
Global player4image = LoadImage("player3.bmp")
Global ballimage = LoadImage("ball.bmp")
Global score.score = New score
Global ball.ball = New ball
Global player1.player = New player
Global player2.player = New player
Global player3.pad = New pad
Global player4.pad = New pad
Print"Press any key."
WaitKey
Cls
Text 50,100,"Remember to keep {NUM LOCK on} and press P to pause."
Global lpname$ = Input$("Who is playing? ")
Text 50,200,"Okay, " + lpname$ + " your controls are the arrow keys."
Cls
Print"Get ready!"
Delay(200)
Cls
Text 420,330,"GO!"
Delay(500)
Cls
Flip
InitializeLevel()
player1\score = 10 ;* DO Not SET To AN ODD NUMBER!!!!! * <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <-
player2\score = 10 ; these added together will be the # of points needed to win!
player3\score = 10
player4\score = 10
While Not KeyDown(1)
Cls
DrawImage (scoreimage, 0, score\y)
DrawImage (ballimage,ball\x,ball\y)
DrawImage (player1image, 260, player1\y)
DrawImage (player2image, 740, player2\y)
DrawImage (player3image, player3\x, 100)
DrawImage (player4image, player4\x, 500)
TestKeyboard()
TestAI()
DrawScore()
Flip
Wend
Function InitializeLevel()
ball\x = 400
ball\y = 300
ball\xv = Rand(2,6)
ball\yv = Rand(-8,8)
score\y = 148
player4\x = 500
player3\x = 500
player2\y = 300
player1\y = 300
End Function
Function DrawScore()
Text 10,20,"Team Horizantal's score: " + (player1\score + player2\score)
Text 15,40,lpname$ + "'s score: " + player1\score
Text 15,50,lpname$ + "'s Teamate's score: " + player2\score
Text 10,120,"Team Vertical's score: " + (player3\score + player4\score)
Text 15,140,"Cpu's score: " + player3\score
Text 15,150,"Cpu's score: " + player4\score
End Function
Function TestKeyboard()
If KeyDown(UPKEY)
player1\y = player1\y - HUMANSPEED
EndIf
If KeyDown(NUM4)
ballimage = LoadImage("football.bmp")
scoreimage = LoadImage("scoreboard.bmp")
EndIf
If KeyDown(NUM6)
player1image = LoadImage("ohhh.bmp")
player2image = LoadImage("ohhh.bmp")
player3image = LoadImage("ohhhh.bmp")
player4image = LoadImage("ohhhh.bmp")
scoreimage = LoadImage("scoreboardb.bmp")
ballimage = LoadImage("flashball.bmp")
EndIf
If KeyDown(DOWNKEY)
player1\y = player1\y + HUMANSPEED
End If
If KeyHit(PKEY)
Cls
Text 10,300,"Hit 'P' to unpause the game."
Flip
While Not KeyHit(PKEY)
Wend
EndIf
If KeyDown(AKEY)
player2\y = player2\y - HUMANSPEED
EndIf
If KeyDown(ZKEY)
player2\y = player2\y + HUMANSPEED
EndIf
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Extreme Pong ;;;
;;; Beta Version ;;;
;;; Part 2 ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Function TestAI()
;If ball\y > player1\y ;}Comment
; player1\y = player1\y + computerspeed ;}out
;ElseIf ball\y < player1\y ;}with ;
; player1\y = player1\y - computerspeed ;}for 1p
;EndIf ;}_____________________________________________________________________
If ball\y > player2\y ;}
player2\y = player2\y + computerspeed ;}for 2p
ElseIf ball\y < player2\y ;}
player2\y = player2\y - computerspeed ;}
EndIf ;}
If ball\x > player3\x
player3\x = player3\x + computerspeed
ElseIf ball\x < player3\x
player3\x = player3\x - computerspeed
EndIf
If ball\x > player4\x
player4\x = player4\x + computerspeed
ElseIf ball\x < player4\x
player4\x = player4\x - computerspeed
EndIf
If ImagesOverlap(ballimage,ball\x,ball\y,player1image,260,player1\y)
ball\xv = -ball\xv + Rand(-4,4)
ball\yv = ball\yv + Rand(-4,4)
ElseIf ImagesOverlap(ballimage,ball\x,ball\y,player2image,740,player2\y)
ball\xv = -ball\xv + Rand(-4,4)
ball\yv = ball\yv + Rand(-4,4)
ElseIf ImagesOverlap(ballimage,ball\x,ball\y,player4image,player4\x,500)
ball\xv = -ball\yv + Rand (-1,1)
ball\yv = ball\xv + Rand (-1,1)
ElseIf ImagesOverlap(ballimage,ball\x,ball\y,player3image,player3\x,100)
ball\yv = -ball\yv + Rand (-1,1)
ball\xv = ball\xv + Rand (-1,1)
ElseIf ball\y >= 600
If player4\score > 1 Then
player4\score = player4\score - 2
ElseIf player4\score = 0 Then
player3\score = player3\score - 2
ElseIf player4\score = 1 Then
player4\score = player4\score - 1
player3\score = player3\score - 1
EndIf
player1\score = player1\score + 1
player2\score = player2\score + 1
Text 400,300,"Team Horizontal got 2 points."
Delay(2000)
If player3\score + player4\score = 0
Text 410,310,"Team Horizontal Wins"
Cls
Flip
cont$ = Input$("Continue? 1=Yes 2=No")
If cont$ = 2 Then
End
ElseIf cont$ = 1 Then
player1\score = 10
player2\score = 10
player3\score = 10
player4\score = 10
EndIf
EndIf
InitializeLevel()
ElseIf ball\y <= 0
If player3\score > 1 Then
player3\score = player3\score - 2
ElseIf player3\score = 0 Then
player4\score = player4\score - 2
ElseIf player3\score = 1 Then
player3\score = player3\score - 1
player4\score = player4\score - 1
EndIf
player1\score = player1\score + 1
player2\score = player2\score + 1
Text 400,300,"Team Horizontal got 2 points."
Delay(2000)
If player3\score + player4\score = 0
Text 410,310,"Team Horizontal Wins"
Cls
Flip
cont$ = Input$("Continue? 1=Yes 2=No")
If cont$ = 2 Then
End
ElseIf cont$ = 1 Then
player1\score = 10
player2\score = 10
player3\score = 10
player4\score = 10
EndIf
EndIf
InitializeLevel()
ElseIf ball\x <= 160
If player1\score > 1 Then
player1\score = player1\score - 2
ElseIf player1\score = 0 Then
player2\score = player2\score - 2
ElseIf player1\score = 1 Then
player1\score = player1\score - 1
player2\score = player2\score - 1
EndIf
player3\score = player3\score + 1
player4\score = player4\score + 1
Text 400,300,"Team Vertical got 2 points."
Delay(2000)
If player1\score + player2\score = 0
Text 410,310,"Team Vertical Wins"
Cls
Flip
cont$ = Input$("Continue? 1=Yes 2=No")
If cont$ = 2 Then
End
ElseIf cont$ = 1 Then
player1\score = 10
player2\score = 10
player3\score = 10
player4\score = 10
EndIf
EndIf
InitializeLevel()
ElseIf ball\x >= 800
If player2\score > 1 Then
player2\score = player2\score - 2
ElseIf player2\score = 0 Then
player1\score = player1\score - 2
ElseIf player2\score = 1 Then
player2\score = player2\score - 1
player1\score = player1\score - 1
EndIf
player3\score = player3\score + 1
player4\score = player4\score + 1
Text 400,300,"Team Vertical got 2 points."
Delay(2000)
If player1\score + player2\score = 0
Text 410,310,"Team Vertical Wins"
Cls
Flip
cont$ = Input$("Continue? 1=Yes 2=No")
If cont$ = 2 Then
End
ElseIf cont$ = 1 Then
player1\score = 10
player2\score = 10
player3\score = 10
player4\score = 10
EndIf
EndIf
InitializeLevel()
EndIf
ball\x = ball\x + ball\xv
ball\y = ball\y + ball\yv

End Function
code maker
Entry: 1
11/16/2004
03:58 AM
Compile the code above to play.
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.

Plan software created by Krylar's Kreations