Пример #1
0
 public static void Init()
 {
     ObjectShape.Init();
     Physics.Init();
     DrawGameMain.Init();
     DX.SRand(DateTime.Now.Millisecond);
 }
Пример #2
0
    public static void Operation()
    {
        if (operation.GetKeyFrame(DX.KEY_INPUT_Z) == 1)
        {
            main.FuncState = main.GAMEINIT;
        }

        if (operation.GetKeyFrame(DX.KEY_INPUT_W) % 2 == 1)
        {
            DrawGameMain.PanningScreen(0, -5);
        }
        if (operation.GetKeyFrame(DX.KEY_INPUT_S) % 2 == 1)
        {
            DrawGameMain.PanningScreen(0, 5);
        }
        if (operation.GetKeyFrame(DX.KEY_INPUT_D) % 2 == 1)
        {
            DrawGameMain.PanningScreen(5, 0);
        }
        if (operation.GetKeyFrame(DX.KEY_INPUT_A) % 2 == 1)
        {
            DrawGameMain.PanningScreen(-5, 0);
        }

        if (operation.GetKeyState(DX.KEY_INPUT_C) == 1)
        {
            GameSpeed = 0.25;
        }
        else
        {
            GameSpeed = 1;
        }

        if (operation.GetKeyFrame(DX.KEY_INPUT_X) == 1)
        {
            Vec2[] vec = new Vec2[3 + DX.GetRand(3)];

            //vec = new Vec2[4];

            for (int i = 0; i < vec.Length; i++)
            {
                vec[i] = new Vec2((float)System.Math.Cos(main.Angle(360 / vec.Length * i)), (float)System.Math.Sin(main.Angle(360 / vec.Length * i)));
            }

            ObjectShape.BornObject(new Vec2(6.5f, 0.5f), main.Angle(0), new Vec2(), 1, vec);

            //if (operation.GetFrame() % 60 == 0)
            //    ObjectShape.BornObject(new Vec2(6.5f, 0.5f), main.Angle(45), 1, new Vec2[] { new Vec2(-1, 0), new Vec2(0, -1), new Vec2(1, 0), new Vec2(0, 1) });
            //else
            //    ObjectShape.BornObject(new Vec2(6.5f, 0.5f), main.Angle(-90), 1, new Vec2[] { new Vec2(0, (float)-System.Math.Sqrt(3)), new Vec2(0, 0), new Vec2(-1, 0) });
        }

        player.Input input = new player.Input();

        player.Player.PlayerOperation(input);
        Physics.MainOperation(gamespeed);
    }
Пример #3
0
    public static int Draw()
    {
        int ReturnNum = 0;

        DX.SetDrawScreen(DX.DX_SCREEN_BACK);
        DX.ClearDrawScreen();

        switch (main.FuncState)
        {
        case main.GAMEMAIN:
            DrawGameMain.Draw();
            break;
        }

        PutFPS();

        DX.ScreenFlip();

        return(ReturnNum);
    }
Пример #4
0
        public Vec2[] GetDrawPos(double scale)
        {
            Vec2[] Return = new Vec2[obj.polygonDef.VertexCount];

            scale *= DrawGameMain.Zooming;
            for (int i = 0; i < Return.Length; i++)
            {
                double Angle  = obj.body.GetAngle() + obj.centerAng[i];
                double AngleX = System.Math.Cos(Angle);
                double AngleY = System.Math.Sin(Angle);
                Return[i] = new Vec2((float)((obj.body.GetPosition().X + obj.centerDis[i] * AngleX) * scale - DrawGameMain.GetScrollX()), (float)((obj.body.GetPosition().Y + obj.centerDis[i] * AngleY) * scale) - DrawGameMain.GetScrollY());
            }

            return(Return);
        }