![]() As previously mentioned, doing stunts in the air will shave off time. The more dangerous you play the game, the more you are rewarded. Moto X3M isn’t just made for anyone though, it’s made for the adrenaline junkies on our site who want to play something where they can test their skills and reactions. Kick up some dirt with this fast-paced racing game that is sure to get your heart pumping. ![]() Do stunts in the air to shave time off of your run! Make it through the course as quickly as possible. Change the muckLane value from /50 to /25 or /75 to see what happens next.Use the arrow keys to accelerate, brake, or flip your bike. Now that the computer knows when your motorbike will pass over the muck, it will slow down your motorbike speed in half as you move over the muck on the track. Line 66 of the code determines when to display the 'muck' image on screen. The muckLane parameter will slow your motorbike down using the following calculation: muckLane = int((bike.laneY- 375)/ 50)+ 1 Transversely, the on_key_down(key) function will send your motorbike into a nosedive. Translation: The faster your motorbike is moving, the higher the number of the Y axis (or very big jump). These code bits tell the computer to slow the motorbike down or speed up (depending on what key the user presses on the keyboard). The keyboard.right and keyboard.left parameters are defined in the update() function. All you need to do is change the reference to ' bike0' here: bike = Actor( 'bike0', center=( 150, 350), anchor=( 'center', 'bottom'))Īlso make sure to perform a find and replace action with the name of the picture (without the image extension).ĬheckBikeRamp() is the function that does the work to calculate the Y axis so that your motorbike (or truck) goes up the ramp (and gets some serious air if you're lucky). You'll want to create two images (one with a slightly increased height) to add some realism. Then, place this file (picture.png) into the ' images' folder (within the source-code-excitebike folder). Screen.blit( "rock1", ((t* 100)+trackOffset -50, 270))ĭo you want to replace your motorbike with a Monster truck, four-wheeler, or another vehicle? Maybe you want to race a unicorn to the finish line?Īll you need to do is draw a 50x50px image (with a transparent background). Once you create a backup copy of the python code, try changing the below numbers to see what happens to the rocks on screen! screen.blit( "crowd1", ((t* 100)+trackOffset -100, 0)) The second and third lines of code, below, work together to simulate the scenery in a tidy fashion. The rock images are displayed on the screen in two parts. ![]() ![]() Yet, the code, below, tells the computer when to draw the image so that it appears as if there is a simulated crowd behind the motorcycle as it moves. The supplied crowd image is only 100px wide. ![]() This code draws image blocks on the screen at certain intervals and particular positions on the screen. The below items in quotes represent an image. Instead of the start time, the time is calculated from when the motorbike passes a predefined track position (mentioned as trackPos < -4800 in the code). Lap time is constantly calculating the difference between the initial right arrow key press (start time) and the current time. You'll also notice calculations for lap time and the last lap (this is represented by the time counter at the bottom of the screen). The word, " background," refers to the background image (linking the images to the background block is thanks to the imported Pygame Zero modules). A " blit" refers to a block that is drawn on the screen. The draw function draws the background as the bike image moves. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |