Skip to content

Instantly share code, notes, and snippets.

@dariusk
dariusk / gist:1154923
Created August 18, 2011 19:22
Game Maker Script: Find Movement Range
/*
This code is modified from Mnementh's code at http://gmc.yoyogames.com/index.php?showtopic=368996
I did some bug fixes, and I modified it to allow you to pass in a hash of terrain modifier overrides.
So for example, if swamp usually has a cost of 3, but you're a hovercraft, you can pass in {swamp: 1}.
NOTE THAT THIS IS A FUNCTION THAT IS CALLED FROM INSIDE A UNIT WHEN CALCULATING MOVEMENT RANGE
It's important to keep in mind that what this is doing is updating values on each tile.
Every tile has this kind of data in it: