But, you take a deep breath and resolve to give it a go. It might even seem impenetrable if you’re a new programmer. ![]() Make sure you wrote your name and today's date in the Javadoc comments of both source files.You say you want to learn Java. Don't forget to save the world! :) Submit your Car.java and Road.java files via Canvas by the end of the day. Then add the following example code where applicable:Īt some point, you should try running your scenario with "lots" of cars. If everything is correct, they should stop.Īdd sound effects to your project! Download a wav or mp3 file to your scenario/sounds directory. Test your code by moving and rotating your cars so that they will collide. In the act method, surround the "update speed and move the car" code with a decision that checks if the car has not crashed.Īfter the line move(speed) (i.e., just before the closing brace of the if block) add the following code:Īctor other = getOneIntersectingObject(Car.class) Set this variable to false in the constructor. You may need to adjust the simulation speed slider at the bottom.Īdd a private boolean named crash to the Car class.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |