public BackgroundManager(GameObjectController gocSet)
        {
            goc     = gocSet;
            texture = goc.GetTexture("BG0");

            dim = new Vector2(texture.Width, texture.Height);
        }
Exemple #2
0
        protected override void LoadContent()
        {
            //initciering

            wm          = new WindowManager(graphics);
            spriteBatch = new SpriteBatch(GraphicsDevice);
            gamefont    = Content.Load <SpriteFont>("Utskrift/GameFont");


            Dictionary <string, Texture2D> textureList = new Dictionary <string, Texture2D>();

            string[] loadTextures = System.IO.Directory.GetFiles("Content/Sprites/");
            Console.WriteLine(loadTextures);

            for (int i = 0; i < loadTextures.Length; i++)
            {
                //Console.Write(loadTextures[i] + " | ");
                string setter = loadTextures[i].Split(new char[1] {
                    '/'
                })[2].Split(new char[1] {
                    '.'
                })[0];
                //Console.WriteLine(setter);
                textureList.Add(setter, Content.Load <Texture2D>("Sprites/" + setter));
            }

            goc = new GameObjectController(textureList);
            uim = new UIManager(goc);

            wm.WindowScaleSet(1f);
            wm.WindowScale(GraphicsDevice);

            IsMouseVisible = true;
        }
Exemple #3
0
        public GameObject(GameObjectController gocSet, string spriteKeySet, Vector2 startPos)
        {
            goc = gocSet;

            sprite = goc.GetTexture(spriteKeySet);
            pos    = startPos;

            T = this.GetType();
            goc.gos.Add(this);
        }
Exemple #4
0
        public Bullet(GameObjectController gocSet, string spriteKeySet, Vector2 startPos, Vector2 dir, int dmgSet, int lifeSpanSet) : base(gocSet, spriteKeySet, startPos)
        {
            velocity = dir;
            dmg      = dmgSet;
            lifeSpan = lifeSpanSet;

            rendLayer = 2;

            Create();
        }
Exemple #5
0
        //float rotationSpeed = 0.0002f - new Random().Next(1);

        public Planet(GameObjectController gocSet, string spriteKeySet, Vector2 startPos) : base(gocSet, spriteKeySet, startPos)
        {
            rendLayer = 4;
            //slumpar färg
            planetColor = new Color(r.Next(255), r.Next(255), r.Next(255));
            //slumpar skala
            scale = 1 + float.Parse((r.NextDouble() * 5).ToString());

            //slumpar mineraler på planeten
            int minerals = r.Next(3, 8);

            for (int i = 0; i < minerals; i++)
            {
                WorldItem wi = new WorldItem(goc, "Mineral0", pos +
                                             new Vector2(r.Next(Convert.ToInt32(-Raduis().X), Convert.ToInt32(Raduis().X)), r.Next(Convert.ToInt32(-Raduis().X), Convert.ToInt32(Raduis().X))));
            }
        }
Exemple #6
0
        public void Shoot(GameObjectController goc, float speed, int dmg)
        {
            if (hp > 0)
            {
                if (bulletCount > 0)
                {
                    if (tickShootCooldown >= shootCooldown)
                    {
                        tickShootCooldown = 0;
                        Vector2 canonPos = pos + Forward() * Raduis();

                        bulletCount--;
                        bullets.Add(new Bullet(goc, "Bullet", canonPos, velocity + Forward() * speed, dmg, 200));
                    }
                }
            }
        }
Exemple #7
0
 public UIManager(GameObjectController gocSet)
 {
     goc   = gocSet;
     block = goc.GetTexture("");
 }
Exemple #8
0
 public Player(GameObjectController gocSet)
 {
     goc            = gocSet;
     ship           = new Ship(goc, "Ship0", new Vector2(0, 0));
     ship.rendLayer = 1;
 }
Exemple #9
0
 public WorldItem(GameObjectController gocSet, string spriteKeySet, Vector2 startPos) : base(gocSet, spriteKeySet, startPos)
 {
     rendLayer = 2;
 }
Exemple #10
0
 public Explosion(GameObjectController gocSet, string spriteKeySet, Vector2 startPos, float radiusSet) : base(gocSet, spriteKeySet, startPos)
 {
     rendLayer = 3;
     radius    = (radiusSet / Raduis().X) * 1.25f;
 }
Exemple #11
0
 public Ship(GameObjectController gocSet, string spriteKeySet, Vector2 startPos) : base(gocSet, spriteKeySet, startPos)
 {
     rendLayer = 4;
 }