# Multi shooting canvas game with object pooling

**URL:** https://forum.kirupa.com/t/multi-shooting-canvas-game-with-object-pooling/639962
**Category:** programming
**Created:** [June 20, 2019, 10:30am UTC](https://forum.kirupa.com/t/multi-shooting-canvas-game-with-object-pooling/639962 "2019-06-20T10:30:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![gwgwpl](https://avatars.discourse-cdn.com/v4/letter/g/e56c9b/32.png) [@gwgwpl](https://forum.kirupa.com/u/gwgwpl)
#### Post date: [June 20, 2019, 10:30am UTC](https://forum.kirupa.com/t/multi-shooting-canvas-game-with-object-pooling/639962/1 "2019-06-20T10:30:23Z")

</div>

Hello, i’m trying to create something similar,but simpler than old galaxian tutorial game on canvas,with pure javascript, based on code from this link:

> **[Galaxian |](http://blog.sklambert.com/tag/galaxian/)**
>
> JavaScript and HTML5 Game Development.

  
What i’am trying to do is place on canvas 4 shooting objects,i call them snipers,  
and allow them to shoot bullets from pool using keydown event on a s d f letters,  
so one letter allows one sniper shoot one bullet from a Pool  
Do you know any simple examples of code that allows to shoot bullets on many places on canvas using keydown events?  
I mean, my snipers have static x,y,w,h,color values and will shoot only in one direction, to the top of the canvas, but i got lost trying to force them to shoot bullets at once  
if only one sniper is shooting i need to get only one bullet from a pool, but if i press all keys asdf i need to draw 4 bullets on x1234 and y1234 coordinates  
Also i found an article that is using double direction list,and telling me that push() on arrays is expensive operation, so i got totally lost, and don’t know what to use and what not  
Is drawing shapes is more expensive than drawing images from src on canvas?  
Should i use push() on arrays to get bullet from Pool?,  
My code will use many short-living objects, they should die when they go off the screen,  
and go back to the pool, but i’m confusing how to bind each Sniper() object to shoot bullet in one canvas location using global pool of objects for each sniper…  
Could you,please share any code examples or links that you know with me?,  
anything similar or anything that is using keydown events and pooling?  
sorry for my poor English 🙂
