0
\$\begingroup\$

I'm currently trying to make a fairly simple game in JavaScript and it isn't going too well.

Before I started, I thought I'd only need to know three things (on top of what I already know) which were:

  1. How to 'spawn' an object (i.e. a bullet) by pressing an on-screen button.
  2. How to make that bullet move across the screen.
  3. How to make that bullet collide with something.

I thought the first two would be pretty simple, but I cannot find anything online to help me with them. Source code and tutorials appear to be either too simple or too complicated, and I'm starting to worry this project will be a lot more complicated than I thought.

So, can anyone help me do any of the listed things? If so it'd be much appreciated!

\$\endgroup\$
4
  • \$\begingroup\$ What have you tried so far? Have you looked into any existing frameworks or engines? Do you have any game dev experience at all? \$\endgroup\$
    – Tetrad
    Commented Aug 16, 2011 at 23:38
  • \$\begingroup\$ I haven't found anything to try, which is the problem and why I'm now asking here. If what I'm asking is fairly complicated then I'll come back to it at a later date when I know more, but I thought/hoped it'd be quite simple. I've made more complex games than my planned game in Javascript in GameMaker but I'm not sure if that counts haha... \$\endgroup\$
    – Poggins
    Commented Aug 16, 2011 at 23:45
  • \$\begingroup\$ Try this question: gamedev.stackexchange.com/questions/1396/…. It has some tips that you might find useful throughout the various answers. \$\endgroup\$
    – Cypher
    Commented Aug 17, 2011 at 2:48
  • \$\begingroup\$ Also this might be of interest: gamedev.stackexchange.com/questions/4277/… \$\endgroup\$
    – bummzack
    Commented Aug 17, 2011 at 5:58

1 Answer 1

3
\$\begingroup\$

Though the game idea you're talking about is pretty simple, there's a fair bit of work that has to go into coding such a game in JavaScript, or any other language for that matter.

Fortunately though, there are lots of libraries available that can help you out with a lot of the details, like spawning a bullet, moving it, and detecting when it hits something.

My advice would be to go check out a JavaScript game library such as gameQuery. gameQuery is one of many game libraries available, and it has a good introductory tutorial that you might find useful.

So if you want to get started with a basic game, head over to http://gamequery.onaluf.org/tutorials/1/ and read the tutorial on creating a basic game with gameQuery and JavaScript. Do the tutorial first as is, and then later modify it to change how the game looks or behaves if you'd like something different. Working from an existing game (modding as it's called sometimes) is a great way to get started -- a lot better than starting from scratch.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I think you mean gamequery which is a "Javascript game engine for jQuery" jQuery itself isn't a game library, just a general browser Javascript library. \$\endgroup\$
    – David Ly
    Commented Aug 17, 2011 at 14:01
  • \$\begingroup\$ ACK! Yes I did Davy8, thanks. I'll edit my post. \$\endgroup\$
    – Tim Holt
    Commented Aug 17, 2011 at 14:47

Not the answer you're looking for? Browse other questions tagged .