Games [XUI2D] X2 v2.0 - 2021

Erel

B4X founder
Staff member
Licensed User
Longtime User

X2 is an open source, cross platform 2d game engine based on box2d physics engine and BitmapCreator as the rendering engine.
X2 itself is a b4xlib library.

The first versions of X2 lead the way to cross platform B4X projects. The new update goes the other way, and makes X2 work with B4XPages. This simplifies several things.
There is also a new class named X2Multitouch which provides a cross platform method to handle touches, multitouches and keys (B4J).

X2 works best with Tiled map editor: https://www.mapeditor.org/
Due to a compatibility with Tiled 1.9.0, please use this version for now: https://update.mapeditor.org/snapshots-win/Tiled-2021.03.23-win64.msi
When you first start with Tiled, you need to import the x2 custom properties. This is done with:
View - Objects Types Editor - File - Import and find objecttypes.json: X2\X2 Source Folder\Shared Files\objecttypes.json

If you are not seeing the custom properties when selecting an object then it is misconfigured:
SS-2018-08-24_09.36.45.png


X2 source code and examples are available on github:
Download link: https://github.com/AnywhereSoftware/X2/archive/refs/heads/main.zip
X2.b4xlib: https://github.com/AnywhereSoftware/X2/raw/main/X2 Source Folder/X2.b4xlib

The first effort was to update the almost 20 examples to the new version.
Some of the examples are a bit complex and are more of a "proof of concept" projects.

Recommendations:
1. Start with B4J
2. Start with these examples and more or less in this order (the examples threads were not yet updated):

- HelloWorld
- GameTemplate - same as File - New - X2 Game.
- Joints - https://www.b4x.com/android/forum/threads/96547/#content
- Newton Cradle - https://www.b4x.com/android/forum/threads/97029/#content
- Touchy - https://www.b4x.com/android/forum/threads/xui2d-touchy-example-x2multitouch.131307/
- Ilan's First App - https://www.b4x.com/android/forum/threads/very-very-very-simple-xui2d-test-project.96793/post-611080
- Tank Attack - https://www.b4x.com/android/forum/threads/xui2d-tank-example.96567/#content
- Collisions - https://www.b4x.com/android/forum/threads/97144/#content
- LargeBackground - https://www.b4x.com/android/forum/threads/xui2d-large-background-class-example.131589/
- ParallaxBackground - https://www.b4x.com/android/forum/threads/xui2d-parallax-background.131606/#post-829749
- Breakout - https://www.b4x.com/android/forum/threads/xui2d-breakout-example.131395/
- Space Shooter - https://www.b4x.com/android/forum/threads/99614/#content
- Monster Truck - https://www.b4x.com/android/forum/threads/96622/#content
- Tetris - no physics game - https://www.b4x.com/android/forum/threads/107698/#content
- TilesMap - https://www.b4x.com/android/forum/threads/95508/#content
- Mouse Following Path - https://www.b4x.com/android/forum/threads/98895/#content
- Clumsy Bird: https://www.b4x.com/android/forum/threads/95302/#content
- Space Shooter - https://www.b4x.com/android/forum/threads/99614/#content
- Angry Birds: https://www.b4x.com/android/forum/threads/99052/#content
- Mario - https://www.b4x.com/android/forum/threads/96236/#content
- Space Invaders - https://www.b4x.com/android/forum/threads/96263/#content
- MultiplePages - A simple example where the template game is hosted in a different B4XPage.

Proof of concept projects:
- Walking Character - includes all kind of random features.
- Lines - https://www.b4x.com/android/forum/threads/96934/#content
- Floating bodies: https://www.b4x.com/android/forum/threads/98243/#content

Tips
- The files from the Shared Files folder are copied to the platform specific folder during compilation. Don't update the files in the Files folder as they will be overwritten (except of files unique to the current platform).

Updated X2 Game.b4xtemplate is attached. It includes the manifest line from post #10.
 

Attachments

  • X2 Game.b4xtemplate
    91.2 KB · Views: 853
Last edited:

ilan

Expert
Licensed User
Longtime User
That's awesome erel. i believe that xui2d has a lot of potentials it just needs some published games in the store to prove it is a good framework and this will make it more interesting for people. i am planning to make one in the near future.
 

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
After updating; I got this error when opening B4J Space Shooter example:
Unknown type: b4xmainpage
Are you missing a library reference?
and the compiler error:
Error description: Unknown type: b4xmainpage
Are you missing a library reference?
Error occurred on line: 73 (B4XPages)
Public Sub MainPage As B4XMainPage
What I missed?
 

khandah

Member
I am using B4A, and I see that the module Game.bas is for B4J.
Can you help please ?
Thank you in advance.
 
Top