Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualFantasyVII

Posted 04 November 2012 - 07:24 PM

one more thing. lets say when I press the tilde key I want to set a boolean to be true and keep it true until I press it again I want to set it to false. how can I do that?

this is what I got so far.

public void Update()
{
	 newState = Keyboard.GetState();

	 if (newState.IsKeyDown(Keys.OemTilde) && oldState.IsKeyUp(Keys.OemTilde))
		  Enable = true;

	 if (newState.IsKeyUp(Keys.OemTilde) && Enable == true)
		  Enable = false;

	 oldState = newState;
}

#3FantasyVII

Posted 04 November 2012 - 07:19 PM


~ is a tilde


thanks Posted Image


one more thing. lets say when I press the tilde key I want to set a boolean to be true and keep it true until I press it again I want to set it to false. how can I do that?

this is what I got so far.

public void Update()
{
	 newState = Keyboard.GetState();

	 if (newState.IsKeyDown(Keys.OemTilde) && oldState.IsKeyUp(Keys.OemTilde))
		  Enable = true;

	 if (newState.IsKeyUp(Keys.OemTilde) && Enable == true)
		  Enable = false;

	 oldState = newState;
}

#2FantasyVII

Posted 04 November 2012 - 07:18 PM


~ is a tilde


thanks Posted Image


one more thing. lets say when I press the tilde key I want to set a boolean to be true and keep it true until I press it again I want to set it to false. how can I do that?

this is what I got so far.

public void Update()
		{
			newState = Keyboard.GetState();
			if (newState.IsKeyDown(Keys.OemTilde) && oldState.IsKeyUp(Keys.OemTilde))
				Enable = true;
			if (newState.IsKeyUp(Keys.OemTilde) && Enable == true)
				Enable = false;
			oldState = newState;
		}

#1FantasyVII

Posted 04 November 2012 - 07:18 PM


~ is a tilde


thanks Posted Image


one more thing. lets say when I press the tilde key I want to set a boolen to be true. and when I press it again I want to set it to false. how can I do that?

this is what I got so far.

public void Update()
	    {
		    newState = Keyboard.GetState();
		    if (newState.IsKeyDown(Keys.OemTilde) && oldState.IsKeyUp(Keys.OemTilde))
			    Enable = true;
		    if (newState.IsKeyUp(Keys.OemTilde) && Enable == true)
			    Enable = false;
		    oldState = newState;
	    }

PARTNERS