Jyotirmoy Sundi
Jyotirmoy Sundi

Reputation: 355

moving object in html/css/javascript detecting collision with other objects

I want to make a moving man in css/html/javascript, also detect collisions with other objects. Any idea how to do it? or any pointers to the same will do great.

Upvotes: 1

Views: 1122

Answers (2)

Rodrigo
Rodrigo

Reputation: 704

Pretty much any basic game tutorial covers the topics you asked. If you can't find a javascript version of that, just get anything in a language you are familiar and try to code the same thing in javascript.

to draw things somewhat in the same way these tutorials probably do, use a div with "position:relative" and its children with "position:absolute" and use "top" and "left" css style proprieties to position the boxes/sprites/whatever.

I am pretty sure you can figure out what to do if you follow these tips.

Upvotes: 0

khael
khael

Reputation: 2610

The first try is look at rapahel js project it uses canvas, second it is a pretty hard thing to do as you want your own physics engine at 2 D level, but i guess with some math formulas you could do it, but everything that you need as an object should be scripted in js to be sure to get the collision effect.

Some design patterns should help you to make your code better.

Good luck.

Upvotes: 1

Related Questions