Some of Chapter 5's content was actually surprisingly informative and helpful.
Consider this bit of code-
I made this before I discovered that there were two formats for for loops;
for (int i=0; i < Main.mainPanel.Enemies.size(); i++) { Main.mainPanel.enemies.get(i) }
for (Enemy test : Main.mainPanel.enemies) { test }
Using the new for loop, my code is easier to modify and looks much cleaner overall, because instead of typing "Main.mainPanel.enemies.get(i)" each time, i can just type "test".
And if you're wondering what this code does, it goes through a list of enemies, checks if they're overlapping with Mario, and if he's falling, change their state. In other words...
Goomba goes squish.
No comments:
Post a Comment