Make a Smartphone Controlled Space Battle in PictoBlox- Scratch 3.0 Based Programming Software

by theSTEMpedia in Living > Video Games

1729 Views, 6 Favorites, 0 Comments

Make a Smartphone Controlled Space Battle in PictoBlox- Scratch 3.0 Based Programming Software

P1144034.MOV.02_01_45_21.Still001.bmp
P1144039.MOV.02_03_38_19.Still002.jpg

All the gamers out there! This project is for YOU! Till now you may just have played all the video games out there. But have you ever made a video game of your own! If not, then get ready to make one with this project! We’re going to make a cool space battle game using PictoBlox, a Scratch-based graphical programming software with advanced interaction capabilities. And we’re going to play it with a Smartphone using Dabble, our ingenious project interaction and controller app!

You can download PictoBlox from HERE and get Dabble on Google Play. Ready to take down some monsters?

Ready, set, GO!

List of Components Required

Hardware

  • evive
  • HC05 Bluetooth Module
  • USB Cable

Software

  • PictoBlox
  • Dabble

All the above components along with other hundreds of electronics and mechanical components are available in the Starter Kit. Which lets you make many more projects.

Getting the Stage Ready

SpaceBackdrop.jpg

First, let’s get the stage ready. As by the name, the battle is going to take place in space, we need a backdrop(Stage or the background) of outer space.

Click on the “Choose a Backdrop” button in the bottom-right corner and select the Stars backdrop from the library.

Adding the Characters Into the Picture

Adding-3-sprites.png

Now we will bring in the characters or the sprites. As Tobi isn't needed in the space battle right-click on his icon and select delete from the drop-down menu.

Now, click on the “Choose a Sprite” button next to the "Choose a Backdrop" button to open the library to add the sprite.

For the space battle game, we need three characters: a Rocketship, the enemy or the space monsters, and the monster-killing bullets. Add them one by one from the library.

Writing the Script for the Rocketship

To write the script for our Rocketship first select it from the Sprite Pallete.

Set x as 0 and y as -140 into the x () y () block; these coordinates will be our rocketship’s initial position.

Change the rocket's size to 40% of the original size.

The Health variable will monitor the health of our rocket ship and the Score variable will keep track of how many enemies we have killed.

Set the Initial value of health to 3 and Score to 0 using the set variable to () block.

We’re going to control the movement of our Rocketship using Dabble’s Gamepad module. The following actions will be triggered.

  • On pressing Left, the value of x coordinate will change by -15 i.e our Rocketship will move 15 steps in the left.
  • On pressing Right on the gamepad, the value of x coordinate will change by 15 and the rocket will go right.
  • On pressing Triangle button on the gamepad, the bullets should start firing.

Note: To make the bullets fire each time we press the triangle, thus use the clone block.

Write the following script:

Creating Monster Clones

We need to make look like the monsters are continuously attacking.

Select the Monster Sprite from the Sprites library.

Write the following script for the same:

Note: The clone block duplicates the monster and the next costume block brings in different monster.

The Health and the Score

The health of the rocketship and our score completely depends on the monster. We are going to write the script for the following possible case:

  1. As soon as a monster is hit by a bullet, the score should increase by 1 and the monster should disappear.
  2. If a monster touches our Rocketship, its health will decrease by 1 and the monster should disappear.
  3. Also, the game should end as soon as Health goes down to zero.

The following script functions for the points above.

Script for the Bullet

It's time to write the script for the monster-killing bullet.

Thus, select the Bullet Sprite from the Sprite palette.

  1. The initial position of the bullet same as that of the rocketship so that it appears that the ship is firing the bullets.
  2. Also, the bullet should disappear as soon as it touches the monster or the edge.

Write the following script for the same:

Connecting With Dabble

Game Pad_Connected.png

Follow the steps given below to pair Dabble with evive:

Connect the HC-05 Bluetooth module (available in the Starter Kit) to evive.

Install Dabble in your Smartphone from Play Store.

Click on the Connect-Disconnect icon and select the appropriate device from the list. You can find it by matching the last few characters of the ID written on the Bluetooth module. After a successful connection, a message will be displayed for the same. If not, then go to the Bluetooth settings of your phone to pair the devices (The default passwords 1234 or 0000).

Open the Gamepad module in Dabble and select Digital mode. And play!!!

Conclusion

With this, your game is ready! Go out there and kick down those nasty monsters! B)