Example

Tutorial

Click on the example then move the player up/down with arrow keys and shoot with 'space'.

Fully understand the concept by watching the tutorial in full screen at high res.

Code Reference

Once you have watched the video, you can refer to the code below to help you make your own that fits your game. Make sure you type it yourself to help you learn.

This code will allow you to fire a single bullet that becomes available again after it leaves the screen area.

I would suggest putting the code on the right in a separate file called 'bullet' etc.