Computer Science Canada Scoring System -- How would I set it up? |
Author: | PerylDemise [ Thu Mar 23, 2006 10:04 pm ] |
Post subject: | Scoring System -- How would I set it up? |
ok. Reposting, sorry. For my scoring system, on a dart board. My dart is an oval *graphic form* and the dart board is in graphic form too. How would I calculate the distance between the two of them? Would I use the distance formula? : distance := sqrt[(x2-y2)-(x1-y1)] If I do, then what goes into each of the variables? Would the x1 and y1 be the co-ordinates of my dart or the center of the dart board, or something else? |
Author: | Tony [ Thu Mar 23, 2006 11:01 pm ] |
Post subject: | |
each of your x/y pairs are the coordinates of point. two pairs, two points, one distance between them ![]() |
Author: | PerylDemise [ Thu Mar 23, 2006 11:10 pm ] |
Post subject: | |
ok. But for the first set of co-ordinates (x1 and y1), would I get them from the dart that's randomly placed on the screen and then the other two (x2 and y2) come from the dart board position? ^^; Or would it be the opposite? ![]() |
Author: | [Gandalf] [ Thu Mar 23, 2006 11:39 pm ] |
Post subject: | |
It doesn't matter, because it finds the distance, not the displacement. Also, save yourself the trouble of creating a function for this, or implementing the forumula some other way. Use the Math.Distance (x1, y1, x2, y2 : int) : int function. |
Author: | PerylDemise [ Fri Mar 24, 2006 12:10 am ] |
Post subject: | |
Wow. Thank you ;D That helped a lot. :3 The point system seems to be working now ![]() Another quick question though. I have a function set up but I forget how to call upon it within the body of the code. Can anyone help on that part? ^^; |
Author: | chrispminis [ Fri Mar 24, 2006 12:22 am ] | ||||
Post subject: | |||||
Or like
Or something like that. You get that the above is just generally. Whether you store the result in a variable or display it right away is up to you. Don't forget that in functions using more than one parameters, to call it with all the parameters specified. |
Author: | [Gandalf] [ Fri Mar 24, 2006 12:24 am ] | ||
Post subject: | |||
|
Author: | PerylDemise [ Mon Mar 27, 2006 9:48 pm ] |
Post subject: | |
Thank you so much ;D This has been a lot of help :3 |