Computer Science Canada Pong Help |
| Author: | upthescale [ Sat Mar 18, 2006 11:20 pm ] | ||
| Post subject: | Pong Help | ||
ok i can make a ball move easily
what ever..he ball movs but when i do a square, it just extends and gets bigger...how do i make it so the whole square moves and not just get bigger? |
|||
| Author: | [Gandalf] [ Sat Mar 18, 2006 11:43 pm ] | ||
| Post subject: | |||
Use cls to clear the screen every time it is executed. So here's your current code improved using cls:
Now, I believe the problem with your box code is that you are mixing up the parameters. They are: Quote: drawfillbox (x1, y1, x2, y2, Color : int)
As on a Cartesian plane. Also, indent your code properly in the future. |
|||
| Author: | upthescale [ Sun Mar 19, 2006 12:17 am ] |
| Post subject: | |
ok i got the saqure to move fine down the screen, i wana do it so if the mouse touchs any pixel of the square, the game wil say you lose, shud i use mousewhere? and how cuz the squae is moving |
|
| Author: | Flikerator [ Sun Mar 19, 2006 12:37 am ] |
| Post subject: | |
Use Mouse.Where, and look up whatdotcolor in the help file. exit when whatdotcolor (Mx,My) = boxcolor or exit when Mx > ### and Mx < ### and My... Mx and My are the mouse coordinates. After the loop have the "You've been pwned" |
|
| Author: | Cervantes [ Sun Mar 19, 2006 9:27 am ] | ||
| Post subject: | |||
Let's avoid whatdotcolour, shall we? It's a bad approach to collision detection, especially for newbies. Go with the second approach:
|
|||
| Author: | MysticVegeta [ Sun Mar 19, 2006 10:47 am ] | ||||
| Post subject: | |||||
If you have Turing >= 4.05 then, this can be achieved more simply by
All you need to do is check if the distance is < what ever you want it to be less than |
|||||
| Author: | [Gandalf] [ Sun Mar 19, 2006 6:06 pm ] |
| Post subject: | |
Ehm... Why use Math.Distance to check collision on a box? It's just adding extra complications. |
|