Computer Science Canada need help with ball streak |
Author: | Azzy [ Tue Jan 13, 2004 4:20 pm ] | ||
Post subject: | need help with ball streak | ||
got me a big probelm.this is for my project and for this step i need to make a ball move up and down.problem is that when it does move there's a streak left behind. i always could use some help shortening it as well. here it is
|
Author: | Tony [ Tue Jan 13, 2004 4:24 pm ] |
Post subject: | |
you forgot to clear the ball... you ether draw a white one on top of the ball or just use cls to clear the entire screen. |
Author: | Azzy [ Tue Jan 13, 2004 4:29 pm ] |
Post subject: | |
Sweet.Thanks.Now for step 3.Make a ball going from left to right. |
Author: | Cervantes [ Tue Jan 13, 2004 4:32 pm ] |
Post subject: | |
wow all those Draw.Box use a for statement for that kind of thing, will save you SO much trouble. you should also use offscreenonly View.Set ("offscreenonly") then use View.Update if you want to learn about it go to your Turing folder (where its installed to, not where you save your programs necessarily) and go to examples\fun\SmoothAnimatedHouse.t good example of how to use View.Update there. |
Author: | Azzy [ Wed Jan 14, 2004 4:09 pm ] |
Post subject: | |
thanks for that help guys.but now i got another problem.i need to make a counter that holds how many times two balls collide.i have absolutely no clue how to do that.can anyone help me? |
Author: | shorthair [ Wed Jan 14, 2004 4:29 pm ] |
Post subject: | |
if ball1x = ball2x and ball1y = ball2y then count := count +1 end if |
Author: | Azzy [ Wed Jan 14, 2004 9:12 pm ] |
Post subject: | |
that does help a bit but i need it so even if it touches the ball at the rim it counts it. |
Author: | Cervantes [ Wed Jan 14, 2004 9:34 pm ] |
Post subject: | |
well are you going to make the balls bounce apart?? that would be super hard to do right (as I just found out recently ) if not then what shorthair said will do it |
Author: | Azzy [ Wed Jan 14, 2004 9:35 pm ] |
Post subject: | |
well...actually.that's part 5 and 6.5 is just it going backwards.easy.while 6 is using physics.bouncing everywhere. |
Author: | Cervantes [ Wed Jan 14, 2004 9:42 pm ] |
Post subject: | |
well if they aren't going to pass through each other then you could always use whatdotcolor to solve your worries or you could use an if statement to determine whether the x and y movement has changed, sorry though I gotta get to bed, can't think about it now. |
Author: | Hunter007 [ Thu Jan 15, 2004 4:40 pm ] |
Post subject: | |
Hey I'm working on the same prog, but I'm behind Azzy. I need to know how to make the ball move. Thanks for any help. |
Author: | shorthair [ Thu Jan 15, 2004 5:02 pm ] |
Post subject: | |
okay about hte ballx and bally that i posted , depending on the diameter you can say if ballx+10 = bally+10 then count := count+1 end if assuming that you have a radius of 10 on each side play with the numbers to see what works |
Author: | Thuged_Out_G [ Thu Jan 15, 2004 5:11 pm ] |
Post subject: | |
bouncing apart...would be something like this(i think) if ballx=ballx2 and bally=bally2 then ballxdir:=-ballxdir ballydir:=-ballydir end if |
Author: | Azzy [ Thu Jan 15, 2004 5:21 pm ] | ||
Post subject: | |||
ok now some more problems. 1.when the counter goes up, it goes up twice 2.it doesn't go up if it's at the edge of the ball.
|
Author: | shorthair [ Thu Jan 15, 2004 7:27 pm ] |
Post subject: | |
TRACE your program , i garuntee you wil lfind your problem , this is when trace becomes very handy. |
Author: | Hunter007 [ Sat Jan 17, 2004 8:31 pm ] | ||
Post subject: | |||
I'm working on the same program and I have a problem. I need to add a collision counter, but the thing is my code is different.
If someone can help me it would be greatly appreciated. |
Author: | Tony [ Sat Jan 17, 2004 8:32 pm ] |
Post subject: | |
well you see where you got your dx1 := -dx1 parts in the loop? Thats where your collision occurs and you should increment you counter right after |
Author: | Hunter007 [ Sat Jan 17, 2004 8:40 pm ] | ||
Post subject: | |||
I'm not sure I understand what you mean. I tried this:
It didn't work. It said that if must be boolean type. |
Author: | Azzy [ Sun Jan 18, 2004 8:27 am ] | ||
Post subject: | |||
you had a colon in the first part of it.that's a no no.
|