Computer Science Canada Help on modifying the Paddleball code. |
Author: | MfIrE [ 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. |
Author: | Dan [ Fri May 14, 2004 4:19 pm ] |
Post 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. |
Author: | Paul [ 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. |
Author: | white_dragon [ Sat May 15, 2004 4:25 pm ] |
Post subject: | |
haha! u can easily base that program usin shantz's code! |
Author: | Paul [ Sat May 15, 2004 5:10 pm ] |
Post 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... |
Author: | SuperGenius [ Sat May 15, 2004 10:00 pm ] |
Post 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. |
Author: | Paul [ Sat May 15, 2004 10:01 pm ] |
Post subject: | |
Shantz's codes are crap, you should never use them. |
Author: | SuperGenius [ Sat May 15, 2004 10:07 pm ] |
Post 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. |
Author: | MfIrE [ Sat May 29, 2004 10:11 am ] | ||
Post 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
|
Author: | Paul [ Sat May 29, 2004 11:30 am ] |
Post 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 |
Author: | MfIrE [ Sat May 29, 2004 11:34 am ] |
Post 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) |
Author: | Cervantes [ Sat May 29, 2004 11:44 am ] | ||
Post subject: | |||
|
Author: | MfIrE [ Sat May 29, 2004 12:07 pm ] |
Post 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. |
Author: | Paul [ Sat May 29, 2004 12:32 pm ] |
Post 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] |
Author: | MfIrE [ Sat May 29, 2004 12:54 pm ] |
Post 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. |
Author: | SuperGenius [ Sat May 29, 2004 6:18 pm ] |
Post subject: | |
perhaps it would be good to use window.open or whatever for the question, so that you dont have to deal with erasing and/or redrawing the main screen. I dont exactly know how it works but i gather that you can open a second window using Window.Open(winID) and close it using Window.Close(winID). I have a question about secondary windows though.... how do you tell turing which window a certain command pertains to? |
Author: | Paul [ Sat May 29, 2004 8:18 pm ] | ||
Post subject: | |||
Im not sure, but it might be along the lines of this:
you could check up on that. |
Author: | MfIrE [ Sun May 30, 2004 4:11 pm ] |
Post subject: | |
dammit I can't get it to work? Can someone help? I'm not sure what to do now. I just want to add the question now. Although I'm not sure if my code currently is even right. |