vfgsrvr
This commit is contained in:
parent
94897a06a3
commit
03ba4878c0
|
@ -46,7 +46,7 @@ public class Game1 : Game
|
|||
|
||||
protected override void LoadContent()
|
||||
{
|
||||
engine = new PhysicsEngine2D() { IterationCount = 100 };
|
||||
engine = new PhysicsEngine2D();
|
||||
_spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||
|
||||
spriteBox = new Sprite() { Texture2D = Content.Load<Texture2D>("Sprites/Pixel") };
|
||||
|
@ -67,6 +67,14 @@ public class Game1 : Game
|
|||
gameObjectBall.BehaviourController.AddBehaviour<MovementBallBehaviour>(new Vector2(.1f, .01f), 500f);
|
||||
gameObjectBall.BehaviourController.AddBehaviour<DisplayableSpriteBehaviour>().Assign(spriteBall);
|
||||
gameObjectBall.BehaviourController.AddBehaviour<Collider2DAABBBehaviour>().AABBLocal = new AABB(-Vector2.One * 512f * .5f, Vector2.One * 512f * .5f);
|
||||
gameObjectBall = gameManager.InstantiateGameObject<GameObject>();
|
||||
gameObjectBall.Name = "Ball";
|
||||
gameObjectBall.Transform.Position = Vector2.UnitY * 30f;
|
||||
gameObjectBall.Transform.Scale = new Vector2(1f / 51.2f, 1f / 51.2f);
|
||||
engine.AddRigidBody(gameObjectBall.BehaviourController.AddBehaviour<RigidBody2D>());
|
||||
gameObjectBall.BehaviourController.AddBehaviour<MovementBallBehaviour>(new Vector2(.1f, .01f), 500f);
|
||||
gameObjectBall.BehaviourController.AddBehaviour<DisplayableSpriteBehaviour>().Assign(spriteBall);
|
||||
gameObjectBall.BehaviourController.AddBehaviour<Collider2DAABBBehaviour>().AABBLocal = new AABB(-Vector2.One * 512f * .5f, Vector2.One * 512f * .5f);
|
||||
|
||||
IGameObject gameObjectLeft = gameManager.InstantiateGameObject<GameObject>();
|
||||
gameObjectLeft.Name = "Left";
|
||||
|
@ -175,7 +183,7 @@ public class Game1 : Game
|
|||
}
|
||||
if (Keyboard.GetState().IsKeyDown(Keys.Space))
|
||||
{
|
||||
seconds += gameTime.ElapsedGameTime.Milliseconds * .0025f;
|
||||
seconds += gameTime.ElapsedGameTime.Milliseconds * .005f;
|
||||
while (physicsTimer + 0.01f < seconds)
|
||||
{
|
||||
Console.WriteLine($"Physics Timer: {physicsTimer}");
|
||||
|
@ -185,7 +193,7 @@ public class Game1 : Game
|
|||
}
|
||||
if (Keyboard.GetState().IsKeyDown(Keys.B))
|
||||
{
|
||||
seconds -= gameTime.ElapsedGameTime.Milliseconds * .0025f;
|
||||
seconds -= gameTime.ElapsedGameTime.Milliseconds * .005f;
|
||||
while (physicsTimer - 0.01f > seconds)
|
||||
{
|
||||
Console.WriteLine($"Physics Timer: {physicsTimer}");
|
||||
|
|
Loading…
Reference in New Issue