Example #1
0
    public Projectile(Window window, Player player)
    {
        _Bitmap = new Bitmap("bullet", "bullet.png");
        X       = player.X;
        Y       = player.Y;
        Point2D fromPt = new Point2D()
        {
            X = X, Y = Y
        };
        Point2D toPt = new Point2D()
        {
            X = SplashKit.MousePosition().X, Y = SplashKit.MousePosition().Y
        };
        Vector2D dir;

        dir      = SplashKit.UnitVector(SplashKit.VectorPointToPoint(fromPt, toPt));
        Velocity = SplashKit.VectorMultiply(dir, BASE_SPEED + player.Haste);
        Vector2D targetPos = new Vector2D();

        targetPos.X = SplashKit.MousePosition().X;
        targetPos.Y = SplashKit.MousePosition().Y;
        Vector2D Pos = new Vector2D();

        Pos.X    = player.X;
        Pos.Y    = player.Y;
        Rotation = (int)SplashKit.AngleBetween(targetPos, Pos) + 90;
        _Bitmap.Draw(X, Y, SplashKit.OptionRotateBmp(Rotation));
        Damage = player.Damage;
    }
Example #2
0
    // Draws with rotation facing the target
    public void Draw(Window window)
    {
        Vector2D targetPos = new Vector2D();

        targetPos.X = _Target.X;
        targetPos.Y = _Target.Y;
        Vector2D Pos = new Vector2D();

        Pos.X     = X;
        Pos.Y     = Y;
        _Rotation = (int)SplashKit.AngleBetween(targetPos, Pos) + 90;
        _Bitmap.Draw(X, Y, SplashKit.OptionRotateBmp(_Rotation));
    }