----------------------------------- CITC Sat Jan 10, 2004 11:49 pm CITC's Pong (2 player, complex) ----------------------------------- Not just the ordinary pong program here! 8) in this you can really bring the simple game of pong into more of a fast-paced difficult game! Hope you guys enjoy it! ----------------------------------- Boarder16 Sun Jan 11, 2004 12:25 am ----------------------------------- i had a dproblem running it.. i didn't know howw to clik/ ope nteh win and controls menu.. only the play.. and the 1st palyer couldn't move..its was relly laggy and long delays..unless tis upposed to be that way.. but an interesting start :? ----------------------------------- CITC Sun Jan 11, 2004 5:43 pm ----------------------------------- hhmmm... before I uploaded the file I tested a last time and it wasn't laggy or anything and the menu's were fine. a minute ago I ran it again and it was really laggy... I restarted my computer and it works fine... I think Turing tends to be very greedy when it comes to eating up your RAM. oh and for the menus, enter selects / accepts, use the up and down arrow keys to select the menu, and the left and right arrow keys to change values. in case the menu still doesn't work, I'll tell you the controls there are six keys for each player... player 1 = insert, home, pgup, del, end, & pg down player 2 = q,w,e,a,s,d Cheers ----------------------------------- poly Sun Jan 11, 2004 5:51 pm ----------------------------------- menu and everything works perfect to me, good job, but gots me a question.... whats so murder about that pong? ----------------------------------- CITC Sun Jan 11, 2004 6:41 pm ----------------------------------- haha good question. Murder Pong has a nice ring to it I though :D btw, I find this game incredibly fun to play with my mom because of her lack of finger co-ordination and reflexes (both of whch you get from the computer). :) ----------------------------------- poly Sun Jan 11, 2004 6:47 pm ----------------------------------- haha good question. Murder Pong has a nice ring to it I though :Dyou know that is true, because the only reason I played it was because i thought we could do some violent actions. ----------------------------------- CITC Sun Jan 11, 2004 7:58 pm ----------------------------------- haha, well that fastball would certainly hurt if you got it in the right spot. ----------------------------------- white_dragon Mon Jan 12, 2004 6:05 pm same here ----------------------------------- it lagged on mine. but i couldn't stop it from lagging........... i don't get it i restarted my compu so many times but it just won't stop lagging!!!!! help!!!!!! ----------------------------------- DanShadow Mon Jan 12, 2004 7:23 pm ----------------------------------- Restarting your computer wont stop CITC's program from lagging, its only because his window is so big, and that his ball and paddles are moving so slow, is it laggy. Seriously, I suggest tripling the ball and paddle speed...no offense, but there is no point playing a game that is that easy to win....but I did really like your menu, its nice! I used something similar to that awhile ago...except I used (colorback and color) commands instead of drawing a box. Good start! ----------------------------------- Cervantes Mon Jan 12, 2004 7:52 pm ----------------------------------- oooh thats annoying :twisted: you people must stop saying "good start"! It's a finished project!! :P I really dunno why it's lagging on everyone else's computer, maybe it has something to do with the fact that it is an .exe .. The time it was lagging on me (which was just after I was playing my 2 player version of Homer's pong) no matter what I did to the delay changed nothing... Here I'll attach the code you guys can try that out. /* By : Geoff Stanley Date : July 2003 Here is Geoff's Ultimate Pong Program, Enjoy!! */ %%%% Title Screen and Options Page%%% %Key Variables% var keys : array char of boolean var select : int %Fonts% var font1 : int := Font.New ("raavi:24") %procedures and procedure required variables procedure drawoptions cls Font.Draw ("MURDER PONG", 35, 270, font1, 41) locate (4, 15) put "Play Game" locate (6, 18) put "Win" locate (8, 17) put "Speed" locate (10, 15) put "Handicap" locate (12, 15) put "Controls" end drawoptions var maxnumber : int var minnumber : int var changeso : int %Change in procedure selectoptions var altered : int := 5 %Variable that will be altered in procedure selectoptions procedure selectoptions if keys (KEY_UP_ARROW) then if altered = maxnumber then altered := minnumber else altered += changeso end if delay (150) end if if keys (KEY_DOWN_ARROW) then if altered = minnumber then altered := maxnumber else altered -= changeso end if delay (150) end if end selectoptions %Options% var gameto : int := 4 %A player must win (gameto) games to win var gametox2m1 : int % for best ## of ##, this is the last number. var speed : int := 8 %The delay of the main loop will be: delay (speed) var handi1 : int := 0 %Handicap for player 1 var handi2 : int := 0 %Handicap for player 2 loop %play another game loop var winstart : int := Window.Open ("position:centre;centre,graphics:300;300,nobuttonbar,title:Pong,nocursor,offscreenonly") var word : string := "MURDER PONG" var height : int := 24 var x := 35 var y := 270 for rep : 1 .. length (word) delay (100) Font.Draw (word (rep), x, y, font1, 12) x += (Font.Width (word (rep), font1)) View.Update end for delay (500) %Options start here loop drawoptions Input.KeyDown (keys) maxnumber := 5 minnumber := 1 changeso := 1 selectoptions select := altered if select = 1 then Draw.Box (110, 107, 185, 122, 2) elsif select = 2 then Draw.Box (110, 140, 185, 155, 2) elsif select = 3 then Draw.Box (110, 170, 185, 185, 2) elsif select = 4 then Draw.Box (110, 204, 185, 218, 2) elsif select = 5 then Draw.Box (110, 235, 185, 250, 2) end if if keys (KEY_ENTER) then if select = 5 then delay (150) exit elsif select = 4 then delay (150) loop drawoptions Input.KeyDown (keys) Draw.Box (110, 204, 185, 218, 2) maxnumber := 10 minnumber := 1 changeso := 1 altered := gameto selectoptions gameto := altered gametox2m1 := gameto * 2 - 1 locate (maxrow - 2, 14) put "Best ", gameto, " of ", gametox2m1 if keys (KEY_ENTER) then altered := 4 delay (150) exit end if View.Update end loop elsif select = 3 then delay (150) loop drawoptions Input.KeyDown (keys) Draw.Box (110, 170, 185, 185, 2) maxnumber := 9 minnumber := 3 changeso := 1 altered := speed selectoptions speed := altered locate (maxrow - 2, 10) put "Speed (3-9) : ", speed if keys (KEY_ENTER) then altered := 3 delay (150) exit end if View.Update end loop elsif select = 2 then select := 3 delay (150) loop drawoptions Draw.Box (110, 140, 185, 155, 2) locate (maxrow - 3, 5) put "Player 1 Paddle Width ", handi1 locate (maxrow - 2, 5) put "Player 2 Paddle Width ", handi2 locate (maxrow - 1, 5) put "Back" Input.KeyDown (keys) maxnumber := 3 minnumber := 1 changeso := 1 altered := select selectoptions select := altered if select = 3 then Draw.FillOval (18, 65, 3, 3, 2) elsif select = 2 then Draw.FillOval (18, 50, 3, 3, 2) elsif select = 1 then Draw.FillOval (18, 35, 3, 3, 2) end if if keys (KEY_ENTER) then maxnumber := 30 minnumber := -30 changeso := 3 if select = 3 then delay (150) loop drawoptions Draw.Box (110, 140, 185, 155, 2) locate (maxrow - 3, 5) put "Player 1 Paddle Width ", handi1 locate (maxrow - 2, 5) put "Player 2 Paddle Width ", handi2 locate (maxrow - 1, 5) put "Back" Draw.FillOval (18, 65, 3, 3, 10) Input.KeyDown (keys) altered := handi1 selectoptions handi1 := altered if keys (KEY_ENTER) then altered := 3 delay (150) exit end if View.Update end loop elsif select = 2 then delay (150) loop drawoptions Draw.Box (110, 140, 185, 155, 2) locate (maxrow - 3, 5) put "Player 1 Paddle Width ", handi1 locate (maxrow - 2, 5) put "Player 2 Paddle Width ", handi2 locate (maxrow - 1, 5) put "Back" Draw.FillOval (18, 50, 3, 3, 10) Input.KeyDown (keys) altered := handi2 selectoptions handi2 := altered if keys (KEY_ENTER) then altered := 2 delay (150) exit end if View.Update end loop elsif select = 1 then altered := 2 delay (150) exit end if end if View.Update end loop elsif select = 1 then delay (150) loop cls %Draw Table locate (2, 15) put "Player 1" locate (3, 17) put "(top)" locate (2, 25) put "Player 2" locate (3, 25) put "(bottom)" locate (4, 1) put "Move Left" locate (6, 1) put "Move Right" locate (8, 1) put "Hold Ball" locate (10, 1) put "Fast Ball" locate (12, 1) put "Curve Left" locate (14, 1) put "Curve Right" locate (4, 16) put "Delete" locate (6, 16) put "Pg Down" locate (8, 17) put "End" locate (10, 17) put "Home" locate (12, 16) put "Insert" locate (14, 16) put "Pg Up" locate (4, 29) put "A" locate (6, 29) put "D" locate (8, 29) put "S" locate (10, 29) put "W" locate (12, 29) put "Q" locate (14, 29) put "E" Draw.Line (1, 250, maxx, 250, black) Draw.Line (95, 1, 95, maxy, black) locate (maxrow - 1, maxcol div 2 - 2) put "Back" Draw.Box (117, 41, 155, 29, 2) Input.KeyDown (keys) if keys (KEY_ENTER) then delay (150) exit end if View.Update end loop end if end if View.Update end loop cls locate (maxrow div 2 - 1, maxcol div 2 - 5) put "GET READY!" View.Update delay (2500) Window.Close (winstart) %%%Game Beings%%% var wingame : int := Window.Open ("position:centre;centre,graphics:max;max,nobuttonbar,title:Murder Pong") colourback (0) cls var fontgoal : int := Font.New ("Book Antiqua:36:Italic") var score1 : int := 0 var score2 : int := 0 Draw.FillBox (5, 5, 150, 10, 12) const paddle1w : int := 60 + handi1 var paddle : int := Pic.New (5, 5, 5 + paddle1w, 10) Draw.FillBox (5, 5, 150, 10, 12) const paddle2w : int := 60 + handi2 var paddle2 : int := Pic.New (5, 5, 5 + paddle2w, 10) const paddleh : int := 5 cls Draw.FillOval (10, 10, 1, 1, 28) Draw.Oval (10, 10, 3, 3, 27) Draw.Oval (10, 10, 4, 4, 26) Draw.Oval (10, 10, 5, 5, 24) var ball : int := Pic.New (5, 5, 15, 15) var balldx : int := 2 var balldy : int := 3 const ballh : int := 10 const ballw : int := 10 cls View.Set ("offscreenonly") %%%%%% THe main loop %%%%%%% loop var curveright1 : int := 0 var curveleft1 : int := 0 var curveright2 : int := 0 var curveleft2 : int := 0 var fastball1 : int := 0 var fastball2 : int := 0 balldx := 2 if balldy > 0 then balldy := 3 else balldy := -3 end if var ballx : int := maxx div 2 - ballw div 2 var bally : int := maxy div 2 - ballh div 2 var paddle1x : int := maxx div 2 - paddle1w div 2 var paddle2x : int := maxx div 2 - paddle2w div 2 loop cls Input.KeyDown (keys) %%%%Paddle 1 Controls%% if keys (KEY_PGDN) then paddle1x += 4 end if if keys (KEY_DELETE) then paddle1x -= 4 end if if keys (KEY_END) then if ballx > paddle1x and ballx < paddle1x + paddle1w and bally > maxy - 40 and bally < maxy - 30 then fastball1 := 0 fastball2 := 0 ballx := paddle1x + paddle1w div 2 bally := maxy - 25 - ballh end if end if if keys (KEY_HOME) then if ballx > paddle1x and ballx < paddle1x + paddle1w and bally > maxy - 40 and bally < maxy - 30 then fastball1 := 1 end if end if if keys (KEY_INSERT) then if ballx > paddle1x and ballx < paddle1x + paddle1w and bally > maxy - 40 and bally < maxy - 30 then curveleft1 += 1 end if end if if keys (KEY_PGUP) then if ballx > paddle1x and ballx < paddle1x + paddle1w and bally > maxy - 40 and bally < maxy - 30 then curveright1 += 1 end if end if %Don't let Paddle1 go off the screen if paddle1x > maxx - paddle1w then paddle1x := maxx - paddle1w end if if paddle1x < 0 then paddle1x := 0 end if Pic.Draw (paddle, paddle1x, maxy - 25 - paddleh, picMerge) %%%Paddle 2 controls%%%%% if keys ('d') then paddle2x += 4 end if if keys ('a') then paddle2x -= 4 end if if keys ('w') then if ballx > paddle2x and ballx < paddle2x + paddle2w and bally > 30 and bally < 40 then fastball2 := 1 end if end if if keys ('s') then if ballx > paddle2x and ballx < paddle2x + paddle2w and bally > 30 and bally < 40 then fastball1 := 0 fastball2 := 0 ballx := paddle2x + paddle2w div 2 bally := 35 end if end if if keys ('q') then if ballx > paddle2x and ballx < paddle2x + paddle2w and bally > 30 and bally < 40 then curveleft2 += 1 end if end if if keys ('e') then if ballx > paddle2x and ballx < paddle2x + paddle2w and bally > 30 and bally < 40 then curveright2 += 1 end if end if %Don't let Paddle2 go off the screen if paddle2x > maxx - paddle2w then paddle2x := maxx - paddle2w end if if paddle2x < 0 then paddle2x := 0 end if Pic.Draw (paddle2, paddle2x, 25, picMerge) %%%%Ball Properties%%%%%% if curveright1 = 1 then if balldx = 3 then balldx := 4 elsif balldx = 2 then balldx := 3 elsif balldx = 1 then balldx := 2 elsif balldx = 0 then balldx := 1 elsif balldx = -1 then balldx := 0 elsif balldx = -2 then balldx := -1 elsif balldx = -3 then balldx := -2 elsif balldx = -4 then balldx := -3 end if end if if curveleft1 = 1 then if balldx = -3 then balldx := -4 elsif balldx = -2 then balldx := -3 elsif balldx = -1 then balldx := -2 elsif balldx = 0 then balldx := -1 elsif balldx = 1 then balldx := 0 elsif balldx = 2 then balldx := 1 elsif balldx = 3 then balldx := 2 elsif balldx = 4 then balldx := 3 end if end if if curveright2 = 1 then if balldx = 3 then balldx := 4 elsif balldx = 2 then balldx := 3 elsif balldx = 1 then balldx := 2 elsif balldx = 0 then balldx := 1 elsif balldx = -1 then balldx := 0 elsif balldx = -2 then balldx := -1 elsif balldx = -3 then balldx := -2 elsif balldx = -4 then balldx := -3 end if end if if curveleft2 = 1 then if balldx = -3 then balldx := -4 elsif balldx = -2 then balldx := -3 elsif balldx = -1 then balldx := -2 elsif balldx = 0 then balldx := -1 elsif balldx = 1 then balldx := 0 elsif balldx = 2 then balldx := 1 elsif balldx = 3 then balldx := 2 elsif balldx = 4 then balldx := 3 end if end if if ballx < 10 or ballx > maxx - 10 then balldx := -balldx end if if ballx > paddle1x and ballx < paddle1x + paddle1w and bally > maxy - 30 and bally < maxy - 20 then fastball1 := 0 curveleft1 := 2 curveright1 := 2 curveleft2 := 0 curveright2 := 0 balldy := -balldy end if if ballx > paddle2x and ballx < paddle2x + paddle2w and bally > 20 and bally < 30 then fastball2 := 0 curveleft2 := 2 curveright2 := 2 curveleft1 := 0 curveright1 := 0 balldy := -balldy end if ballx += balldx bally += balldy if fastball1 = 1 then if balldy = -3 then balldy := -5 end if else if balldy = -5 then balldy := -3 end if end if if fastball2 = 1 then if balldy = 3 then balldy := 5 end if else if balldy = 5 then balldy := 3 end if end if Pic.Draw (ball, ballx, bally, picMerge) %%%%% SCORING%%%% if bally < 0 then score1 += 1 Font.Draw ("Player 1 Scores!!", 300, 400, fontgoal, green) View.Update loop Input.KeyDown (keys) exit when keys (KEY_ENTER) end loop end if if bally > maxy then score2 += 1 Font.Draw ("Player 2 Scores!!", 300, 400, fontgoal, green) View.Update loop Input.KeyDown (keys) exit when keys (KEY_ENTER) end loop end if View.Update exit when bally > maxy or bally < 0 delay (speed) end loop delay (500) %Display current score var gameover := false if score1 = gameto then loop cls locate (maxrow div 2 - 2, maxcol div 2 - 6) put "PLAYER 1 WINS!!" locate (maxrow div 2 - 1, maxcol div 2 - 4) put score1, " - ", score2 View.Update Input.KeyDown (keys) if keys (KEY_ENTER) then gameover := true delay (150) exit end if end loop elsif score2 = gameto then loop cls locate (maxrow div 2 - 2, maxcol div 2 - 6) put "PLAYER 2 WINS!!" locate (maxrow div 2 - 1, maxcol div 2 - 4) put score1, " - ", score2 View.Update Input.KeyDown (keys) if keys (KEY_ENTER) then gameover := true delay (150) exit end if end loop else loop cls locate (maxrow div 2 - 2, maxcol div 2 - 6) put "P1 - P2" locate (maxrow div 2 - 1, maxcol div 2 - 4) put score1, " - ", score2 View.Update Input.KeyDown (keys) exit when keys (KEY_ENTER) end loop end if exit when gameover = true View.Update end loop Window.Close (wingame) var playagain : string (1) var gameclose := false var winfinal : int := Window.Open ("position:centre;centre,graphics:300;300,nobuttonbar,title:Pong") loop locate (maxrow div 2 - 1, maxcol div 2 - 9) put "Play again? y/n " locate (maxrow div 2 - 1, maxcol div 2 + 8) get playagain if playagain = "y" or playagain = "Y" then delay (150) exit elsif playagain = "n" or playagain = "N" then gameclose := true delay (150) exit else locate (maxrow div 2 - 1, maxcol div 2 + 8) put " " end if end loop Window.Close (winfinal) exit when gameclose = true end loop var winfinal := Window.Open ("position:centre;centre,graphics:300;50,nobuttonbar,title:Thanks for playing!,nocursor") put " Thank you for playing Geoff's Pong" put " Have a nice day " var fontgoal : int := Font.New ("Book Antiqua:36:Italic") Font.Free (font1) Font.Free (fontgoal) see how that fits :) Cheers (oh btw I = CITC) ----------------------------------- ruff_riders91 Tue Jan 13, 2004 10:36 am ----------------------------------- That is Awesome i love how you can curve the ball and speed it up or hold on to it. Good Job :D ----------------------------------- Cervantes Tue Jan 13, 2004 4:10 pm ----------------------------------- thanks ruff. was it slow for you too? I just ran it again and it was slow for me... wierd... I'll play around with it after exams :( ----------------------------------- santabruzer Tue Jan 13, 2004 5:59 pm ----------------------------------- ha ha.. i dunnu.. for a pong game though.. it looks ineffiecient :P.. good job dude.... hard to play alone :P ----------------------------------- ruff_riders91 Wed Jan 14, 2004 10:36 am ----------------------------------- No. For me it wasn't slow at all. We were playing it during compsci class ----------------------------------- Cervantes Wed Jan 14, 2004 9:37 pm ----------------------------------- hehe thats awesome! i don't understand though why its slow sometimes but not other times... :|