The holy grid is a ds_grid which adjusts variables over time until they match a value. Wield the awesome power of the holy grid, and slay that repetitive code! Includes CSV import and export scripts.
How many times have you written code that looks like this... in the same object:
//Adjust a variable if value<100 value+=1 else value=100
People, I feel your pain. Behold, the power of the holy grid!
holygrid_step(yourholygrid,0,1)//in this case, we are handling two equations, but you can have as many as you want!
This is a heavy duty solution for objects that are crunching lots of adjustments at once. It cleans up your code very nicely, and allows you to easily swap out game play mechanics through .CSV spreadsheet import and export.
yourholygrid=import_csv(file path)//import a .csv spreadsheet that you created in excel!
How it works:
The holy grid works like an excel spreadsheet where rows represent equations, and columns represent equation variables or their coefficients. After creating a ds_grid of the appropriate size, call a programmable preset which sets up the values used in the equations. You may then call the holygrid_step() script to iterate those equations as needed (this does not have to happen in the step event). The last step is to retrieve the results using game maker's built in functions.
Want more? Here is a link to everything by this author: https://marketplace.yoyogames.com/publishers/218/ground-effect-games
Click "more info" to get the demo!
Added .CSV file support. Improved naming conventions and comments.