public override void Update() { base.Update(); if (MInput.LeftClick()) { Force += Math.Min(Vector2.Distance(MInput.Position.ToVector2(), Position), 50) * (MInput.Position.ToVector2() - Position) * World.Step; } }
protected override void Initialize() { base.Initialize(); Graphics.PreferMultiSampling = true; Graphics.PreferredBackBufferWidth = 1280; Graphics.PreferredBackBufferHeight = 720; Graphics.ApplyChanges(); Render.Initialize(GraphicsDevice); KInput.Initialize(); MInput.Initialize(); World = new World(); }
public void Update() { MInput.Update(); KInput.Update(); if (!sorted) { Entities.Sort(this); sorted = true; } //updating in 3 steps Entities.ForEach((o) => o.BeforeUpdate()); Entities.ForEach((o) => o.Update()); Entities.ForEach((o) => o.AfterUpdate()); }