anyone know anything about
Morning all,
I'm dipping my toe into the world of ASscripts, trying to do things the better way-at least i'm told, but am having great difficulty. Any pearls of wisdom you can share would be very gratefully recieved!
What i'm trying to do is assign a script to several movieClip instances, and make that bounce when it hits another movieClip on satge. I guess basic collision really. But its not working, mainly as, i think, i have no idea how to make the script read things from the stage.
This is what i have so far:
package{
import flash.display.MovieClip;
import flash.events.Event;
import Wall; //movieClip linked from swf file - do i need to do this differently?
public class MoveCharcater extends MovieClip{
public function MoveCharcater(){
addEventListener(Event.ENTER_FRAME, shiftChr);
}
function shiftChr(event:Event):void{
var xDir:Number = 5;
var yDir:Number = 5;
if(this.hitTestObject(Wall)){ // not convinced this works either?!
xDir *= 1;
yDir *= -0.5;
}
this.x += (xDir + xDir);
this.y += yDir;
}
}
}
Any ideas?!