Enemy Type
SWITCH STATEMENT | GAME BASED EXAMPLE
GOAL: Create a simple switch statement to compare the enemy type and run the correct code to activate that enemies behavior
CODE BREAK-DOWN
LINE 5 --> Switch statement is declared that will evaluate the value of the variable _enemyType and compare it to each case
LINE 7, 10, & 13 --> Once the statement finds a case value that matches the value of _enemyType, the program runs the associated code
LINE 16 --> If none of the case values matches the value of _enemyType, then the program runs the associated code found in the Default Case
Last updated