PC28K
04/21/2023, 12:00 PMjavascript
importPackage(Packages.org.lwjgl.input);
︙
if(Keyboard.isKeyDown(Keyboard.KEY_SPACE)){
なんちゃらら
}PC28K
04/21/2023, 12:01 PMPC28K
04/21/2023, 12:01 PMana_l_og
04/21/2023, 12:38 PMPC28K
04/21/2023, 12:40 PMana_l_og
04/21/2023, 1:40 PMPIPOsen
04/22/2023, 10:54 AMPC28K
04/22/2023, 11:07 AMPC28K
04/22/2023, 11:07 AMPC28K
04/22/2023, 11:08 AMPIPOsen
04/22/2023, 11:58 AMPIPOsen
04/22/2023, 11:58 AMelsafrozen2592
04/26/2023, 11:28 AMjs
if (Keyboard.isKeyDown(Keyboard.KEY_SPACE))
{
dataMap.setBoolean("isHibean", !(dataMap.getBoolean("isHibeam")), 11);
}?
In this case we eliminate one comparison of boolean value.
PS. Cause you usually press the key for, like 0.3 or 0.5 or sometimes 1.2 seconds and it means at least 6, 10 or 24 times a render script was ticked thus it means you will see the value rapidly change like a roulette and usually you get the correct result by 50% chance. Personally I suggest you to detect "when last time this script was called what's the status of SPACE" to ensure only one change will be implemented when you continuously press the key.