Multi shooting canvas game with object pooling

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:


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 :slight_smile: