|
-
Help me understand this code!
Here's the link with the example and code:
http://www.zebra0.com/actionscript/e...all-cursor.php
Basically, what happens is that the ball follows wherever you click. I'm pretty new to actionscript, and I'm trying to break this down and understand completely how it works. I know all the terminology ie where variables are declared, functions, eventlisteners, math etc, but i don't understand how this values allow it to work.
For example, what's up with the variable "dx" and "dy"? Why are they 0 and if they are zero, then how come for the function "frame", the "minx" and "max" vars have Math.abs(dx/dy) added to it if dx=dy=0? Doesn't make sense. Thanks for clearing all of this stuff out.
-
Senior Member
 Originally Posted by littlemonster
For example, what's up with the variable "dx" and "dy"? Why are they 0
Only initially; you can see that they are reset to different value in setGoal() function.
 Originally Posted by littlemonster
and if they are zero, then how come for the function "frame", the "minx" and "max" vars have Math.abs(dx/dy) added to it if dx=dy=0?
There is no Math.abs(dx/dy) in the frame() code. Only Math.abs(dx) and Math.abs(dy).
-
 Originally Posted by realMakc
Only initially; you can see that they are reset to different value in setGoal() function.
There is no Math.abs(dx/dy) in the frame() code. Only Math.abs(dx) and Math.abs(dy).
Well, thanks, that's what I meant for the second one because i was too lazy to write it all out
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|