Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 paddle ball
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
abysspell




PostPosted: Mon Dec 04, 2006 10:48 am   Post subject: paddle ball

something I made in class, I think that its fun! what do you think?


/* Paddle Ball */


%Beggining
var font1, font2, font3 : int
var any : string (1)
var sel : int
var padsiz, balspeed : int
var speed : int
var pla : string


loop

drawfillbox (0, 0, 700, 400, 7)

font1 := Font.New ("tahoma:50:italic")
font2 := Font.New ("tahoma:20:italic")
font3 := Font.New ("tahoma:10:italic")
assert font1 > 0
assert font2 > 0
assert font3 > 0
Font.Draw ("Welcome To", 230, 280, font2, yellow)
Font.Draw ("Paddle Ball", 140, 192, font1, yellow)

Font.Draw ("Press Any Key To Continue", 225, 90, font3, yellow)

getch (any)
Music.Sound (300,100)
cls

put "Main Screen"
put "Please Select One"
put "1- Start Game"
put "2- Game Options"
get sel
Music.Sound (300,100)

cls

if sel = 1
then
padsiz := 2
balspeed := 3
put "Press Any Key To Play"
Music.Sound (300,100)
elsif sel = 2
then
put "Please select a paddle size:"
put "1 - 2 - 3 - 4 - 5"
get padsiz
Music.Sound (300,100)
put "Please select a ball speed:"
put "1 - 2 - 3 - 4 - 5"
get balspeed
Music.Sound (300,100)
put "Press 5 to play with settings"
Music.Sound (300,100)
end if

getch (any)
cls





%Background
drawfillbox (0, 0, 700, 400, 11)

View.Set ("offscreenonly")


% Variables
var key : string (1) %Getch Commands
var num : int %Key Board Input
var x1, x2 : int %Paddle Ball Coordinates
var xdir, ydir : int
var x, y : int
var count : int


if padsiz = 1
then
x1 := 100
x2 := 175
elsif padsiz = 2
then
x1 := 100
x2 := 200
elsif padsiz = 3
then
x1 := 100
x2 := 225
elsif padsiz = 4
then
x1 := 100
x2 := 250
elsif padsiz = 5
then
x1 := 100
x2 := 275
end if

if balspeed = 1
then
speed := 30
elsif balspeed = 2
then
speed := 25
elsif balspeed = 3
then
speed := 20
elsif balspeed = 4
then
speed := 15
elsif balspeed = 5
then
speed := 10
end if


% Paddle

num := 0

x := 100
y := 100

xdir := 5
ydir := 5

count := 0

loop
locate (1, 1)
colorback (11)
put "Score", count

% Ball
drawfilloval (x, y, 10, 10, 4)
drawfillbox (x1, 10, x2, 20, 4)
View.Update
delay (speed)
drawfilloval (x, y, 10, 10, 11)
drawfillbox (x1, 10, x2, 20, 11)

if x > 630
then
xdir := -5
Music.Sound (300,100)
elsif x < 10
then
xdir := 5
Music.Sound (300,100)
elsif y > 390
then
ydir := -5
Music.Sound (300,100)
elsif y < 30 and x > x1 and x < x2
then
ydir := 5
count := count + 1
Music.Sound (500,100)
elsif y < 10
then
ydir := 5
end if

x := x + xdir
y := y + ydir

exit when y = 10

% Paddle


if hasch
then
getch (key)
num := ord (key)
end if

if num = 203 and x1 > 0 then

x1 := x1 - 10
x2 := x2 - 10
elsif num = 205 and x2 < 640
then
x1 := x1 + 10
x2 := x2 + 10
end if

num := 0

end loop

drawfillbox (0, 0, 700, 400, 7)
Font.Draw ("GAME OVER", 150, 210, font1, yellow)
Music.Sound (300,300)
Music.Sound (400,300)
Music.Sound (500,300)
Music.Sound (600,300)
Music.Sound (700,300)

View.Set ("nooffscreenonly")
delay (2000)
cls

drawfillbox (0, 0, 700, 400, 3)
colorback (3)
put "Congrats, your score is ", count,"."
put "Would you like to play again?y/n"
get pla

if pla = "y"
then
else
exit
end if

end loop

cls
Font.Draw ("Thanks For Playing",200, 250, font2, yellow)
Sponsor
Sponsor
Sponsor
sponsor
Voltage128




PostPosted: Mon Dec 04, 2006 4:01 pm   Post subject: (No subject)

It is alright. A couple easy errors to fix. When you type in any number over 5 on your settings, or if you type a letter it casues and error and closes the game. Simple thing to make it look better is when you have your score at the top but a colon between then word and the score. Also when the balls hits the wall it sort of pauses, you should make that a constant flow.
uberwalla




PostPosted: Mon Dec 04, 2006 4:31 pm   Post subject: (No subject)

hmmm what i think; what i think.

first of all i think u should use code tags next time Razz

other then that i think it was ok. the paddle was very laggy but i fixed that. (it was my comp settings Embarassed )
KevinW




PostPosted: Wed Dec 06, 2006 10:28 pm   Post subject: (No subject)

there's a bug... if the ball gets halfway into the paddle* you can get like 3 points before it deflects off.

*The way you can get the ball into the paddle is by waiting until the ball is almost at 1/3 from the bottom then moving in to get the ball...

It's confusing, hard to explain..XD
Hackmaster




PostPosted: Tue Dec 12, 2006 9:45 am   Post subject: (No subject)

I noticed the bug that kevin noticed, but, I also noticed that it was REALLY, REALLY laggy. that can be fixed with a simple view.update, and some takepic/drawpics, as opposed to just redrawing the boxes each time.

otherwise, fairly unique version of "pong". Very Happy
petree08




PostPosted: Fri Dec 15, 2006 10:25 am   Post subject: (No subject)

yeah that's ok (if your just beggining) it would be interesting if you put it into a block smasher type game
asd




PostPosted: Mon Jan 08, 2007 11:01 am   Post subject: Re: paddle ball

This is the worst game I've ever played. I hope you never get into any university, you wasted a few minutes of my life and now I'm going to go and BooHoo
Clayton




PostPosted: Mon Jan 08, 2007 2:27 pm   Post subject: Re: paddle ball

Flaming is against [The Rules] (hope the autolink still works), please read them before you post again. He obviously enjoys his program, so don't beat him down about it.
Sponsor
Sponsor
Sponsor
sponsor
Kerpail




PostPosted: Mon Jan 08, 2007 6:51 pm   Post subject: RE:paddle ball

The paddle wont move for me...
asd




PostPosted: Mon Jan 15, 2007 10:41 am   Post subject: Re: paddle ball

please help me, my graphics card can't support this awesome piece of art Canada Canada Canada Canada Canada
lawl nawt ill call the RCMP on you
CodyNassis




PostPosted: Mon Jan 15, 2007 10:48 am   Post subject: RE:paddle ball

IT VERY NICE I ESPECIALY LIKE HAO U CAN CHEAT AND PIK HAO BIG THE PATTLE IS AND HAO LITLE DA BALL IS ^_^ LOL VERY EZ EZ
zedx_26




PostPosted: Sun Jan 21, 2007 10:19 pm   Post subject: RE:paddle ball

it is fun to play and i think it is preety good if you are new programer like me.
it was fun to play
keep up the good work
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 12 Posts ]
Jump to:   


Style:  
Search: