i built two functions that go hand-in-hand for creating simple bezier curves. they're not the most elegant, but they get the job done in a way that i can understand. the problem is, when i try to call the functions once every frame, i get a variable not set error, and sometimes the variable names are "corrupted" when i try to troubleshoot.
it isn't important that i get this fixed for my project necessarily, but it's something that i found and can't pinpoint the root of.
also do bear in mind that i don't have any plans to call this every step, but i slapped together some sloppy code for testing and that's how i found this bug.
the two functions:
the step event ( for testing purposes ):
the curve in-game ( after a single call. as you can see, there's no issue with the functions the first time around ):
examples of errors ( if the function(s) are called one step after another ):
( note how the _step and len variables are read as _stepq / _stepr, and lcn / ken respectively. it almost looks like i'm trying to pull people's legs with a gag. i only wish that were the case ).
this doesn't happen if i stagger the function calls, such as replacing the keyboard_check with a keyboard_check_pressed instead. i've tried changing the variables too, thinking that it might be due to some kind of underlying attempt on gamemaker's side to make sure there are no conflicting variables, but the same thing happens. i've also tried cleaning the project and updating the runtime ( but not the ide, yet ) to no avail.
i also haven't tested this with other nested functions because i've not really had a reason to, so i couldn't tell you if this is a problem with that, but hopefully there's enough information to explain what's going on.
maybe it's an issue with me not cleaning up the variables after i've used them, but then i have to wonder why the garbage collector isn't doing that, and if it is, is there a chance that it's causing issues when the same variable names are used?
Please sign in to leave a comment.