comp129-spr19 / Diner-Hash---Educational-Python-Game

Diner Hash | An Educational Computer Science game to teach Hash Tables
1 stars 1 forks source link

Updated sprite collision detection #41

Closed brforest closed 5 years ago

brforest commented 5 years ago

On this branch, I essentially finished what Dharak Naomi and I were trying to figure out last night - collision detection between sprites (in this case, the Chef and the burger).

I incorporated most of the changes that we made last night, most notably renaming the sprite.py and Sprite classes because that is confusing and could potentially cause some issues. I also cleaned up the test functions that were created but are no longer needed, removed some redundant calls, and renamed some variables to make more sense.

The size of the chef.png file was also causing some trouble, since it had a lot of empty space to the right and left of the "useful" part of the image. This was causing collisions to be detected even when the chef was not very close to the food.

At this point, the collision detection is very basic, but I do not think that it will be too difficult to expand on (e.g., adding more food items to detect collision with). I left some comments in the code that talk about what I think we might be able to do for more items.