Question: Write [] = swars(player). player must be 1. Draw a ship wherever the mouse is positioned inside the window, such that the ship will move

Write [] = swars(player). player must be 1. Draw a ship wherever the mouse is positioned inside the window, such that the ship will move with the mouse. Next, modify swars such that the ship will no longer follow the mouse. Instead, when the right mouse button is clicked, the ship will move in a straight line from the ships present position to the location the mouse was when the right mouse button was clicked. The ship will halt when it reaches the spot where the right mouse button was clicked. The speed of movement is up to you, but should be slow enough that we can watch it move bit by bit across the screen. It shouldnt be so slow as to be boring, though, and this speed can be adjusted in the subsequent steps to make game play more interesting. Typing q while the mouse is in the window will cause the program to exit. You dont need to delete the window, but the ship should no longer respond to mouse clicks or motion after typing q.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!