コード例 #1
0
        public PlayerShip(float spawnPosX, float spawnPosY, float spawnRotation, Texture2D shipTexture, Texture2D bulletTexture, View view)
        {
            faction            = Faction.Team1;
            pos                = new Vector2(spawnPosX, spawnPosY);
            rotation           = spawnRotation;
            xVel               = 0;
            yVel               = 0;
            acceleration       = 100;
            maxSpeed           = 8;
            texture            = shipTexture;
            this.bulletTexture = bulletTexture;
            this.view          = view;

            radius = Math.Max(shipTexture.Height, shipTexture.Width) / 2;

            weapons = new List <Weapon>();
            //weapons.Add(new Weapon(this, -20,15 , 0, SpriteDrawer.LoadTexture("PNG\\Parts\\gun09.png", false,false), SpriteDrawer.LoadTexture("PNG\\Lasers\\laserBlue01.png",true, false),2,20));
            //weapons.Add(new Shotgun(this, -20, 15, 0, SpriteDrawer.LoadTexture("PNG\\Parts\\gun04.png", false, false), SpriteDrawer.LoadTexture("PNG\\Lasers\\laserGreen13.png", true, false), 2, 20));
            //weapons.Add(new MissileLauncher(this, -20, 15, 0, SpriteDrawer.LoadTexture("PNG\\Parts\\gun07.png", false, false), SpriteDrawer.LoadTexture("PNG\\Sprites X2\\Missiles\\spaceMissiles_013.png", true, false), 2, 5));
            weapon1 = new MissileLauncher(this, -20, 15, 0, SpriteDrawer.LoadTexture("PNG\\Parts\\gun07.png", false, false), SpriteDrawer.LoadTexture("PNG\\Sprites X2\\Missiles\\spaceMissiles_013.png", true, false), 2, 5);
            weapon2 = new Shotgun(this, -20, 15, 0, SpriteDrawer.LoadTexture("PNG\\Parts\\gun04.png", false, false), SpriteDrawer.LoadTexture("PNG\\Lasers\\laserGreen13.png", true, false), 2, 20);

            playerStats = new PlayerStats();
            playerStats.setLife(1000, 1200);
        }
コード例 #2
0
ファイル: Ship.cs プロジェクト: vjoensen/A6k
 public Ship(float spawnPosX, float spawnPosY, float spawnRotation, Texture2D shipTexture)
 {
     pos          = new Vector2(spawnPosX, spawnPosY);
     rotation     = spawnRotation;
     xVel         = 0;
     yVel         = 0;
     acceleration = 5;
     maxSpeed     = 20;
     texture      = shipTexture;
     radius       = Math.Max(shipTexture.Height, shipTexture.Width) / 2;
     faction      = Faction.Team2;
     weapon       = new Weapon(this, 0, 0, 0, new Texture2D(0, 0, 0), SpriteDrawer.LoadTexture("PNG\\Lasers\\laserRed01.png", true, false), 0, 0);
     weapon.setAttackSpeed(2f);
 }
コード例 #3
0
ファイル: Game.cs プロジェクト: vjoensen/A6k
        protected override void OnLoad()
        {
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
            GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
            GL.ClearColor(0.2f, 0.3f, 0.3f, 1.0f);

            spritedrawer = new SpriteDrawer(view);

            hud = new HUD(this);



            CursorVisible = true;
            Input.Initialize(this);
            mousePos            = this.MousePosition;
            Input.mousePosition = mousePos;



            texture = SpriteDrawer.LoadTexture("PNG\\playerShip1_red.png", false, false);
            player  = new PlayerShip(0, 0, 0, texture, SpriteDrawer.LoadTexture("PNG\\Lasers\\laserBlue01.png", true, false), view);

            hud.connectLifeToUI(player.GetPlayerStats());


            enemyAI = new AI(spaceObjects, player);
            Ship enemy1 = new Ship(200, 200, 0, SpriteDrawer.LoadTexture("PNG\\ufoBlue.png", false, false));

            player.setTarget(enemy1);


            enemyAI.takeControl(enemy1);
            spaceObjects.Add(enemy1);



            base.OnLoad();
        }