Last active
February 16, 2019 18:44
-
-
Save Firedingo/7bcf5fb4afc2b523495c99d93db71d8b to your computer and use it in GitHub Desktop.
Tips & Reminders I've Picked Up For Working With GameMaker Studio & GML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#GameMaker Tips | |
###Tip 1 | |
Do Not Use WHILE loops in the GUI, Step or other events that loop every second. | |
It's a good way to fry your memory and crash GameMaker's Runner. | |
###Tip 2 | |
If you intend to use an IF statement to check for key input do not use -keyboard_checks. For example | |
**var left_key = -keyboard_check(vk_left);** | |
var right_key = keyboard_check(vk_right); | |
**var a_key = -keyboard_check(ord("A"));** | |
var d_key = keyboard_check(ord("D")); | |
**if (left_key || right_key) { | |
move = right_key - left_key; | |
} | |
else if (a_key || d_key) { | |
move = d_key - a_key; | |
}** | |
This will fail to run as soon as it hits the if statement since it will never result in 1 when you press "A" or "Left". | |
The "D" key and "Right" arrow work perfectly fine as they return 1 when pressed and 0 when not pressed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment