// // Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(float delta) { engine.update(); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (cooldown > 0) { cooldown--; } this.instancia.x += 0.01f; if (this.instancia.x > 10) { this.instancia.x = -5; } if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } if (Keyboard.GetState().IsKeyDown(Keys.Z) && cooldown <= 0) { engine.loadSound("yoshi.wav").play3d(1, 0, 0); cooldown = 2; } if (Keyboard.GetState().IsKeyDown(Keys.X) && cooldown <= 0) { int pan = randomsito.Next(-10, 11); engine.loadSound("coin.wav").play((float)pan / 10); cooldown = 5; } if (Keyboard.GetState().IsKeyDown(Keys.Y)) { yoshimusic.play(); } if (Keyboard.GetState().IsKeyDown(Keys.F)) { fossilMusic.play(); } if (Keyboard.GetState().IsKeyDown(Keys.Space)) { yoshimusic.stop(); fossilMusic.stop(); } if (Keyboard.GetState().IsKeyDown(Keys.Left) && cooldown <= 0) { this.engine.listener.rotation -= 5; cooldown = 3; } if (Keyboard.GetState().IsKeyDown(Keys.Right) && cooldown <= 0) { this.engine.listener.rotation += 5; cooldown = 3; } if (Keyboard.GetState().IsKeyDown(Keys.W) && cooldown <= 0) { this.engine.listener.z += 0.3F; cooldown = 15; } if (Keyboard.GetState().IsKeyDown(Keys.S) && cooldown <= 0) { this.engine.listener.z -= 0.3f; cooldown = 15; } if (Keyboard.GetState().IsKeyDown(Keys.D) && cooldown <= 0) { this.engine.listener.x += 0.3F; cooldown = 15; } if (Keyboard.GetState().IsKeyDown(Keys.A) && cooldown <= 0) { this.engine.listener.x -= 0.3f; cooldown = 15; } if (Keyboard.GetState().IsKeyDown(Keys.F3) && cooldown <= 0) { this.engine.defaultMusicGroup.volume -= 0.1f; cooldown = 5; } if (Keyboard.GetState().IsKeyDown(Keys.F4) && cooldown <= 0) { this.engine.defaultMusicGroup.volume += 0.1f; cooldown = 5; } // TODO: Add your update logic here engine.update(); base.Update(gameTime); }