Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
happyblimp webforumsuser@macromedia.com #1
Some help with coordinates please!
Hullo!
Ok, so, I have this friend (clichè? no, no, I swear it's true!) that has a problem. I thought i could help her but I couldn't after all.
So the problem is: she has this thingamajig that you can guide around on the scene (I think it's a fish). There are also a few barriers around on the scene. When this fish or something swims into one of these barriers, it is supposed to activate a movie clip when the x and y values of the fish match the values of the x and y for the barriers.
Waiting in suspense
....
happyblimp webforumsuser@macromedia.com Guest
-
Convert user space coordinates to device coordinates
Hi, I need to convert the coordinates of a word (PDWord object) to device coordinates (the actual coordinates on the screen). Could someone please... -
x and y coordinates
Is there a way to enter the x and y coordinates of an object to change its position on the page. I see the info pallette gives the x and y... -
Mouse Coordinates -- off .swf
Hi - I'm trying to display mouse coordinates as a design element for my portfolio site. That part is easy enough, but I want to keep tracking the... -
MC absolute coordinates?
When you have nested MCs, the coordinates of a nested MC will be relative where it is in relation to the reg point of its parent MC. Is there a way... -
Coordinates solution...
Need_help wrote: This is a client side scripting issue which is very much on-topic at news:comp.lang.javascript which is over there ----> Just... -
tralfaz #2
Re: Some help with coordinates please!
"happyblimp" <webforumsuser@macromedia.com> wrote in message
news:buf43o$mg2$1@forums.macromedia.com...problem. I thought i could help her but I couldn't after all.> Hullo!
>
> Ok, so, I have this friend (clichè? no, no, I swear it's true!) that has athe scene (I think it's a fish). There are also a few barriers around on the>
> So the problem is: she has this thingamajig that you can guide around on
scene. When this fish or something swims into one of these barriers, it is
supposed to activate a movie clip when the x and y values of the fish match
the values of the x and y for the barriers.See some examples at flashkit:>
> Waiting in suspense
> ...
[url]http://www.flashkit.com/tutorials/Games/[/url]
hittest can be used to detect collision of an object with a barrier.
// see if the ball has hit the square
if(_root.ball, hittest(_root.square)){
trace("ball intersects square");
}
tralfaz Guest
-
Pea webforumsuser@macromedia.com #3
Re:Some help with coordinates please!
um, hi,
Tell "your friend" that this may be interpreted in two ways:
First of all, each clip (the fish and the barrier) have a reference point which is usually the center of the clip, and this point is usually what people refer to as the x,y coordinate of the clip, so, the interpretations are:
1) You (I mean, "your friend") wants the x,y values of the fish to line up exactly with the x,y values of the barrier, which would mean that the movie clip is activated when the middle of the fish lines up with the middle of the barrier. I doubt this is what you want...
2) Your friend wants some rudimentary collision detection to determine when the fish hits the barrier at all (e.g. The nose, or the tail, or the fin). SO I will explain this one:
The easiest way is to define a 'bounding box' for each object. Define a box (and the coordinates of it) that surround the fish. Also define one that surrounds the barrier. Once this is done, collisions are detected if these two boxes ever intersect.
You can either:
a) Call this function from the main timeline, passing if the values of the fish and each barrier to check for a collision in turn - or -
b) Contain this function inside the barrier itself. The function checks for a collision between the fish (of which we presume there is only 1) and the barrier clip from which the function is called.
I recoomend (b) if there are few barriers because then collsion detection is automatic and you can simply drop in more barriers with no extra code. But if there are too many barriers, the function will be run inside each barrier and slowr computers will have a hard time coping.
Hope it helps,
Pea
Pea webforumsuser@macromedia.com Guest



Reply With Quote

