Work for Monday 6/5


  • Working on getting bullets to eliminate enemies.
  • Created collision checker that checks if two objects are collided.
  • First problem: objects are being correctly removed from their respective lists, so other objects can move past them, but the sprites of these removed objects remain onscreen.
  • Second problem: I'm not sure if I have this all happening in the correct location- I couldn't figure out another way to do it aside from putting the check in the runloop, but this seems incorrect. Because the enemy list and bullet list are created in the main method and only the individuals themselves have objects, I couldn't think of another way to remove them from their lists.
  • Ended up doing this by creating a method in both the bullet and the enemy called hit that runs before it's removed from the list. This sets the sprite to width and height 0, so there isn't a sprite anymore. Then it can be safely removed.
  • Tried to create pull request for this and it had been automatically merged again. Not sure why it's doing that (I have an idea I will try next time I need to commit changes), but you can check what I did by going to the most recent commit.
  • Time: 3 hours

No comments:

Post a Comment