Jump to content

Bullets


frankdev
 Share

Recommended Posts

Just was fooling around with a little bit of a pvp "shooter" and I couldn't really think of a good bullet function. Right now, you fire, and once the bullet leaves the screen, you can fire again. I would prefer a rapid firing system where you hold down the key and it fires over and over. 

 

I am a beginner and I have ordered some of those books ;)

 

The game is here: www.lionela.site90.com

 

Controls: WASD and Q fire and Arrow Keys and Space fire

Link to comment
Share on other sites

Here take one:

http://www.youtube.com/watch?v=pMUEeljMwWs

 

But as you made, one bullet to be shot just call the function again or make a logic like this:

 

if ("space" is pressed) {

game.firebullet();

}

 

and with this in the game loop as long as the space is pressed the bullets will fire.

 

Also as you say that you are new, it good practice to make a pool of objects like 100 bullets and reuse them,

or if you don 't do this  at least destroy your bullet once it left the game view port.

 

And as I saw you are using CraftyJS check this game's code:

 

http://blackscorp.github.io/cron/

 

There a lot things you could just pick off ;)

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...