Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Help on modifying the Paddleball code.
Author Message
MfIrE

Posted: Fri May 14, 2004 3:33 pm   Post subject: Help on modifying the Paddleball code.

For the final project for computer science, we were to find a source code, use that and also make the game educational. So I choose the paddleball.t (not the paddleball2.t) What I decided to do was: every 30 secs, a fruit would come up on a random part of the screen. Upon the ball hitting the fruit, it would clear the screen and give you a math question. If you got it right, you would get +10, if wrong -10. After you would go back to the game and continue.

I got how to randomize the fruit, but not how to change the screen. Any help?

Here's the randomizing fruit (kinda looks like a ball lol. I suck )

var x, y : int := 0
randint (x, 21, 378)
randint (y, 220, 470)
drawfilloval (x, y, 20, 20, 12)

Lastly, Credit goes to Paul Bian. You. Are. Awesome.

Dan

Posted: Fri May 14, 2004 4:19 pm   Post subject: (No subject)

well you need to uses colsion dection to check if the ball has hit it. You have the x and y of the ball and the x and y of the fruit so you can uses some math and if staments to check if the ball has hit the fruit.

Here are some links to tutorials on this site about colsion dection:

http://www.compsci.ca/v2/viewtopic.php?t=75 (look down this one two, there are some tips on difrent kinds of closion dection)

http://www.compsci.ca/v2/viewtopic.php?t=129 (this one whould help with making the ball boucning better)

http://www.compsci.ca/v2/viewtopic.php?t=2381 (some info on whatdot color, not the best way of doing colosion dection but will work)

there are also many help posts and submisions that deal with colisione dection that you could find by using the search fuction of this site.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Paul

Posted: Fri May 14, 2004 8:50 pm   Post subject: Re: Help on modifying the Paddleball code.

MfIrE wrote:
Lastly, Credit goes to Paul Bian. You. Are. Awesome.

Awesome indeed, though I must warn u, the path of the ball is sometimes predictable (actually almost all the time) thats the point of the paddleball 2 source, so u wouldn't get it so easily. Anyway, I didn't do the randomizing slope of path thingy, because I hated it, it sped up irregularily and stuff. You'd prolly wanna try it out, just to see.
white_dragon

Posted: Sat May 15, 2004 4:25 pm   Post subject: (No subject)

haha! u can easily base that program usin shantz's code!
Paul

Posted: Sat May 15, 2004 5:10 pm   Post subject: (No subject)

FYI I made this in 20 min, the first class shantz was explaining, and B4 he finished explaining how to move the freaking paddle I won't say anything mean...
SuperGenius

Posted: Sat May 15, 2004 10:00 pm   Post subject: (No subject)

You guys may find this amusing but I'm doing Super Breakout for my summative. What I've got so far is based on Shantz's code, although I may have to change it in the name of efficency.
Paul

Posted: Sat May 15, 2004 10:01 pm   Post subject: (No subject)

Shantz's codes are crap, you should never use them.
SuperGenius

Posted: Sat May 15, 2004 10:07 pm   Post subject: (No subject)

Ouch, that hurts. I agree that the origional code he gave us was not very efficent, but I fixed that up a little. The thing is though, our class is very stupid compared to yours paul. in our class 14 people failed the Work Hours test, for example. This means that he has to spend a lot of time explaining things to people that a few of us understood right away. The end result of a year of this is that we haven't learned all the good stuff to make a game with.

MfIrE

Posted: Sat May 29, 2004 10:11 am   Post subject: (No subject)

With what i've learned from the collision thing..
I've tried it, but it didn't work properly
Can someone check whats wrong?
Thanks

Paul

Posted: Sat May 29, 2004 11:30 am   Post subject: (No subject)

Oh, you wanna hit the cherry? and have it dissapear? You can use whatdotcolor for that, and if the ball hits the cherry, add one point, then cls and draw the cherry somewhere else.
P.S.: you can at least change the colors around a bit lol, so it wouldn't look exactly like my program plus a cherry
MfIrE

Posted: Sat May 29, 2004 11:34 am   Post subject: (No subject)

haha
nonono
What I want it to do is:
When the Ball touches the Cherry, it'll freeze or something, and give you a math question to answer. Upon getting it right +10 is awarded, and you if you get it wrong -10 is awarded. (In addition to the 5 points awarded when hitting the paddle)
Cervantes

Posted: Sat May 29, 2004 11:44 am   Post subject: (No subject)

 code: if ball collides with cherry cls your math question here if answer = correct then points += 10 else points -= 10 end if end if
MfIrE

Posted: Sat May 29, 2004 12:07 pm   Post subject: (No subject)

So you mean what I did was right? And all I had to do was add the math question thing? What I wanted to do was "When the Ball touches the Cherry, it'll freeze or something, and give you a math question to answer. Upon getting it right +10 is awarded, and you if you get it wrong -10 is awarded. (In addition to the 5 points awarded when hitting the paddle)" Also what I forgot to say was: after answering the math question, the game would continue. Then at like maybe 50 points it'll change from addition to subtraction.
Paul

Posted: Sat May 29, 2004 12:32 pm   Post subject: (No subject)

well, get or getch would effectively stop the program, all you have to do is insert the problem when the ball touches the cherry. Make sure u using View.Update to make the question show, and then after getting the answer, the game would continue. And just use the score, to determine the kinds of questions, I don't know whether ur using arrays, or text files or random numbers ...[/code]
MfIrE

Posted: Sat May 29, 2004 12:54 pm   Post subject: (No subject)

The code I used to collide the ball with the cherry. Is it right though? I just want to make sure before I continue.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 2  [ 18 Posts ]
Goto page 1, 2  Next
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: