Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: hitTest problem

(77 views • 2 replies)

This topic is 1 page long.

<< < > >>
The-Almighty-Hominid LIGHT LEVEL 05

Sign-Up: 06/10/06

Posts: 76

I am having a problem stopping an MC when it hits another object. Here is my code:

onClipEvent (enterFrame) {
if (_root["bad guy" + i], hitTest (_root.block)) {
_root["bad guy" + i].stop()
}
}

The MC is called "bad guy" but since they are being spawned I made each other one have i added to them. So technically "bad guy" + i should work... :S

Thanks in advance...


None

Oldsage10

Reply To Post Reply & Quote

Posted at: 4/29/08 06:08 PM

Oldsage10 EVIL LEVEL 07

Sign-Up: 03/26/08

Posts: 65

At 4/26/08 02:10 PM, The-Almighty-Hominid wrote: I am having a problem stopping an MC when it hits another object. Here is my code:

onClipEvent (enterFrame) {
if (_root["bad guy" + i], hitTest (_root.block)) {
_root["bad guy" + i].stop()
}
}

The MC is called "bad guy" but since they are being spawned I made each other one have i added to them. So technically "bad guy" + i should work... :S

Thanks in advance...

I Think its because your code reads:

if (_root["bad guy" + i], hitTest (_root.block)) {

on that line. The period in "_root["bad guy"+i].hitTest(_root.block))"

if you copied this directly from your actions, change the comma to a period, otherwise, I dont see anyhting wrong.

BBS Signature

None

Snubby

Reply To Post Reply & Quote

Posted at: 4/29/08 06:20 PM

Snubby FAB LEVEL 20

Sign-Up: 12/04/04

Posts: 3,123

you cant have a space in an instance name. you said 'bad guy', its gotta be badGuy, or bad_guy or something. also you wrote a comma and then a space after the first ], but it should just be _root ["baddy" + i].hitTest (/**/)

thats about it, you may have duplicated the baddies wrong also.


All times are Eastern Daylight Time (GMT -4) | Current Time: 03:21 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!