Using vanilla JavaScript is a bad idea


ADBlock blocks some content on the website


I want to create a game similar to ElastoMania in JavaScript.

I was wondering, would collision detection be impossible to use divs since they are square and the gameplay revolves around slopes drifting etc?

would this be feasible in canvas?

Also, would using a library like jQuery slow down the running of a JS game? I've noticed most games are built with Vanilla JS, so I got the idea that for this type of application a library (a game) is a bad idea.



This seems like a complicated game! I. can still go ahead with him. If anyone wants to jump on board this project please contact me.


Separate your model from your presentation.

The game logic and "physics" will require custom scripts, and has nothing to do with the presentation model (i.e. divs).

You may be able to use jQuery for the presentation page, but this is a special case, performance-intensive application, and, well, there's a reason most games are written in "vanilla" script.


This is a very good JavaScript implementation of a bullet simulator.
Maybe you can learn something from it. Maybe it can be used for tire collision detection in your project. This demo shows that it is possible to implement physical models in Javascript with reasonable performance.

As you may already know, there is an open source implementation of a game similar to ElastoMania called X-Moto
X-Moto uses ODE.

Edit: I just have a JavaScript implementation of Box2D: Box2D -js

If it slopes up I would rather use a 1-D array to store the elevation at each point and to id denote every time I need to check the position of the player against the ground. So, you would need a basicaly picture of the slope and the corresponding amount of y-s at each x:

024443330000 ... etc.

There is one problem, however: You couldn't have ideal vertical edges there as they would need 2 y points per 1 x

You can get a gradient effect by using different colors of the borders of a div.

will give you a diagonal border that you might find useful.

Get answers to millions of questions and give back by sharing your knowledge with others.

Sign up for an account.

The contents are licensed under creative commons.

If you find copyright violations, you can contact us at to request the removal of the content.