icon

UseTopicwritingscode to get 5% OFF on your first order!

Python: Graphical User Interface

Task: Graphical User Interface
Task description: Cannon game

You will use a variation of the code from the last exercise to create a cannonball game. The player should put strength and angle of the cannon to hit an object on the ground a distance away from the cannon. Use the techniques from the last exercise to calculate the trajectory of the cannonball. There should be an option box for whether the game will use air resistance or not.

To be able to render the results of the integrator as an animation instead of a regular plot, there is an alternative integrator added to the exercise. This integrator returns its results through repeated calls to the next () method. So every time you update the animation, call next () to get out the next value from the integrator.

An example of the GUI is shown below. The cannon is at the bottom left. The red square is the goal the player must hit. The black balls are cannonballs the player shoots. The white box is an obstacle which the player must shoot over to hit the target.

attachments: demo: showing how it could/should look and the zip containing the integrator and classes for air resistance or not

You can leave a response, or trackback from your own site.

Leave a Reply

Powered by WordPress | Designed by: Premium WordPress Themes | Thanks to Themes Gallery, Bromoney and Wordpress Themes