Kick That Boulder to Your Heart’s Content
My interest in programming started as a kid playing video games. Certain games just had this appeal that I couldn’t shake. I grew up with the Pokemon series from the beginning and even then I had an eye for improved features across the games.
In Yellow version, there were puzzles that could be solved by using Pokemon to push boulders around the map in order to discover hidden areas and items. The problem was players had to pause the game and select the Pokemon, and the ability “Strength” every time they push the boulders. So players were pausing and selecting repeatedly to push boulders one space at a time.
Fast forward to fall of 2000 when I got Silver version. In addition to music and new companions to catch and train, the developers at Game Freak also revamped the “Strength” feature. In this version, once a player selects the ability, they can automatically push a boulder just by walking up to it. This small change saved me minutes of gameplay and made me feel like I was the Hulk kicking boulders around the map. Very cool.
What does boulder soccer have to do with programming? It’s all about the use of methods. Methods are groups of statements that perform a task in code. They are reusable and are probably the best way to condense code. In the earlier example, players invoked the method responsible for “Strength” (let’s call it strengthMethod for now). In the first generation of games, players first approached a boulder, entered the menu, chose the Pokemon with the ability, selected “Strength”, then finally, invoked strengthMethod() and pushed the boulder one space
Game Freak made this task much simpler by editing the source code to allow the player to invoke the strengthMethod() as long as they had first selected the Strength ability from the menu. Perhaps there was a second method responsible for checking if the player has selected the ability before allowing free boulder kicking.
do{
//Insert code for invoking the strengthMethod()
}while (strengthIsSelected);
In summation, methods are a great way to group together statements that can perform a task. They can make a program more interactive by allowing users to execute this task to their heart’s content. Especially with Boulder Soccer.
-CF