Alien War Game - Code to Play :-)
Alien War Game ONStory 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 ๐ปPrerequisitesPC/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
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 HandleFrom 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 BulletsA dedicated function is called for firing bullets . If SPACE KEY status is active then the ship will be firing the bullets Background MusicWhat 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 . CreditsThe 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 LearningThanks for Reading |
Comments
Post a Comment