Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Complicated Pong

Author
Message
Foretore
14
Years of Service
User Offline
Joined: 5th Nov 2009
Location: MN
Posted: 16th Nov 2010 05:26
I tried my hand at putting trying to put 2 different games or modes or whatever you want to call them into one and that was a total failure. The first mode works fine by itself without the extra code and so does the other one, but the way I'm "merging" them doesn't really want to work no matter how hard I mull this over. The second mode isn't done so don't point that out I already know. I'm pretty sure it's the fact I'm using functions, but I'm just going watch as someone totally schools my code.

As a side note, the background is always blue for some reason unless I use CLS RGB(0,0,0). Otherwise I wouldn't be using that, since there's nothing to really "clear".

It's about 300 lines, so look out.



I couldn't figure out how to load multiple files, sorry. I'm sure someone can just whip up 3 colored sprites in 5 seconds.

e8400@3.8GHz
GTS 250 750-1836-1100

Attachments

Login to view attachments
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 18th Nov 2010 04:36 Edited at: 18th Nov 2010 15:43
I'm surprised that it compiles. When declaring your Pong and WallBall functions, you omitted the required brackets [i.e. function Pong(), function WallBall()]

Not at my comp right now, but I can take a look at it tomorrow to see if I can point out anything else that will be helpful.

EDIT: You have a subroutine located within a function. Instead of making Pong() and Wallball() functions, make them subroutines instead.

Also, you will need to establish one common variable name for each of the balls. I would not use local variables in this case, and since you are not using functions, you won't need any global variables.

The ball does not move and as soon as I try to move one of the paddles, it errors. I'll see if I can find the problem(s).

Foretore
14
Years of Service
User Offline
Joined: 5th Nov 2009
Location: MN
Posted: 19th Nov 2010 23:26
Hey, thanks for taking a look at it.
Yeah, I thought I might have to just use a subroutine instead of a function. In my head it just looked a lot cleaner and maybe a lot less hassle, but I guess not . I'll make sure to clean up all the local and global stuff and post up the new stuff.

e8400@3.8GHz
GTS 250 750-1836-1100

Login to post a reply

Server time is: 2024-09-29 00:16:06
Your offset time is: 2024-09-29 00:16:06