Here's the code you need to add to AvoiderWorld: (You probably should read that link.may help clear some things up.) So, we need some way of specifying that the return value of getWorld() will be treated as an AvoiderWorld, not just a plain ol' ordinary World. The problem is that we are going to implement endGame() in AvoiderWorld, not World. The part that may be confusing is the substitution of AvoiderWorld for World and the addition of "(AvoiderWorld)". I hope it makes sense that we are now asking the world to "end the game" as opposed to removing the hero object. To implement step 1 we need to change that code to this:ĪvoiderWorld world = (AvoiderWorld) getWorld() Some part of the code should look like this: In the "Assignment" section of Part I of the Avoider Game tutorial, you wrote code to remove the hero from the game if it touches one of the enemies.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |