Ejemplo n.º 1
0
 public override void Draw(SpriteBatch spriteBatch, Camera c)
 {
     if (player_fired)
         spriteBatch.Draw(bullet_tex, (getCenter() - c.getOffset()) / c.getzoomout(), null, Color.White, rotation, new Vector2(bullet_tex.Width / 2, bullet_tex.Height / 2), 1.0F / c.getzoomout(), SpriteEffects.None, 0);
     else
         spriteBatch.Draw(police_tex, (getCenter() - c.getOffset()) / c.getzoomout(), null, Color.White, rotation, new Vector2(bullet_tex.Width / 2, bullet_tex.Height / 2), 1.0F / c.getzoomout(), SpriteEffects.None, 0);
 }
Ejemplo n.º 2
0
        public void loadLevel()
        {
            objs = new List<Object>();

            Score.reset();

            StreamReader SR;

            SR = File.OpenText("Content\\level1.txt");
            string S = SR.ReadLine();
            while (S != null)
            {
                string tex = S;
                int x = Int32.Parse(SR.ReadLine());
                int y = Int32.Parse(SR.ReadLine());

                Object o = loadObject(tex);
                o.translate(new Vector2(x, y));

                objs.Add(o);

                S = SR.ReadLine();
            }

            SR.Close();

            //add player
            player = new Player();
            //player.offset = new Vector2(21, 0);
            /*player.addPoint(new Vector2(21, 0));
            player.addPoint(new Vector2(42, 0));
            player.addPoint(new Vector2(64, 21));
            player.addPoint(new Vector2(64, 42));
            player.addPoint(new Vector2(42, 64));
            player.addPoint(new Vector2(21, 64));
            player.addPoint(new Vector2(0, 42));
            player.addPoint(new Vector2(0, 21));*/
            player.addPoint(new Vector2(0, 0));
            player.addPoint(new Vector2(64, 0));
            player.addPoint(new Vector2(64, 54));
            player.addPoint(new Vector2(0, 54));
            player.translate(new Vector2(2800, 2800));
            objs.Add(player);

            player.tex = tex_dict["character"];

            c = new Camera(player, new Vector2(3000, 3000));

            objectCount = objs.Count;

            //make enemies
            for (int i = 0; i < 20; i++) objs.Add(createEnemy(40+r.Next(2900), r.Next(2900), r.Next(10)));
        }
Ejemplo n.º 3
0
 public override void Draw(SpriteBatch spriteBatch, Camera c)
 {
     spriteBatch.Draw(tex, (getCenter() - c.getOffset()) / c.getzoomout(), null, Color.White, rotation, new Vector2(tex.Width / 2, tex.Height / 2), 1.0F / c.getzoomout(), SpriteEffects.None, 0);
 }