View Full Version : problem with hitTest
arkhan
07-18-2005, 03:31 PM
its a rather weird situation..
Im cheking for colision between map and car..with normal hitTest it works normally
walls.hitTest(char){
}
but as I dont want sqares only anymore..I off course knew what to do
walls.hitTest(car._x,car._y,true){
}
but it says that it hit WAAAAY off...I know it checks for a single spot..but its like the wall is somewhere else...
I know I will probably have to email the source to someone..coz its just odd..
it still checks wrong when I make it false instead of true..only works with bound colision..
Bodadem
07-18-2005, 03:40 PM
If either of these objects are contained within another MC, then their _x and _y will be relative to the 0,0 inside that MC, which is shown, when editing the MC, with a small circle, plus sign thing. So either move both MC's to the main stage, or align their _x and _y's so that they will read accordingly (assuming the MC they are contained in does not move)
Hope this helps!
I'm sure you could just put a "_root." in front of the axis variables.
Friendly Fire
07-21-2005, 10:27 PM
I'm sure you could just put a "_root." in front of the axis variables.
I'm sure I have no idea what those words mean..
eatmorchikin6464
07-21-2005, 10:45 PM
Then you shouldn't be posting.
GhostToast
07-21-2005, 10:58 PM
Whats with your 'ban' Bodadem? Doesn't seem to be affecting you haha. :confused: :p
huh? im confused, Anyway arkhan by the sounds of it, its a layering problem (by that i mean the movieClip is in a different place (_root/in a movie clip) )
arkhan
07-22-2005, 05:45 PM
dont worry..i got it working now..
coz the car was inside the map..and the walls as well..but flash makes shapeflag hittest based on the XY from the _root ...kinda weird..but the car pos was based on the map, and the walls shapeflag were based on the _root..even if both were in the map..so I put the map in the root and everything was ok..
can u teach me this x and y code?
eatmorchikin6464
07-22-2005, 09:06 PM
Err... you could ALWAYS find it for yourself...
i would but as you say EMC, im a n00b so n00bs cant do anything good right?
besides i was just asking
eatmorchikin6464
07-22-2005, 09:11 PM
No, obviously they don't since you seem to require people to just hand you the code without you actually learning it.
I have learnt codes i have gotten, dont act as if you know me
eatmorchikin6464
07-22-2005, 09:27 PM
But...I do. If you HAD learned them, you wouldn't make tons of mistakes (like you say this. instead of _this.) and you wouldn't keep asking for much similar codes.
Nexus
07-23-2005, 09:04 AM
I'd hate to break it to you, but '_this' doesn't exist. It's correct form is 'this'.
An example to prove it...
this.onEnterFrame = function() {
trace("hey");
};
_this.onEnterFrame = function() {
trace("ho");
};
If _this was actually allowed then the above code would output "ho" every frame on the screen. Since it isn't it displays "hey" every frame.
This is because this isn't a MovieClip property. It is a property of every object which allows the object to reference itself. From what I know all MovieClip properties have an underscore prefixing them in order to set them apart from regular properties.
MercuryLime
07-23-2005, 01:32 PM
Ouch. EMC got served a plate of humiliation.
Anyway the way you get good at Flash in the beginnning is by using codes you don't understand. That's my opinion, anyway. So don't make fun of the newbs.
arkhan
07-24-2005, 05:17 PM
but if we are not to make fun of newbs then..what ARE we goona do? games?? no way..
VENGEANCE
07-29-2005, 12:59 PM
Look up localToGlobal() and globalToLocal() in the ActionScript Reference Panel. When working with nested movie clips, all coordinates are relative.
vBulletin® v3.7.3, Copyright ©2000-2010, Jelsoft Enterprises Ltd.