Forum Topic: bit of help with AS please

(82 views • 3 replies)

This topic is 1 page long.

<< < > >>
None

CrustySheet

Reply To Post Reply & Quote

Posted at: 6/2/06 10:49 PM

CrustySheet LIGHT LEVEL 03

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?


None

zuperxtreme

Reply To Post Reply & Quote

Posted at: 6/2/06 11:05 PM

zuperxtreme NEUTRAL LEVEL 07

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


None

CrustySheet

Reply To Post Reply & Quote

Posted at: 6/3/06 12:35 AM

CrustySheet LIGHT LEVEL 03

Sign-Up: 05/03/06

Posts: 248

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


None

Chrispington

Reply To Post Reply & Quote

Posted at: 6/3/06 01:37 AM

Chrispington EVIL LEVEL 31

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)

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 07:54 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!