local playerCanJump = {}
local function onPlayerMotionChange(event) if event.playermotion == 4 then playerCanJump[event.eventobjid] = true elseif event.playermotion == 32 then playerCanJump[event.eventobjid] = false end end ScriptSupportEvent:registerEvent("Player.MotionStateChange", onPlayerMotionChange)
Hàm onPlayerMotionChange theo dõi sự kiện thay đổi trạng thái chuyển động của người chơi:
local function onPlayerKeyDown(event) local uid = event.eventobjid if event.vkey == "SPACE" and playerCanJump[uid] then Actor:appendSpeed(uid, 0, 0.8, 0) playerCanJump[uid] = false end end ScriptSupportEvent:registerEvent("Player.InputKeyDown", onPlayerKeyDown)
Hàm onPlayerKeyDown xử lý sự kiện khi người chơi nhấn phím:
— Cre:Nguyễn Khánh 2025/02/28 10:09
Nếu bạn có bất kỳ câu hỏi nào về Chế Độ DEV Nâng Cao, vui lòng tham gia
Mini World Developer Việt Nam chính thức của chúng tôi