[GMS2] Script utilities
A downloadable asset pack
Bunch of scripts i often using in projects. You can find here a text_outline / sprite_outline scripts or even script for final-end camera. Many shortcus function everybody using.
nuclear_camera_plus(camera, object, amount) - one line camera script
Update v2.0 (more function below)
Update v3.0 (more function below)
Added basic audio surround and light system
How to use audio system:
1) Set object who will be a listener (usually oPlayer)
audio_set_surround() or audio_set_surround(oPlayer)
2) Use function "play_sound_at" on object, you want to use surround system.
How to use light system:
1) Use function "light_system_strong" in create event for example in oPlayer
2) Use function "draw_light" in object you want to emitting light. Use pre-definied prefabs for this, but u can create your own.
3)* If you want to change the strong of darkness, use "light_system_strong"
List of functions:
******************************************************************************************
(if you notice that function got args in brackets, thats mean, the args is not necessary to sign, in example:
- draw_text_outline(x, y, text, [colortext], [colouroutline], [strong])
and you write in the code like this
- draw_text_outline(200, 200, "im outlined") //means the three last variables get the deafult settings (colortext = c_white, colouroutline = c_black, strong = 1)
******************************************************************************************
Fonts Utilities:
draw_font_setting() //set font settings [ draw_set_font() - makes settings deafult]
draw_text_outline() //draw text outlined - more quality less performance
draw_text_outline_lite() //draw text outlined - less quality more performance
draw_text_outline_ext() //draw text outlined with extension - more quality less performance
string_between() //find substring between string
colors() //has enum c.value with list of pure colors
Sounds Utilities:
play_sound() //play sound once
play_sound_ext() //play sound once pitched
play_sound_loop() //play sound in loop
Sprite Utilities:
sprite_set() //Set sprite on instance
draw_sprite_part_origin() //draw part sprite relative to origin
sprite_random_index() //choose one of frames from sprite
draw_sprite_colour() //makes sprite being colored
draw_sprite_outlined() //draw sprite with outline
draw_sprite_outlined_ext() //draw sprite with outline with extensions
Other Utilities:
draw_square() //draw square...
xscale_direction() //turn sprite left/right by direction
bbox_center_x() //get center x from bbox
bbox_center_y() //get center y from bbox
button_restart_game() //make restart game on "R"
digit_between() //return True/False if digit is between two values from "what" variable.
keys() // contains shortcuts for keys
mouse() // contains shortcuts for mouse
image_scale() //image scale (makes image_xsacle and image_yscale the same)
draw_mask() //draw bbox borders
chance() //return True when arg is greater or equals to random int 0-100;
second_get() //get second from alarm counter
second_set() //set second to alarm counter
nuclear_camera_plus() //dynamic camera clamps your screen between player and mouse (!!! remember to set view to visible in room !!!)
Update v2.0:
Other Utilities:
camera_shake_add() //add value to shake
camera_shake_set() //set shake value
camera_shake_get() //return current camera shake value
mouse_hover() //return id instance over the mouse
wave() //return wave value (better desc in script file)
blink() //make image_alpha 1 or -1 in time interval
collision_line_directional() //normal line collision just with directional
foreach() //do something with every element in list (instruction in script file)
Update v3.0:
(!!! For better description, look in script file... or ask in commentary section !!!)
Other Utilities:
draw_debug() //debug from array
print() //just shorcut for debug messeage. Python users like it.
collision_prediction() //chcek if instance to create, will not collide with object
collision_prediction_list() //chcek if instance to create, will not collide with object from list
[This predictions are checking mask collision of object, not just x/y]
Sounds Utilities:
audio_set_surround() //setup audio surround
play_sound_at() //play sound at instance
audio_set_model() //change audio model for "play_sound_at"
Sprite Utilities:
draw_sprite_colour_ext() //makes sprite being colored and manipulate scale
draw_spritetile() //draw sprite from slies
Sprite Utilities:
draw_sprite_colour_ext() //makes sprite being colored and manipulate scale
draw_spritetile() //draw sprite from slies
[NEW] Light Utilities:
light_system_create() //create a basic system light
light_system_strong() //change light strong (you can make day/night system)
draw_light() //draw light on x/y with pattern (there is few in patterns folder)
Assets i used to presents functions:
https://arks.itch.io/dino-characters
https://cainos.itch.io/pixel-art-top-down-basic
https://bitvillain.itch.io/modern-pixel-guns
Download
Click download now to get access to the following files:
Development log
- Added audio surround system and light system [basic of course]Sep 13, 2022
- Update with new functionMar 30, 2022
Comments
Log in with itch.io to leave a comment.
Hello, it is giving an import error.
Hey, thanks for information, you have right ;_; I hope i fixed it, you can try now. If not, pls feedback to me, and i make RAW txt version to copy and paste the scripts : )
Now it works, thanks for the codes.