PDA

View Full Version : Making enemies like goombas?



Ciro55
October 7th, 2010, 08:59 PM
Hi. I want put some enemies on the stage, that have the same actionscript. And when the enemy hit on the another, they change their directions, like two Goombas. How I do that?

Ciro55
October 14th, 2010, 03:18 PM
Bump. I have asked this in many forums but no one answered me ):

zepa
October 14th, 2010, 04:09 PM
hi!

I will try to help with an idea I had, not if it worked well, do not take long using flash: S.

You can try to do as in this picture.

http://img835.imageshack.us/img835/2941/gombav.jpg

when "char attack" collides with "enemy dmg zone" the enemy dies, "enemy attack zone" collides with "char dmg zone" the main character receives damage.

in code would be something like (as2) ...
the enemy:

onClipEvent (enterFrame) {
if (_root.Char.attack_zone.hitTest(this.dmg_zone))
{
gotoAndPlay("die"); //die frame
}
}

main char:

onClipEvent (enterFrame) {
if (_root.mob.attack_zone.hitTest(this.dmg_zone))
{
//when receive dmg
}
}

I hope you find it helps

Ciro55
October 14th, 2010, 05:42 PM
Thanks for the reply, but it's not that I want to know, sorry.

What I want is a way to make a goomba collide with another, like this:
http://img221.imageshack.us/img221/115/goomba.png

And I dont want use Instance Names because I want to spam how many goombas I want.

TOdorus
October 15th, 2010, 04:59 PM
And I dont want use Instance Names because I want to spam how many goombas I want.

Allright. In that case, how much OOP do you know and AS2 or AS3?