Kelas Engine
GamepadService
*Konten ini diterjemahkan menggunakan AI (Beta) dan mungkin mengandung kesalahan. Untuk melihat halaman ini dalam bahasa Inggris, klik di sini.
Referensi API
Properti
GamepadCursorEnabled
Contoh Kode
GamepadService - Properti Kursor Gamepad Diaktifkan
local gamepadService = game.GamepadService
gamepadService:GetPropertyChangedSignal("GamepadCursorEnabled"):Connect(function()
local enabled = gamepadService.GamepadCursorEnabled
if enabled then
-- Kode kustom ketika kursor virtual diaktifkan
else
-- Kode kustom ketika kursor virtual dinonaktifkan
end
end)Metode
DisableGamepadCursor
GamepadService:DisableGamepadCursor():()
Memberikan nilai
()
Contoh Kode
GamepadService - Nonaktifkan Kursor Gamepad
local gamepadService = game.GamepadService
local userInputService = game.UserInputService
userInputService.InputBegan:Connect(function(inputObject, gameProcessed)
-- Hanya nonaktifkan kursor gamepad jika tombol B ditekan
if inputObject.KeyCode == Enum.KeyCode.ButtonB then
gamepadService:DisableGamepadCursor()
end
end)EnableGamepadCursor
Parameter
Memberikan nilai
()
Contoh Kode
GamepadService - Aktifkan Kursor Gamepad
local gamepadService = game.GamepadService
local userInputService = game.UserInputService
local startObject = script.Parent
userInputService.InputBegan:Connect(function(inputObject, gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.ButtonA then
gamepadService:EnableGamepadCursor(startObject)
end
end)