greetings, i want to have a feature in my game where if the player is within a box collider they can hold down a key and jump through a window.
so pretty much, i need to know the function of;
“if a key is held down” { Animation.play(“Animation”); }
greetings, i want to have a feature in my game where if the player is within a box collider they can hold down a key and jump through a window.
so pretty much, i need to know the function of;
“if a key is held down” { Animation.play(“Animation”); }
Take a look at the Input class. The answer is there:
Take a look at the class functions.
You need something like this:
if (Input.GetKeyDown(KeyCode.YOUR KEY HERE));
Animation.play("example");
I haven’t tried this code. Its just an example.
if (Input.GetKey(keyNum.ToString()) {…}
‘keyNum’ can be any key you want e.g. var keyNum : int = 1; or var keyNum : String = “k”;