From c34887e7449123e71ee21eafea5043c97397c50c Mon Sep 17 00:00:00 2001 From: holis Date: Tue, 9 Apr 2024 21:41:48 -0300 Subject: [PATCH] commit --- TGC.MonoGame.TP/TGCGame.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/TGC.MonoGame.TP/TGCGame.cs b/TGC.MonoGame.TP/TGCGame.cs index 6a06032..101a4de 100644 --- a/TGC.MonoGame.TP/TGCGame.cs +++ b/TGC.MonoGame.TP/TGCGame.cs @@ -107,6 +107,11 @@ protected override void LoadContent() /// Se debe escribir toda la logica de computo del modelo, asi como tambien verificar entradas del usuario y reacciones /// ante ellas. /// + + public Vector3 pos { get; set; } = Vector3.Zero; + + public Vector3 otherPos { get; set; } + protected override void Update(GameTime gameTime) { // Aca deberiamos poner toda la logica de actualizacion del juego. @@ -117,11 +122,24 @@ protected override void Update(GameTime gameTime) //Salgo del juego. Exit(); } - + if (Keyboard.GetState().IsKeyDown(Keys.D)){ + pos += Vector3.Right * 30f * (float)gameTime.ElapsedGameTime.TotalSeconds; + } + if (Keyboard.GetState().IsKeyDown(Keys.W)){ + pos += Vector3.Up * 30f * (float)gameTime.ElapsedGameTime.TotalSeconds; + } + if (Keyboard.GetState().IsKeyDown(Keys.S)){ + pos += Vector3.Down * 30f * (float)gameTime.ElapsedGameTime.TotalSeconds; + } + if (Keyboard.GetState().IsKeyDown(Keys.A)){ + pos += Vector3.Left * 30f * (float)gameTime.ElapsedGameTime.TotalSeconds; + } + // Basado en el tiempo que paso se va generando una rotacion. Rotation += Convert.ToSingle(gameTime.ElapsedGameTime.TotalSeconds); - World = Matrix.CreateRotationY(Rotation); + //World = Matrix.CreateRotationY(Rotation); + World = Matrix.CreateTranslation(pos); //Matrix.CreateRotationZ(Rotation) * Matrix.CreateScale(1f/Rotation, Rotation, 1f); base.Update(gameTime); }