Update Home
parent
b1724e921c
commit
92a07c3b04
4
Home.md
4
Home.md
@ -178,6 +178,9 @@ Engine.KeyDown(keyCode)
|
|||||||
### Example Usage
|
### Example Usage
|
||||||
```lua
|
```lua
|
||||||
local KeyCode = require("./assets/scripts/keycode")
|
local KeyCode = require("./assets/scripts/keycode")
|
||||||
|
local Engine= require("./assets/scripts/engine")
|
||||||
|
|
||||||
|
function OnUpdate(dt)
|
||||||
|
|
||||||
-- Check if the "W" key is pressed
|
-- Check if the "W" key is pressed
|
||||||
if Engine.KeyDown(KeyCode.W) then
|
if Engine.KeyDown(KeyCode.W) then
|
||||||
@ -188,6 +191,7 @@ end
|
|||||||
if Engine.KeyDown(KeyCode.Space) then
|
if Engine.KeyDown(KeyCode.Space) then
|
||||||
print("Space key is pressed")
|
print("Space key is pressed")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
This function is ideal for handling real-time input, such as moving a character in a game or interacting with UI elements.
|
This function is ideal for handling real-time input, such as moving a character in a game or interacting with UI elements.
|
||||||
|
Loading…
Reference in New Issue
Block a user