Hi all
I have this perfect ball (50 radius) and I was using a Sprite for collision detection, the thing is that I realized that even when I try to move them equally the ball and the sprite for collisions move differently, but, it should be the same movement and I have no idea why, here is the code:
package
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.display.Bitmap;
public class Pruebas extends Sprite{
[Embed(source = "data/BBall.png")]
public var BBall:Class;
public var Wheel:Sprite;
public var collisionShadow:Sprite = new Sprite();
public var movX:Number = 0.5735764363510465;
public var movY:Number = -0.8191520442889915;
public function Pruebas():void{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init)
}
private function init(e:Event = null):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
trace("program start");
Wheel = new Sprite();
Wheel.addChild(new BBall as Bitmap);
(Wheel.getChildAt(0) as Bitmap).x = -50;
(Wheel.getChildAt(0) as Bitmap).y = -50;
Wheel.x = 200;
Wheel.y = 400;
collisionShadow.graphics.lineStyle(1, 0x0000FF, 1);
collisionShadow.graphics.beginFill(0x0000FF, 0.01);
collisionShadow.graphics.drawCircle(Wheel.x, Wheel.y, 50);
collisionShadow.graphics.endFill();
addChild(Wheel);
addChild(collisionShadow);
stage.addEventListener(Event.ENTER_FRAME, mainLoop)
}
public function mainLoop(event:Event):void {
Wheel.x += movX;
Wheel.y += movY;
collisionShadow.x += movX;
collisionShadow.y += movY;
}
}
}
In the attachment is the Flashdevelop Project. Thanks for reading, I hope somebody can help.