SalesforceBlue

Feel the rhythm of Salesforce

Goodies

Create A 2D Car Race Game On Salesforce

You may have played a 2D car race game named Road Fighter on the classic gaming console.

A similar prototype I have created using visualforce page and apex. Please note that the actual implementation of this game I have done a few years back i.e. when visualforce pages were used actively. So, you can take this implementation to add your own designs/levels or to learn the approach behind it. You can also take it as a project for converting this visualforce implementation to the LWC version.

Let’s split the game components into the below parts so you can understand it better by going through the code base.

  1. User Input Form
  2. Race Track
  3. Traffic Cars
  4. Player Car
  5. Traffic Cars Movement
  6. Player Car Movement
  7. Collision Detection
  8. Scoring
  9. Saving to DB

Please go to the Git Hub link for this project and you can deploy the package in your personal dev org to explore it.

The racing engine logic is written on the race_wars visualforce page. If you view the javascript code in this file you can see all the relevant methods implemented for all the above-shared modules with similar method names.

Here is the video of what you can experience while playing this game 🙂

Thank you for visiting SalesforceBlue.com
If you have any queries feel free to write down a comment below 🙂


3 thoughts on “Create A 2D Car Race Game On Salesforce

  • Thiyag

    That’s good one.

    Reply
    • Pankaj Agrahari

      Thanks, Thiyag 🙂

      Reply
  • Working at Walmart

    Thanks for sharing your thoughts!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *