0

Hi,

I need to make a game in JavaScript where a user moves an image (or anything) around a grid and if they hit a wall they lose a life and in each grid box there needs to be colours and different colours have different speed affects on the player. So red could make the player move faster and blue could make it slower etc. A timer also needs to also be recording how long the player takes, to go from one side of the grid to the other.

I know the basis of JS, like variables, arrays, events and objects but I am not too sure where to start with the game. If someone could be kind enough to show me the code to make this then I can understand and build further and further, I just need some assistance in the fundamental steps above.

Thanks in advance...

Edited by Kent55

5
Contributors
4
Replies
32
Views
3 Years
Discussion Span
Last Post by Dervish1
-1

there is many games in java script >> its very amazing >> I wish to make one like it soon :)

Edited by zainab issa

0

If you think of the screen as a grid, or even a DIV as a grid of pixels, you already have your grid in place. From there, your JS simply has to control an absolutely positioned element within a relatively positioned parent. You can do pretty much anything once you get the offsetTop and offsetLeft of an element on the page. From there it's just math and collision detection.

And jquery isnt the end all be all of javascript. Its bloated for specialized use. Potentially, one could argue, it's not at all suitable for game development as it solves many of its problems using pure script instead of using CSS to allow for hardware and browser acceleration.

0

While that game example doesn't really make good use of jquery (it would be almost identical if written without using the jquery library -- drag and drop is built into HTML5 and doesn't require much extra work beyond what was already done there), making a game typically involves lots of customized UI elements for which jquery is probably a reasonable choice, and you won't be hurt by learning it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.