Author |
Message |
PerylDemise
![](http://img.photobucket.com/albums/v31/kowsarekewl/CHickSHop/boughtchickies/chick_kowluvr.gif)
|
Posted: 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? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Thu Mar 23, 2006 11:01 pm Post subject: (No subject) |
|
|
each of your x/y pairs are the coordinates of point. two pairs, two points, one distance between them ![Wink Wink](http://compsci.ca/v3/images/smiles/icon_wink.gif) |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
PerylDemise
![](http://img.photobucket.com/albums/v31/kowsarekewl/CHickSHop/boughtchickies/chick_kowluvr.gif)
|
Posted: Thu Mar 23, 2006 11:10 pm Post subject: (No 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? ![Shifty Shifty](http://compsci.ca/v3/images/smiles/eusa_shifty.gif) |
|
|
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: Thu Mar 23, 2006 11:39 pm Post subject: (No 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. |
|
|
|
|
![](images/spacer.gif) |
PerylDemise
![](http://img.photobucket.com/albums/v31/kowsarekewl/CHickSHop/boughtchickies/chick_kowluvr.gif)
|
Posted: Fri Mar 24, 2006 12:10 am Post subject: (No 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? ^^; |
|
|
|
|
![](images/spacer.gif) |
chrispminis
![](http://i73.photobucket.com/albums/i234/chrispminis/sadpanda.gif)
|
Posted: Fri Mar 24, 2006 12:22 am Post subject: (No subject) |
|
|
code: | yourVariable := yourFunction (yourParameters) |
Or like
code: | put yourFunction (yourParameters) |
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. |
|
|
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: Fri Mar 24, 2006 12:24 am Post subject: (No subject) |
|
|
code: | var tempProduct : int
function getProduct (i, c : int) : int
result i * c
end getProduct
for i : 1 .. 5
for c : 4 .. 6
put getProduct (i, c)
%or
tempProduct := getProduct (i, c)
end for
end for |
|
|
|
|
|
![](images/spacer.gif) |
PerylDemise
![](http://img.photobucket.com/albums/v31/kowsarekewl/CHickSHop/boughtchickies/chick_kowluvr.gif)
|
Posted: Mon Mar 27, 2006 9:48 pm Post subject: (No subject) |
|
|
Thank you so much ;D This has been a lot of help :3 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|