After a little pause, here we go with the 5th step of the tutorial.
In this step we’ll fix a bug which allowed plants to fire even if there isn’t any enemy coming from the right side, when there’s at least one enemy on the left side, and we’ll see zombies attacking the plants.
First, let me explain some changes: during previous steps, zombiesArray
array was used only to count the number of zombies walking in each row. This information isn’t enough for us to know whether the zombies are on the left or on the right side of each plant, so from now on zombiesArray
is an array of arrays filled with the names of the zombies walking in each row.
You’ll understand this feature better when we’ll discuss the source code.
To make zombies attack plants, we must stop them once they are on the same tile the plant is placed on.
Let’s see the source code: [...]
No comments:
Post a Comment