USERNAME:
PASSWORD:
Save Info!
Logging in…
This topic is 1 page long.
[ Profile | Posts | Contact ]
Posted at: 6/2/06 10:49 PM
Sign-Up: 05/03/06
Posts: 248
ive got a level and the ground is not even so ive got this code on it
onClipEvent (enterFrame) { if (this.hitTest(_root.ship._x+10, _root.ship._y+10, true)) { _root.health.hb._xscale--; } }
but sometimes when you touch the ground you dont lose health until you get a bit lower mainly because its unven ground is there a way to fix it?
Posted at: 6/2/06 11:05 PM
Sign-Up: 01/02/05
Posts: 987
you can use hittest for this kind of collicion detection , because hittest detects collicions with the imaginary bound box around an object..
youll have to use a different collicion deteccion method , google a bit check www.actionscript.org
good luck
Posted at: 6/3/06 12:35 AM
well im having more trouble now i have four boxes on each side of the ship but when i change the hittest from
if (this.hitTest(_root.ship._x+10, _root.ship._y+10, true))
to
if (this.hitTest(_root.ship.htbottom._x+10, _root.ship.htbottom._y+10, true))
it doesnt work
Posted at: 6/3/06 01:37 AM
Sign-Up: 07/02/04
Posts: 1,247
At 6/2/06 10:49 PM, CrustySheet wrote: if (this.hitTest(_root.ship._x+10, _root.ship._y+10, true)) {
This should work, but i can't figure out why you have the +10's, this would make it hittest on a point that is down and to the right of the centerpoint of the ship.
just go into the ship MC and move the picture around until the bottom of the ship is in line with the centerpoint of the MC, that is the point it tests against. (without the +10's)
All times are Eastern Standard Time (GMT -5) | Current Time: 07:54 AM
<< Back