Space War Shooting Game using JavaScript

Published on . Written by

Space War Shooting Game using JavaScript

Game development is one of the famous and interesting fields in today’s world. All of us like to play various games like racing, shooting, fighting, etc. But do you want to learn, How these games can be designed and developed? Let’s start this journey with basic game Space War Shooting which is commonly known as Space Invaders. 

Read more..

SLNOTE

Skyfi Labs Projects
Space War Shooting Game Project Description

Space War Shooting Game or Space Invaders is the game released in 1978. It was the most popular shooting game in those years. This project is for beginners and can clear many coding concepts in java. Many students searched for it for their first year or second-year minor project. There are few milestones for development.

  1. Disappear, aliens, when players shoot them.
  2. Ensure that only bottom aliens get to disappear.
  3. Speed becomes faster with time
  4. Aliens also can attack
  5. Score and Lives of the player

SLLATEST
Concepts Used

  • HTML
  • Java
  • JavaScript
Project Implementation

  1. The first task is to create a number of aliens as opponents of the player. For that choose an image for the alien. Create an alien class in which you have to specify the position of the image by using x, y locations.
  2. Divide the page with the number of rows and columns and mention it in draw().
  3. After that create War class which includes all the functions related to the movements of the aliens in the x and y-axis.
  4. Now we have to make the targeted bottom alien vanish. So in our War class, create a new function for determining the collision, also if there is a collision disappear the alien from the game.
  5. Add a handler called mousePressed() in sketch.js file.
  6. Don’t forget to refer to the java files in index.html.
  7. After this, you have to add bullets. Create Bullet class which will design bullets that are fired by the player. Declare reactions of bullets in draw(). After that, we have to add bullets fired by aliens. For that create an AlienBullet class and inherit it with a bullet class. 
  8. The next step is to create a player. As we created aliens by just an image, like that we can design a player's spaceship with an image.
  9. Create a Player class and add required functions like movingright(), movingleft() etc.
  10. You can add an if-else condition for the movement of the spaceship with the blocks of 1 or 2. 
  11. At the end insert “Lives” and “Score” of the player by declaring it in draw().
  12. You have done this project.
It gives a primary look at the game called space war shooting. You can google many other ways that can make the game more attractive.

Benefits of the project

  • You will be able to integrate multiple files in the project.
  • It will clear the concepts and practical use of class, function, and constructors.
  • It is a fun and practices purpose project.
  • You can learn simple animation by implementing this project.

SLDYK
Kit required to develop Space War Shooting Game using JavaScript:
Technologies you will learn by working on Space War Shooting Game using JavaScript:


Any Questions?