Python 3 Programming and Data Structures I CS 241 Skeet Proj
Python 3
Programming and Data Structures I CS 241 Skeet Project Description I. Overview Use your knowledge of object-oriented programming to write a basic target shooting game. This project will use the same arcade library as the previous project. Please refer to that project for instructions about configuring your environment. II. Instructions Your assignment is to create a game that simulates skeet shooting. On the left side of the screen, clay pigeons, or \"targets\" are randomly thrown across the screen. On the bottom left corner of the screen, the \"marksman\" (the term is used very loosely here) aims the rifle. The object of the game is to hit the intended targets, and not the safe ones.Solution
> if not self.area.contains(newpos):
> #pigeon has died, start again:
> self.rect.topright = self.area.topright
>
> self.rect = newpos
Notice how you set self.rect = newpos regardles of the \"contains\"-check,
so the self.rect.topright = self.area.topright assignment never has any
effect.
Try this:
> if not self.area.contains(newpos):
> #pigeon has died, start again:
> self.rect.topright = self.area.topright
> else:
> self.rect = newpos
