The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.39 / 5.00 38,635 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 15,161 Viewsim trying to convert myself from AS2 to as3 .. and well im trying to make games ,but man,its haveing strange problems that I dont get :(
i wrote this:
this.addEventListener(Event.ENTER_FRAME, movesE);
function movesE(event:Event):void
{
if (name != "enemy")
{
if(root.Yattack.hitTestObject(this))
{
removeChild(this);
}
if (y < 239)
{
y++;
}
if (y > 239)
{
y--;
}
}
}
root.Yattack,is the attack sprite of the main dude(dont ask why its like that)..and it just doesnt work..
this is what flash says:
Symbol 'Enemy', Layer 'Layer 2', Frame 1, Line 7 1119: Access of possibly undefined property Yattack through a reference with static type flash.display:DisplayObject.
any idea on how to make it work?
At 1/3/11 02:54 PM, Tygerman wrote: the "root." isn't used in AS3 it is now MovieClip(root).
also I don't think "root." was the right syntax in AS2 either, I thought it was "_root." but I could be remembering wrong
wow cool,(and yeah in as2 its _root,but i thought since everything in as3 is like as2 just without the "_" so it might work :P)
also for some reason the removeChild(this) line doesnt work,while im running the game and hitting the enemy this is what showes up:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/re moveChild()
at MyE/movesE()[MyE::frame1:9]
:S
Code properly, you're trying to turn AS3 into AS2, no point using AS3 if thats what you're going to do, set up a document class and shove your enemies in an array then test for your crap between the Player and them from a common parent instead of having your references all willy nilly.
it would be a start
nobody