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

Username:   Password: 
 RegisterRegister   
 My Best Program (Space Pong!)
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Do you like my Space Pong???
(No ending time set)
Yes
42%
 42%  [ 3 ]
No
0%
 0%  [ 0 ]
a little bit
42%
 42%  [ 3 ]
it should'nt exist
14%
 14%  [ 1 ]
Total Votes : 7

Author Message
Darkmantis




PostPosted: Tue May 16, 2006 2:35 pm   Post subject: My Best Program (Space Pong!)

This is my best program that I've created Very Happy
Enjoy!



The Extension 'exe' was deactivated by an board admin, therefore this Attachment is not displayed.

Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Tue May 16, 2006 3:38 pm   Post subject: (No subject)

um a couple of things about this. INCLUDE INSTRUCTIONS!!!! this is a major problem for a lot of people, no one wants to include instructions with their games. every1 thinks that the user should know what to do automatically for some reason. also, in the actual game, are you using View.Update? if not look into it to reduce the flickering on the screen, as well, whenever a paddle moves, the program slows down like a bugger, try to eliminate that, also, something with your obstacles arent working, all i had was a little dot on the screen that the ball just erased, other than that not bad Very Happy oh another thing, allow the user to adjust the speed of the ball (you could use *gulp* GUI.CreateHorizontalScrollBar) to make it easier for the user to control the game Very Happy
Darkmantis




PostPosted: Wed May 17, 2006 6:45 am   Post subject: (No subject)

awesome thx Very Happy Ill get to doing that, and ya it does slow down a lot but my and my bro have so much fun playing but we put like 20 obstacles so usually the ball is bouncing at only 1 player lol Very Happy, anywho..sorry about the instructions thing, I shouldve added that to the start of the game before you enter the information. And thx again for your help Very Happy
Guest




PostPosted: Tue May 23, 2006 3:21 pm   Post subject: FunFun

This game is fun Laughing Very Happy
Darkmantis




PostPosted: Tue May 23, 2006 8:07 pm   Post subject: (No subject)

I know and thx Very Happy
Darkmantis




PostPosted: Mon May 29, 2006 10:50 am   Post subject: (No subject)

I need help placing my view.update where should I put it?
And what should I do to stop the program from slowing down when the paddles move?

edited*
code:
setscreen ("graphics:610;400,nocursor")
var ballx, bally, paddleleftx, paddlelefty, paddlerightx, paddlerighty, direction1, direction2, c1, c2, c3, c4, o, q, t, r : int
var score, score2, scorel : int
var kp : array char of boolean
var ch : string (1)
var font1, font2, font3, font4, font5 : int
randint (ballx, 40, 360)
randint (bally, 40, 350)
paddleleftx := 30
paddlelefty := 180
paddlerightx := 580
paddlerighty := 180
score := 0
score2 := 0
direction1 := 1
direction2 := 1
font1 := Font.New ("serif:28")
font2 := Font.New ("serif:20")
font3 := Font.New ("serif:40")
font4 := Font.New ("serif:33")
font5 := Font.New ("serif:75")
procedure pong
    Draw.ThickLine (paddleleftx, paddlelefty, paddleleftx, paddlelefty + 30, 10, black)
    Draw.ThickLine (paddlerightx, paddlerighty, paddlerightx, paddlerighty + 30, 10, black)
    Draw.ThickLine (0, 365, 610, 365, 5, black)
    Draw.ThickLine (0, 40, 610, 40, 5, black)
    loop
        drawfilloval (ballx, bally, 3, 3, brightblue)
        delay (3)
        drawfilloval (ballx, bally, 3, 3, white)
        if ballx = 0 then
            score := score + 1
        end if
        if ballx = 610 then
            score2 := score2 + 1
        end if
        locate (1, 30)
        put "Paddle Right: ", score
        locate (2, 30)
        put "Paddle Left: ", score2
        locate (20, 30)
        c1 := whatdotcolor (ballx - 4, bally)
        c2 := whatdotcolor (ballx + 4, bally)
        c3 := whatdotcolor (ballx, bally + 4)
        c4 := whatdotcolor (ballx, bally - 4)
        if ballx > maxx and direction1 > 0 then
            direction1 := -direction1
        elsif ballx < 1 and direction1 < 0 then
            direction1 := -direction1
        elsif bally > maxy and direction2 > 0 then
            direction2 := -direction2
        elsif bally < 1 and direction2 < 0 then
            direction2 := -direction2
        end if
        if c1 = black then
            direction1 := -direction1
        end if
        if c2 = black then
            direction1 := -direction1
        end if
        if c3 = black then
            direction2 := -direction2
        end if
        if c4 = black then
            direction2 := -direction2
        end if
        ballx := ballx + direction1
        bally := bally + direction2
        Input.KeyDown (kp)
        if kp ('w') then
            Draw.ThickLine (paddleleftx, paddlelefty, paddleleftx, paddlelefty + 30, 12, white)
            Draw.ThickLine (paddleleftx, paddlelefty, paddleleftx, paddlelefty + 30, 10, black)
            delay (1)
            paddlelefty := paddlelefty + 1
            if paddlelefty > 325 then
                paddlelefty := paddlelefty - 1
            end if
        end if
        if kp ('s') then
            Draw.ThickLine (paddleleftx, paddlelefty, paddleleftx, paddlelefty + 30, 12, white)
            Draw.ThickLine (paddleleftx, paddlelefty, paddleleftx, paddlelefty + 30, 10, black)
            delay (1)
            paddlelefty := paddlelefty - 1
            if paddlelefty < 50 then
                paddlelefty := paddlelefty + 1
            end if
        end if
        if kp (KEY_UP_ARROW) then
            Draw.ThickLine (paddlerightx, paddlerighty, paddlerightx, paddlerighty + 30, 12, white)
            Draw.ThickLine (paddlerightx, paddlerighty, paddlerightx, paddlerighty + 30, 10, black)
            delay (1)
            paddlerighty := paddlerighty + 1
            if paddlerighty > 325 then
                paddlerighty := paddlerighty - 1
            end if
        end if
        if kp (KEY_DOWN_ARROW) then
            Draw.ThickLine (paddlerightx, paddlerighty, paddlerightx, paddlerighty + 30, 12, white)
            Draw.ThickLine (paddlerightx, paddlerighty, paddlerightx, paddlerighty + 30, 10, black)
            delay (1)
            paddlerighty := paddlerighty - 1
            if paddlerighty < 50 then
                paddlerighty := paddlerighty + 1
            end if
        end if
        if score = scorel then
            cls
            Draw.ThickLine (paddlerightx, paddlerighty, paddlerightx, paddlerighty + 30, 10, black)
            delay (1)
            Draw.Text ("Right Paddle Wins!!!", 150, 200, font3, green)
            return
        elsif score2 = scorel then
            cls
            Draw.ThickLine (paddleleftx, paddlelefty, paddleleftx, paddlelefty + 30, 10, black)
            Draw.Text ("Left Paddle Wins!!!", 150, 200, font3, green)
            return
        end if
    end loop
end pong

procedure mainmenu
    Draw.Text ("Space Pong!", 155, 300, font3, green)
    Draw.Text ("PRESS ANY KEY TO CONTINUE", 125, 50, font2, green)
    getch (ch)
    cls
    put "Choose the score limit"
    get scorel
    Draw.Text ("PRESS ANY KEY TO CONTINUE", 125, 50, font2, green)
    getch (ch)
    cls
    put "How many obstacle?"
    get o
    Draw.Text ("PRESS ANY KEY TO CONTINUE", 125, 50, font2, green)
    getch (ch)
    cls
    Draw.Text ("5", 280, 190, font5, green)
    delay (1000)
    cls
    Draw.Text ("4", 280, 190, font5, green)
    delay (1000)
    cls
    Draw.Text ("3", 280, 190, font5, green)
    delay (1000)
    cls
    Draw.Text ("2", 280, 190, font5, green)
    delay (1000)
    cls
    Draw.Text ("1", 280, 190, font5, green)
    delay (1000)
    cls
    Draw.ThickLine (paddleleftx, paddlelefty, paddleleftx, paddlelefty + 30, 10, black)
    Draw.ThickLine (paddlerightx, paddlerighty, paddlerightx, paddlerighty + 30, 10, black)
    Draw.ThickLine (0, 365, 610, 365, 5, black)
    Draw.ThickLine (0, 40, 610, 40, 5, black)
    Draw.Text ("GO!", 270, 200, font3, green)
    delay (1000)
    Draw.Text ("GO!", 270, 200, font3, white)

    for p : 1 .. o
        randint (q, 1, 25)
        randint (t, 40, 590)
        randint (r, 40, 350)
        drawfilloval (t, r, q, q, black)
    end for
    pong
end mainmenu

setscreen ("position:truemiddle,centre")
var clr : int := 218
var text1 : int := Font.New ("Times New Roman:38:Bold")
drawfillbox (0, 0, 610, 400, black)
for n : 0 .. 39
    RGB.SetColor (clr, 0, n / 39, 0)
    Font.Draw ("DarkMantis Productions", (maxx div 2) - (Font.Width ("DarkMantis Productions", text1) div 2), (maxy div 1.5) - 9, text1, clr)
    RGB.SetColor (clr, 0, n / 39, 0)
    Font.Draw ("Presents...", (maxx div 2) - (Font.Width ("Presents...", text1) div 2), (maxy div 2.5) - 9, text1, clr)
    View.Update
    delay (50)
end for
delay (1000)
for decreasing n : 39 .. 0
    RGB.SetColor (clr, 0, n / 39, 0)
    Font.Draw ("DarkMantis Productions", (maxx div 2) - (Font.Width ("DarkMantis Productions", text1) div 2), (maxy div 1.5) - 9, text1, clr)
    RGB.SetColor (clr, 0, n / 39, 0)
    Font.Draw ("Presents...", (maxx div 2) - (Font.Width ("Presents...", text1) div 2), (maxy div 2.5) - 9, text1, clr)
    View.Update
    delay (50)
end for

mainmenu
NikG




PostPosted: Mon May 29, 2006 2:30 pm   Post subject: (No subject)

The code you posted doesn't work.

I think you missed the top line or something containing 17 var declarations, which btw are named TERRIBLY! You practically have all the letters of the alphabet as a variable.

To make it easier for yourself (and for those trying to help you), you should rename those variables to something you can easily recognize (i.e. x->BallX, y->BallY...)
Darkmantis




PostPosted: Tue May 30, 2006 10:49 am   Post subject: (No subject)

Ok, i've taken your advice and renamed most of my variables and added the lines I missed in the newly edited post.
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: