Share My Creation B4J Mario [Collision Detection Prototype]

Hi everyone!

I'd like to show you all my little "science experiment" in B4J, using only the core lib.

Untitled_1.png


Click the attached JAR file to try it out and/or download the whole project.

Update 21-10-2015: I've updated the source code with more and better comments.
Update 22-10-2015: Added a camera object that follows the player.


I've created this project in order to study the implementation of various collision detection methods in a tile-base platform game.

Disclaimer:
  • Remember, this is just a prototype and therefore provided "as is".
  • The code presented in this example is neither elegant or optimized.
  • My code uses ImageViews, which is neither flexible or optimal.
    As of October 2015, I highly recommend that any game created in B4J be based on Erel's GameView lib.

@ilan, you might want to have a look at this. :)
 

Attachments

  • mario.jar
    373.2 KB · Views: 504
  • mario.zip
    69.9 KB · Views: 557
Last edited:

wonder

Expert
Licensed User
Longtime User
Level editor:

In the spirit of Nintendo's Mario Maker, you may also edit and create your own levels.
Just fire-up notepad and edit the file "level_1_1.txt" in the Files directory. :D


File content:

B4X:
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000001111111111111111111111111100000000000000000000000
0000000000000000000000000000000000000000100000000000020000000000
0000002000000000000000000000000000000000100000000000220000000000
0000000000000000000000000000000000000000100000000002220000000000
0000000000000000000000000000000000000000100000000022220000000000
0000220000000000000000000000000000000000100000002222220000000000
0000000000000000000000000000000000000000111111111111110000000000
0000000002220000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000001100101000100000000000000000000000000000000
0000000000000000000001010101000100000000000000000000000000000000
0000222220000000000001100111000100000000000000000000000000000000
0000000000000000000001010001010100000001111111111111111000000000
0000000000000000000001100001011100000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000022222200000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000222222200000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000222323232322200000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000001010000000001111111111111111111100000000000000000000000
0000000011011000000001300000000000000000000000000000000000000000
0000000111011100000001000000001000000000000000000000000000000000
1111111111111111111111111111111111111111111111110001111111111111
1111111111111111111111111111111111111111111111110001111111111111
0: Empty space
1: Ground block
2: Brick block
3: Question Mark block
 
Last edited:

Douglas Farias

Expert
Licensed User
Longtime User
Mt bom, vou tentar quando tiver tempo fazer um rpg em cima desse seu exemplo.
o .jar esta rodando perfeitamente, porém o exemplo quando tento compilar da este erro.

javac 1.8.0_60
shell\src\b4j\example\geometryutils.java:11: error: package anywheresoftware.b4a.pc.B4XTypes does not exist
import anywheresoftware.b4a.pc.B4XTypes.B4XClass;
^
1 error
 

wonder

Expert
Licensed User
Longtime User
Thanks!! :)

I tried the jar file, it runs without any problems.
However, when I try to compile it, I get the following error:
--------------------------------------------------------------------
javac 1.8.0_60
shell\src\b4j\example\geometryutils.java:11: error: package anywheresoftware.b4a.pc.B4XTypes does not exist
import anywheresoftware.b4a.pc.B4XTypes.B4XClass;
^
1 error
--------------------------------------------------------------------
Are you using B4J latest version? Is your Java version updated as well?
@Erel, any comment on this?
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
any comment on this?
I need translation first...

Based on the error it seems like you are using an old jCore library with B4J v3.7. Uninstall B4J. Delete all the libraries from the internal libraries folder and install it again.
If it still doesn't work then please start a new thread for this in the questions forum.
 

wonder

Expert
Licensed User
Longtime User
I need translation first...

Based on the error it seems like you are using an old jCore library with B4J v3.7. Uninstall B4J. Delete all the libraries from the internal libraries folder and install it again.
If it still doesn't work then please start a new thread for this in the questions forum.
I added the translation to my post above.
 

Douglas Farias

Expert
Licensed User
Longtime User
Based on the error it seems like you are using an old jCore library with B4J v3.7. Uninstall B4J. Delete all the libraries from the internal libraries folder and install it again.
If it still doesn't work then please start a new thread for this in the questions forum.
now works ty
 

ilan

Expert
Licensed User
Longtime User
the camera object is really cool i will deffently use this technic on my next game.

have you published any games on google play? i have not seen any game of you except of the great Project Ryu
 

wonder

Expert
Licensed User
Longtime User
Thank you! I really like to see my techniques put to good use.

I published "HyperBloX" a LibGDX/MySQL pong-clone, but it never reached more than 10 active users. :(
Ever since, I lost my motivation to publish anything. I will only publish again when I have something HUGE ready, like the Bulldozer Engine (Project Ryu).
Until it's done, I'll just focus my energy on studying game design and becoming a better programmer. :)
 
Top