Thirsty Panther Posted April 5, 2016 Posted April 5, 2016 From the FPS script to turn on the flashlight. if window:KeyHit(Key.F) then A complete list of keys here if window:KeyHit(Key.F) then Quote
extenz Posted April 5, 2016 Posted April 5, 2016 I don't think he wants to do that for every key on the keyboard tho I think he wants something like "Key.Any" instead of "Key.F", unfortunately I don't think there's anything like that. 1 Quote
Slastraf Posted April 5, 2016 Author Posted April 5, 2016 I want to have this feature for my thrid person player, if any key is down the player is controlled by the camera, else theres a free looking around (the object) camera. This feature should be accessible for us because of things like that and also maybe a start menu . Quote
Genebris Posted April 5, 2016 Posted April 5, 2016 You can loop through all keycodes instead of using Key calss. window:KeyHit(70) is the same as window:KeyHit(Key.F) Quote
Undac Posted April 6, 2016 Posted April 6, 2016 If you use cpp: https://msdn.microsoft.com/en-us/library/windows/desktop/ms646299(v=vs.85).aspx Otherwise, I don't really have a solution for your question, but this is an idea: you can have a global var that gets incremented (by +1, or relative to time) on each frame, but you reset it to 0 whenever a key assigned to an action is pressed. When this global var is bigger than a set value, the "free looking camera" function is triggered. I haven't used much LUA, so I will write in pseudo-code: //let's suppose that you want to trigger the auto camera if the player didn't touch any key in 5000 frames freeCameraTrigger = 0 //in your gameMain function: if (freeCameraTrigger < 5000) freeCameraTrigger = freeCameraTrigger + 1 else MoveCameraFreely() end if (KeyDown(Key::Alt)) <actions> freeCameraTrigger = 0 end if (KeyDown(Key::W)) <actions> freeCameraTrigger = 0 end <rest of the code> Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.