Exemplo n.º 1
0
        /// <summary>
        /// Ladddar in en planet
        /// </summary>
        /// <param name="cm">Content</param>
        /// <param name="name">Namn på xml</param>
        public void Init(ContentManager cm, string p, string g, Collectible[] c, Vector2 pos, Vector2 textureSize, float radius, float gravityField)
        {
            this.pos = pos;
            planet.Init(cm, p, pos, new Rectangle(), new Vector2(radius * 2 / textureSize.X, radius * 2 / textureSize.Y), Color.White, true);
            if (g != "")
            {
                grass.Init(cm, g, pos, new Rectangle(), new Vector2(1), Color.White, true);
                grass.GetOrigin = new Vector2(grass.GetTexture.Width, grass.GetTexture.Height);
            }
            moons = new Collectible[c.Length];
            for(uint i=0; i<moons.Length; i++)
            {
                moons[i] = c[i];
            }

            this.radius = radius;
            this.gravityField = radius + gravityField;
        }
Exemplo n.º 2
0
        public override void LoadContent(ContentManager content)
        {
            hud.Init(content, "HUD");
            Collectible[] c = new Collectible[1];
            c[0] = new Collectible();
            c[0].Init(content, new Vector2(700,300));
            //player.Init(content, "atlas_spritesheet", new Vector2(3048, 0));

            player.Init(content, "atlas_spritesheet", LoadWorld("mapTemplate.xml", content));

            
            //for(uint i=0; i<10; i++)
            //{
            //    planet[i].Init(content, "isplanet", "", c, new Vector2(3048 + (i * 6096), 3048));
            //}
            for (int i = 0; i < 10; i++)
            {
                for (int k = 0; k < 10; k++)
                {
                    background[i, k].Init(content, "Background", new Vector2(i * 3000, k * 3000), Color.White, 1, false);
                }
            }
        }