Share My Creation Pocket Invaders - Open source project

Pocket Invaders v1.3 - Open Source project. Re-created and adapted by myself for Basic4android.
Original concept by Paul Grayston (Team Rebellion Software).

The aim of this project is to show how Basic4android (with my Game Sprite library) can be used to create a fully-featured smooth (hardware-accelerated) 2D game.

pi1_zpse0a9cf02.png
pi_screenshot2_zps8e3b2124.png


The project is open source and improvements or feature additions are welcome.
Everything is pretty bare bones but the general game play is in place.

The project is available here, included in the Game Sprite libray
v1.0 - 26/7/13 - First release
v1.1 - 28/7/13 - Tweaks to limit calls to unnecessary collision checks. Bug fixes for when player is injured. Additional hits via blocks/alien bullets discarded
v1.2 - 29/7/13 - Changed collision so that objects now have their own defined bounding boxes. This particulary helps the player by reducing its collision area. For example the turret is no longer part of the collision check.
v1.3 - 14/02/13 - Now using my Game Sprite library
 
Last edited:

Jim Brown

Active Member
Licensed User
Longtime User
Shame. I tried to keep actual game resources and management low. Potentially there can be 70+ game objects being updated per tick though.
Sprites are very small and pre-cut from a sprite sheet via your imgUtil.Crop() function prior to game play.
BTW minor tweaks and bug fixes undertaken and re-uploaded (v1.1)
 

capisx

Member
Licensed User
Longtime User
wow, another great example for coding games with B4A. Thanks Jim for sharing this.
On my G-Tab 7" (Gingerbread) shows 18-20fps, on my Lenovo A800 (ICS) shows 50-56fps
 

bsnqt

Active Member
Licensed User
Longtime User
Thanks for sharing, it is just excellent , I can learn a lot from such sharing and B4A ... Run smoothly on my device (Sony Experia XS)
I love this forum... :)
 

eps

Expert
Licensed User
Longtime User
Excellent, will try and take a look at this.. :)

I guess for it to work smoothly on all devices it might need to have a Settings / Adaptive function to work out how powerful, or not, the processor and device is.
 

Informatix

Expert
Licensed User
Longtime User
From my point of view, there's a major problem with the collision system. I'm hit despite the shot is blocked above me or is still a few pixels away. Since your ships have a polygon shape, you have two ways to detect collisions: either compute the intersection between a segment and a polygon if you love maths, or compute the intersection between a segment and all the rectangles bounding the ships (one rectangle is not enough).
There's also a scaling problem. On my phone, the aliens are so close to each other that they overlap.
 

Jim Brown

Active Member
Licensed User
Longtime User
I have changed the collision so that each game object gets their own defined collision box. I have also renamed the .OverlapsWith() to .CollidesWith()
The player collision area now excludes the turret part. This makes it easier to go under the defense blocks and shoot them back up.

There's also a scaling problem. On my phone, the aliens are so close to each other that they overlap
What's the resolution? I tried playing the game via the GenyMotion x86 emulator and the game scales well under 320x
Scaling is done before any of the game objects are drawn. For example
B4X:
Dim scX As Float = s.Width/vWidth
Dim scY As Float = s.Height/vHeight
ac.ScaleCanvas(scX,scY)
 

Jim Brown

Active Member
Licensed User
Longtime User
Pocket Invaders has now been updated to run with my Game Sprite library. See first post.
Other minor tweaks in place too. Please report any issues.
 
Top