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

Username:   Password: 
 RegisterRegister   
 A Basic Game : Pong
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Foundation




PostPosted: Sat Sep 16, 2006 8:36 am   Post subject: A Basic Game : Pong

I followed the tutorial and programmed Pong. I know it's an old game, but please if you have any suggestions or advice, please give freely. I am new to programming, so may have used a lot of extra lines that experienced programmers could have omitted. Thanks for your attention.

You can move up, down, left, and right.

P.S. The confetti file is just a very basic entertaining program I created. No viruses or anything bad. Very Happy , it's very simple, like 20 lines.



Pong (with Confetti).rar
 Description:
The game Pong and a little program that creates a lot of confetti. :D

Download
 Filename:  Pong (with Confetti).rar
 Filesize:  456.37 KB
 Downloaded:  332 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Sat Sep 16, 2006 4:33 pm   Post subject: (No subject)

first of all, when you are posting you .exes, plz just compress them with winZip or WinRar so that its not taking up massive amounts of space Very Happy

on to the program, not bad, but try to keep it so that the paddles dont go off the screen, and make it so that the players have a bit of time before the ball starts to move Wink other than that good job Razz
Foundation




PostPosted: Mon Sep 18, 2006 7:31 am   Post subject: (No subject)

Thanks for the advice Very Happy , I will put all my future files in a zip folder. I tried to make it so that the paddles go off the bottom and appear on the top. Razz And if it goes out on the sides, or the middle, it will appear in the middle or on the sides respectively. Wink I will try harder to make a good program in the future.

Now, it pauses a second before starting the game every time. Very Happy

P.S. Is there any way of making this "Looped Confetti" more efficient?

code:

var x, y, c : int;
setscreen ("graphics:640;480,position:center;center,nobuttonbar,offscreenonly,title: Confetti -- By Foundation")
var font := Font.New ("impact:24:bold,italic")
var font2 := Font.New ("comicsans:24:bold")
for i : 1 .. 1000
    randint (c, 1, 15)
    Font.Draw ("We Give You : continuous CONFETTI!!!", 75, maxy div 2, font, c)
    delay (3)
    View.Update
    cls
end for
delay (500)
var start : string (1)
for i : 1 .. 500
    randint (c, 1, 255)
    Font.Draw ("Well, Press a Button!", 150, maxy div 2, font2, c)
    put "Press a button to exit."
    delay (3)
    View.Update
    cls
end for
getch (start)
var ending : string (1)
setscreen ("nooffscreenonly")
loop
    for i : 1 .. 768000
        randint (x, 0, maxx);
        randint (y, 0, maxy);
        randint (c, 1, 15);
        drawdot (x, y, c);
    end for
    for i : 1 .. 3072000
        randint (x, 0, maxx);
        randint (y, 0, maxy);
        c := 255;
        drawdot (x, y, c);
    end for
    for i : 1 .. 2304000
        randint (x, 0, maxx);
        randint (y, 0, maxy);
        c := 0;
        drawdot (x, y, c);
    end for
end loop
TheOneTrueGod




PostPosted: Mon Sep 18, 2006 9:51 pm   Post subject: (No subject)

Er, not have it?

You could allways use math... Have an array of numbers, from 0 to maxx*maxy, each one representing a pixel on the screen. Then, just randomize the order of these integers, and draw a random colour on each one in turn. This will ensure that the entire screen gets covered, and it would be the minimal time that you could do it in (if you use individual pixels). Either way, this sort of effect really isn't worth the effort...
Foundation




PostPosted: Tue Sep 19, 2006 7:31 am   Post subject: (No subject)

Oh. So to have limited random effect... and random cover the entire screen. Laughing .

That would take less time...
BenLi




PostPosted: Tue Sep 19, 2006 8:05 am   Post subject: (No subject)

well i guess this kind of thing is the first step to making more advanced effects and graphics...
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  [ 6 Posts ]
Jump to:   


Style:  
Search: