Exemplo n.º 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);
        }
Exemplo n.º 2
0
Arquivo: Ship.cs Projeto: vjoensen/A6k
 override public void Draw()
 {
     SpriteDrawer.Draw(texture, pos, Vector2.One, Color.White, new Vector2(((float)texture.Width) / 2, ((float)texture.Height) / 2), rotation - (float)Math.PI / 2);
     if (framesSinceDamage < 30)
     {
         SpriteDrawer.DrawShield(texture, pos, Vector2.One * 1.1f, Color.Azure, new Vector2(((float)texture.Width) / 2, ((float)texture.Height) / 2), rotation - (float)Math.PI / 2, (30f - framesSinceDamage) / 40);
     }
 }
Exemplo n.º 3
0
 override public void Draw()
 {
     foreach (Weapon wep in weapons)
     {
         wep.Draw();
     }
     SpriteDrawer.Draw(texture, pos, new Vector2(2f, 2f), Color.White, new Vector2(((float)texture.Width) / 2, ((float)texture.Height) / 2), rotation - (float)Math.PI / 2);
 }
Exemplo n.º 4
0
Arquivo: Ship.cs Projeto: 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);
 }
Exemplo n.º 5
0
Arquivo: Game.cs Projeto: 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();
        }