Alien War Game - Code to Play :-)


Alien War Game ON

Story Time :-)

Imagine that we are in the year 3000 , Aliens are friends with Homo Sapiens at this time . Aliens are silicon based and they do not possess feelings (VROOM ....ROBO DA ROBO DA ๐Ÿ˜›). Life is smooth , but at that time the Annual Alien vs Homo Sapiens coding competition goes live . This is the only place where Aliens' as well as mankind clash with each other . Each and every Coding clubs across the galaxy is brushing up their skills. In parallel to this competition, there are some Code to Play Sessions conducted by various clubs. It is a fun session where people with basic coding knowledge can also code their game :-) This session is hosted by Coding Club India . All are pretty excited . I hope you people are curious. Let us deep dive into the game coding part . (End of story)

Game Video๐ŸŽฎ



You people couldn't believe it right ! Yaaasss , we can code this game with HTML and JavaScript only. Excited ?! I am here to explain you in detail the whole process. All you need is the patience to read and learn :-) Happy Learning ๐Ÿ’–

Code to Play ๐Ÿ’ป

Prerequisites 

PC/Laptop with internet connection
Chrome/Firefox browser
Notepad/ Code editors
Basics of  HTML and JavaScript

Note: Code link is given below . You can read this post side by side with the source code


Sections of game๐Ÿ’ฅ

Canvas
Alien ship
Keyboard Handle
Firing Bullets
Back Ground Music
Credits


Canvas

Canvas is basically used to paint something or to draw something. The code snippet defines the style properties of the canvas which we are going to use.

Alien ship

We are going to create an array of Alien Ship image in the canvas which will also give us a hovering effect. In the snippet X,Y denotes the co-ordinates of the particular image

Keyboard Handle

From the phrase , it is clear that this will be the main control of the game. It is designed in such a way that UP, DOWN , LEFT , RIGHT are used for positioning of the ship . SPACE KEY is used for firing bullets

Firing Bullets

A dedicated function is called for firing bullets . If SPACE KEY status is active then the ship will be firing the bullets


Background Music

What is the thrill in it , if a game does not have a BGM !!??  The BGM has copyrights . Here I am giving the credits to Allan Walker .


Credits

The credits of the source code goes to  Coding Club India  .  The source code of the Alien War game can be downloaded from here . The detailed explanation of the game code and its functionalities can be found at Coding Club India YT 

Here goes my version of game :-)

P.s : The game will be more interesting if we have a score board and many of you may think , what happens when ships hit each other . It will be seen in the advancement of this Game Version. that is a content for another post . Until then Keep Learning

Thanks for Reading




Comments

Popular posts from this blog

Tech Taste #2

Tech Taste #1

An Emotional Read...