Credit: Gizmo199 Usage These are simple scripts that convert the given x/y coordinates in a room to the appropriate x/y coordinates on the GUI layer when using views. These scripts are essential, especially when dealing with shader effects that need to be drawn on the GUI layer (eg. Motion blur, Shockwaves, etc.). They are also […]
Written by me (Anixias). Notes This can be easily modified to use textures, since it uses primitives to render. The border rendering is slightly wrong on the partial circle (the one that shows the amount), but it’s good enough for my purposes. You can use draw_healthbar_circular_quality to actually render non-circular shapes (quality of 3 is […]
Written by me (Anixias). Usage This function will multiply two numbers, a and b, and ensure the product doesn’t overflow past modulo. It avoids actually multiplying a by b so GMS2 doesn’t lose precision. After several tests with large 32-bit integers, it is perfectly accurate, whereas using normal operations (literally using (a * b) % […]
Credit: Gizmo199 Usage For drawing general circular healthbars, meters, etc.
Written by me (Anixias). Usage You can use this function to map one range to another. For example, say you want to convert a point in the view to a point in the GUI. You could call something like (pseudo-code):
Written by me (Anixias). Usage You can use this to lerp from one value to another, but it takes into account that there is a wrapping range. For example, say you want to change image_angle to lerp towards some direction D every frame, but it should rotate in the direction closest to the goal. Let’s […]
Written by me (Anixias). Warning: This does not work well, and you should instead look up squirrel3 or see the GDC video on YouTube on noise to replace RNGs. Usage Call this function on a position (integer coordinates) to get a seemingly random number from 0 – 1 (never equals 1). You can use this […]
Written by me (Anixias). Usage Simply replace surface_set_target and surface_reset_target throughout your code with surface_set and surface_reset, respectively. This allows you to nest surface rendering. I wrote it because I needed a global UI surface, but I use surfaces throughout the UI. This allows me to use surface rendering wherever I need it without worrying […]
Credit to u/galitork on reddit.com.