Example #1
0
        public void RegisterNom(Nom nom)
        {
            ConvertUnits.SetDisplayUnitToSimUnitRatio(64f);
            float   width   = ConvertUnits.ToSimUnits(nom.Width);
            float   height  = ConvertUnits.ToSimUnits(nom.Height);
            Vector2 pos     = ConvertUnits.ToSimUnits(nom.GetPosition());
            Body    nomBody = BodyFactory.CreateEllipse(World, width, height * 0.16f, 8, 1, pos, nom);

            //Body nomBody = BodyFactory.CreateRectangle(World, width, height, 1, pos, nom);
            nomBody.UserData       = nom;
            nomBody.BodyType       = BodyType.Dynamic;
            nomBody.AngularDamping = 3f;
            nom.RegisterBody(nomBody);
        }
Example #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            Camera  = new Camera2d(GraphicsDevice);
            Player  = new Nom(Content);
            Physics = new Physics();
            AddNomToGame(Player);

            for (int i = 0; i < 10; i++)
            {
                Nom newNom = new Nom(Content);
                newNom.SetPosition(i * 50, i * 50);
                newNom.MoveToPosition(newNom.GetPosition());
                AddNomToGame(newNom);
                AiNoms.Add(newNom);
            }

            this.IsMouseVisible = false;
            base.Initialize();
        }
Example #3
0
 private void AddNomToGame(Nom nom)
 {
     Physics.RegisterNom(nom);
     Noms.Add(nom);
 }