New App Project: Poplaser!

in #programming7 years ago

popsocket
Image Source

Have any of you gotten your hands on a Popsocket? One of the first things I noticed when I put one on my phone was how it made a little handle. So I did what any self-respecting person would do. I pretended I was holding a laser gun and shot my kid with it while saying "Pew pew!"

When I got my hands on more, I put one on his phone and we shot each other for a while.

Then I was thinking, how about a laser gun app? Inspired by Popsockets, I gave it a starter name of Poplaser(s). Since there is no trigger on the popsocket, the game will know to fire when the phone is level. I will add a few custom orientation settings as well so you can shoot more than just when level.

Here's a level app that I'm using as my base to make this game. The source code is free to use. I made a sample icon and changed the name.
laser

I found this free sound effect generator program, and I made my own laser sounds with it.
Bfxr

After that, I hunted through the code to figure out how it all worked. When the level reads "level", the app makes a ding sound. I changed that to my laser sound and added the wav file to the res/raw folder.

I found where it called the level tone...

...and changed it to my sound. I also set it to use the phone's media volume instead of the ringtone volume.

So now it shoots every time it is level! Only, level is pretty specific. I dug around a little more and found how it determines level, and changed it to "level +/- 5" instead.

There. Now it will keep firing when held level.

Next I need to understand how the UI works. Up until this point, I've only worked with text-based screens with some pics added in. This one uses canvas, which I'm not familiar with.

Also, I need to disable all the other screens in the level, so I only have the one.

After that, I'll work on making a flashy laser gun graphic, and I'll add animations and different weapons too! Some ideas I have for that are a heavy laser, an electric beam, and a healing beam.

Coin Marketplace

STEEM 0.27
TRX 0.26
JST 0.039
BTC 94467.52
ETH 3348.45
USDT 1.00
SBD 3.35