Author |
Message |
upthescale
|
Posted: Tue May 02, 2006 4:30 pm Post subject: What Dot Color |
|
|
Ok, would anyone mind helping me? Please! OMG Please! oh yah i haven't asked the question! anyway...i madeto walls, one wall is on the one side of the turing screen, and can u guess where the other is? on the other side of the turing screen! so it looks like this...
code: |
| |
| |
| |
| |
| |
| |
|
but the thing is, i amde them in flash and they have a funky design....now i have a box that is attached to the mouse (mosuewhere)...i want a detection so when my box hits the walls, the program will say
(for now it will say that, just so i know the code works)
so i tried whatdotcolor...the variable for the boxo n my mouse is boxx, and boxy
this is what i am trying to do:
code: |
if whatdotcolor (boxx,boxy) = 7 then
put"Detection Occured"
end id
|
Even though the walls are black....it dosn't work. Is this becasue the walls are a file?
Someone please help!
thanks,
Robbie! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
HellblazerX
|
Posted: Tue May 02, 2006 4:40 pm Post subject: (No subject) |
|
|
Errrr, did you make sure you actually drew those walls onto the screen, because from when you say the walls are a file, it sounds like you're reading coordinates off of the file and attempting collision detection with them. |
|
|
|
|
|
md
|
Posted: Tue May 02, 2006 4:41 pm Post subject: (No subject) |
|
|
Umm... you might want to check out hte [[turing tutorials]] forum and read the whatdotcolor (what a stupid name...) tutorial. Since your using strait lines though it's just a ssimple to use math to do boundried. If boxx < LEFT_WALL_X or > RIGHT_WALL_X then you'd hit hte wall. |
|
|
|
|
|
upthescale
|
Posted: Tue May 02, 2006 4:46 pm Post subject: (No subject) |
|
|
ok ehre are the walls...if i sued x> boxx otr w/e, its an irregular shaped object os it wudnt werk to well |
|
|
|
|
|
TokenHerbz
|
Posted: Tue May 02, 2006 7:10 pm Post subject: (No subject) |
|
|
maybe your whatdotcolor wont work because its "seeing" the color of the box following your mouse... try whatdotcoloring beyond the box's points...
I never downloaded your program so im guessing on how you have it saet up.
try whatdotcolor the chords 1 outside the box's side... and try that...
Note: Dont wine about not receving help, you'll get it in time |
|
|
|
|
|
do_pete
|
Posted: Tue May 02, 2006 7:26 pm Post subject: (No subject) |
|
|
You should use math instead of whatdotcolour |
|
|
|
|
|
codemage
|
Posted: Wed May 03, 2006 8:49 am Post subject: (No subject) |
|
|
You have to be careful with wdc.
The order of things that you draw on screen is crucial, because wdc looks at your screen in the instance where it is called - which is not necessarily the same screen that the user sees (or the programmer intended...) |
|
|
|
|
|
MysticVegeta
|
Posted: Wed May 03, 2006 1:33 pm Post subject: (No subject) |
|
|
Also, notice how whatdotcolor has limited capabilities (for ints only) Math.Distance works in reals too. So its far more accurate, eh? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
upthescale
|
Posted: Wed May 03, 2006 3:43 pm Post subject: (No subject) |
|
|
my turing sdoesn't allow Math.Distance...pretty gay |
|
|
|
|
|
do_pete
|
Posted: Wed May 03, 2006 4:02 pm Post subject: (No subject) |
|
|
Then make your own. |
|
|
|
|
|
md
|
Posted: Wed May 03, 2006 4:38 pm Post subject: (No subject) |
|
|
ffs; math.distance is just using hte pythagorean theorem:
Here it is in C++... since giving it to you in turing is jsut making it too easy for you.
c++: | real Distance(point a, b) { return sqrt( sqr(a.x -b.x) + sqr(a.y - b.y) ); } |
|
|
|
|
|
|
|