AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Car racing game in java source code4/7/2023 Logo = ('car game/logo.jpeg')īg = ('car game/bg.png') Now, we are good to go.įrom pygame.locals import* #import all modules from Pygame We saw that there is math involved in this so to perform the mathematical operation there is a module in Python named math so we have to import the math module this is a built-in module so you didn’t need to install it just simply type ‘ import math and this will import the math module. In case you don’t know the formula you should not worry you can google it and understand its uses and the concept behind it. So, we’ll be using the same formula in our game to find the distance between the cars. If you have read ‘ coordinate geometry‘ in your school then you might know that there was a ‘ distance formula’ which is used to find the distance between two points. Now we’ll be focusing on detecting the collision between the so that we can use it to quit and make us feel like we are really playing a game.įor collision the first thing we need to do is to find the distance between the car and using the distance we would code something to make the collision occur. Click Here for Part1 Detecting collision between the cars
0 Comments
Read More
Leave a Reply. |