I'm coding a game - part 7
The new concept or command I used was called the enum command. An enum is used to assign words to numbers. This can be very useful in programming. Instead of always using a ‘0’ to represent when I want something to be off, now I can just use OFF in the code. ENUMs are a better choice than variables if the program calls for a constant, not a variable. Next I wrote some code in the step event:
This was me staring at the code for a good hour.
It does make sense, try to think of it as a routine, broken down into subroutines. After my brain unlocked from thinking too hard it was time to add a script.
A script is code that exists outside of an object that can be called upon by any object. This script analyzes the mode, and when it is higher than ‘1’ sets the target variable to ‘1’. One last step and we’re done! Last I created an object that the main character had to touch to trigger all these lines of code!