Beispiel #1
0
        public void turnToPoint(GCore.Point target, float dt)
        {
            float new_angle = (float)(-Math.Atan2(this.pos.x - target.x, this.pos.y - target.y) + Math.PI / 2);

            angle += (new_angle - angle) * dt * 10;
            //Console.WriteLine(angle + " " + new_angle);
            //angle += (angle - new_angle) * dt * 100;
        }
Beispiel #2
0
        public ShotView(Cannon model, GCore.Point from, GCore.Point to)
        {
            load("DATA\\Shots\\shot1.png");
            setAxis(0, height / 2);
            ratio     = false;
            width     = GCore.Point.distance(from, to);
            height    = 5;
            rotationZ = GCore.Point.angle(from, to);
            x         = from.x;
            y         = from.y;

            timer.interval = 300;
            timer.addEventListener(GCore.TimerEvent.TIMER, onTimer);
            timer.start();
        }
Beispiel #3
0
 public bool isDestinationReached(GCore.Point destination, float dt)
 {
     return(destination.distance(this.pos) <= 1.1 * engine.power * dt);
 }