Games Multi Arcade Game (WIP)

melonZgz

Active Member
Licensed User
Longtime User
Totally understand. I've been thinking about this myself lately. It's great to have something simple available like libgdx b4a library to use for free. But it's not officially supported and could stop working any moment like you say. I've been tempted to look elsewhere but haven't looked much so am not sure what else I could use that would be as simple.
I have 2 big games in production (this one and the bubble one, and not forgettin the Hill Racing one and it's updates), but after these ones I'll try another engine. I've been searching and I find Godot a very good way of making games.
Back on topic, I've done some progress on a 1D pacman game:


(it's a copy/ inspired on this)
 

melonZgz

Active Member
Licensed User
Longtime User
And here comes the racing game:


The concept is simple, as you progress the velocity increases and also does the traffic.
There will be different stages (not shown in the video) and more animations, particles and stuff like that
Now I'd like to take an approach to the shooter game, I think it will be the most difficult one...
 

andymc

Well-Known Member
Licensed User
Longtime User
I'd love to see a write up on how you handle the code layout for this type of game. Are the game in separate modules, or just different gameloops within one big file? Are you still using box2d for collisions and basic physics?
 

melonZgz

Active Member
Licensed User
Longtime User
I'd love to see a write up on how you handle the code layout for this type of game. Are the game in separate modules, or just different gameloops within one big file? Are you still using box2d for collisions and basic physics?
Usually I use A LOT of classes. ie, for the pinball I have one for the ball, for the flipper, for the bumper, for the sensor...
What I've done here is a main class, and I have in globals:

globals:
Dim lGdx As LibGDX
Dim GL As lgGL   
...   
Dim pinball As cPINBALL
Dim basket As cBASKET
Dim flappy As cFLAPPY
...
Dim IP As lgInputProcessor   
Dim GD As lgGestureDetector

I have a cPINBALL class where I do everything related to the pinball (from input processing to rendering and physics, wich are box2D physics), another for the basket, and another for each game.
For the input processing I have something like this in main:

input in main:
Sub IP_TouchDown(screenX As Int, screenY As Int, Pointer As Int) As Boolean
    controlGUI.IP_TouchDown(screenX, screenY, Pointer)   
    If drawPinball Then
        pinball.IP_TouchDown(screenX, screenY, Pointer)
    Else if drawbasket Then
        basket.IP_TouchDown(screenX, screenY, Pointer)       
    Else if drawFlappy Then
    ...
End Sub

The same for the rest of events. And inside pinball I have this event, wich handles all the logic for the pinball game:

B4X:
Sub IP_TouchDown(screenX As Int, screenY As Int, Pointer As Int) As Boolean      
...
End Sub

For the rendering, almost the same, from main I call
B4X:
Sub LG_Render   
    'Clears the screen
    GL.glClearColor(0.8, 0.8, 0.8, 1)
    GL.glClear(GL.GL10_COLOR_BUFFER_BIT)

    Dim deltatime As Float

    ...
    deltatime = lGdx.Graphics.deltatime   
    If drawPinball Then
        pinball.render(deltatime)   
    ...

And inside the pinball render event I do all the drawings and updates

Almost the same for the physics
Inside my cPINBALL class I have a World object

B4X:
    Dim World As lgBox2DWorld

And inside the initialize event for the cPINBALL class I have

B4X:
    Dim vGravity As lgMathVector2
    World.Initialize(vGravity.set(0, -2), True, "Box2D")

And the events are inside this class

B4X:
Sub Box2D_BeginContact(Contact As lgBox2DContact)

Sub Box2D_PreSolve(Contact As lgBox2DContact, OldManifold As lgBox2DManifold)

Sub Box2D_PostSolve(Contact As lgBox2DContact, Impulse As lgBox2DContactImpulse)

And the events are raised automatically (I mean, I dont have these events in main)
 

melonZgz

Active Member
Licensed User
Longtime User
Well, it's maybe too soon to show this, as this needs still A LOT of work, but I got excited as everything went better than expected and I've been able to make an approach to a shooter game in just 2 days and I feel very proud of it :)


I still have to add powerups and increasing difficulty, but it's a start and it's allready enjoyable.
From this point on, I guess that the fun part (or at least the creative part) is over. Now it's time to polish everything, adjust the difficulty curve of each game, add music and various effects, find a way to progress in the game to unlock things... so I guess this will be the last progress shown in a long time.
 
Top