Jump to content

Recommended Posts

Posted

I don't think he wants to do that for every key on the keyboard tho :P I think he wants something like "Key.Any" instead of "Key.F", unfortunately I don't think there's anything like that.

  • Upvote 1
Posted

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 .

Posted

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>

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...