1. Black Friday Sale - 50% off

    B4A Standard for $29 instead of $59!
    Buy Now
    Dismiss Notice

B4A Library libGDX - Game Engine

Discussion in 'Additional libraries, classes and official updates' started by Informatix, Sep 12, 2013.

  1. sterlingy

    sterlingy Active Member Licensed User

    Informatix, I believe it is working now. I forgot to turn off debug mode on the last compile

    Thank you SOOOOOOOOOO much.

  2. sterlingy

    sterlingy Active Member Licensed User

    Informatix. Here's something to chew on:

    As the camera moves up the map, eventually the map end, and the Pacdroid moves into blackness (no background map.) Maps are always located with the lower left corner at (0,0). What I'd like to do is place another map and the end of the first one, and repeat this over and over, kind of like and endless runner type game.

    Do you have any thoughts on how to achieve this?


  3. Informatix

    Informatix Expert Licensed User

    I don't know what's the best solution in this case. Usually, the platform games with a side scrolling have various landscapes so there's no need for repeated tiles. And the never-ending-scrolling techniques are for textures, not tiles. If you find something that works fine, let us know.
  4. sterlingy

    sterlingy Active Member Licensed User

    I did find this: https://github.com/MobiDevelop/libg...adlogic/gdx/tests/examples/RunnerExample.java

    I was in the process of porting it to B4A, but I ran into some hurdles, as usual. For instance, it extends other classes, including one called "GdxTest" which I have know idea about.

    Then there's this stuff, which I could find any reference to in your port of libGDX:
    import com.badlogic.gdx.maps.tiled.TiledMapTile;
    import com.badlogic.gdx.maps.tiled.TiledMapTileLayer;
    import com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell;
    import com.badlogic.gdx.maps.tiled.TiledMapTileSet;
    import com.badlogic.gdx.maps.tiled.TiledMapTileSets;
    The coder of the above link wrote this to me on the libGDX forum:

    Maybe your brilliant brain can figure it out.


  5. Informatix

    Informatix Expert Licensed User

    That looks good.

    GdxTest is an abstract class with no code, so you don't need it.

    com.badlogic.gdx.maps.tiled.TiledMapTile -> it's an interface, not a class (example of class using this interface: lgMapStaticTiledMapTile)
    com.badlogic.gdx.maps.tiled.TiledMapTileLayer -> lgMapTiledMapLayer
    com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell -> lgMapTiledMapLayerCell
    com.badlogic.gdx.maps.tiled.TiledMapTileSet -> lgMapTiledMapSet
    com.badlogic.gdx.maps.tiled.TiledMapTileSets -> lgMapTiledMapSets

    :) My skull contains more mud than brain actually.
    sterlingy likes this.
  6. sterlingy

    sterlingy Active Member Licensed User

    Informatix, I've been trying to port the RunnerExample.java. Mostly it's not to difficult, but a few things I'm having trouble with:

    I can't find OrthoCamController I assumed it would have been lgOrthoCamController

    TextureRegion[][] splitTiles = TextureRegion.split(tiles, 32, 32)
    I don't know what to do following the "=" as TextureRegion is not a variable

    The closest I could get is : map1.TileSets.getTileSet. (and then there is no option for addTileSet)

    Not sure what super is, but it's probably not a libGDX thing

    Am I assuming correctly that this translate to map.Layers.GetAllLayers?

    I hope to have this working over the weekend. I'll share it with everyone, as it might be of some use. You could probably do this in 30 minutes, but even though I struggle, it helps me learn.


  7. Informatix

    Informatix Expert Licensed User

    If I remember correctly, it's some code to move the camera in the test apps. It's not a part of the lib and you can do the same thing with B4A (e.g. with the gesture detector).

    Look at my Animation demo and my Map_Hexagonal demo. I show two ways to get arrays from a split.

    lgMapTiledMapSets (note the final s)

    Yes, forget. It calls the constructor of the ancestor of the class (you don't need to bother with that in general with B4A).

    No, to map.Layers. When a library is wrapped, usually the get and set are removed and the two functions become a single property in B4A.


    Sunday, I take the plane to La Réunion island for the Christmas holidays so I won't be able to help before 2014.
    sterlingy likes this.
  8. sterlingy

    sterlingy Active Member Licensed User

    Thanks Informatix. Everything above is a great help. If we don't connect before, have a wonderful Christmas and New Years


  9. Informatix

    Informatix Expert Licensed User

    Thank you. Happy holidays to you too. And to everyone on this forum.
  10. Beja

    Beja Expert Licensed User

    Thanks Informatix for the great lib and examples..

    I go this error message in ALL of the examples:
  11. sterlingy

    sterlingy Active Member Licensed User


    I finished porting the runnerExample.Java code. I can't run it yet because there are a few things I still can't find:

    For starters, this is suppose to be an extension BatchSpriteMapRenderer, So I think I've not set up my globals and initialized properly

    Again, I hope you have or have had a great vacation. I'm in sunny California now, but will be in sub-zero temps in New England for the holidays.


    P.S. I don't know why the code didn't retain it's indent formatting
    Last edited: Dec 14, 2013
  12. Informatix

    Informatix Expert Licensed User

    In the Basic4Android IDE, go to “Tools/Configure Paths”. Be sure the android.jar is set to version 11 or higher (this setting is important to compile successfully but has no influence on the Android version required by your application, which is set in the manifest by minSdkVersion, so you can select the latest Jar present in your Android SDK folder).

    "hardwareAccelerated" is not in all examples. Only a few. It is useless. You can remove the line in the manifest.
  13. Informatix

    Informatix Expert Licensed User

    Now that I looked closely to the code of the example, I realize that it is not easy to port to B4A (you have to extend another class, which is impossible, and not extending it complicates a lot your work). I planned for the beginning of 2014 to update my code to the version 0.9.9 of libGDX. I will provide you a solution to endlessly scroll a map at this moment. I hope you can wait a few weeks.
    sterlingy and ellpopeb4a like this.
  14. sterlingy

    sterlingy Active Member Licensed User


    You rock. Yes, I can wait. I can work on other aspects of the mechanics, and if I run out of things to do, or just become stumped, I'll work on graphic design, plus I'll be spending a lot of time with my family anyway.

    If you are wondering about functionality, It would be good to be able to load multiple maps so that one can move from one onto another, like moving from the city to the country, to the desert, then back to the city, and so forth, as opposed to one map that just repeats itself, of course, that could be an option as well.

    Also, despite hours working on this, all was not in vain. I learned a lot, especially with your help.

    Have a blast, and rest up while you are away, if it is possible to both!

  15. Beja

    Beja Expert Licensed User

    That was a big mistake of mine, and was against my responsible of being accurate. Neutrality is
    very difficult to maintain. After trying 2 examples, then I took other two randomly and it happened
    they were both with "hardwareAccelerated, so I wrongly concluded it is all of the examples.

    Thank you very much for the note and the help.
  16. Beja

    Beja Expert Licensed User


    Sorry but I utterly failed to add views to the activity by creating a .bal file in designer. no errors but the
    app ran normally with no button shown on the screen.. Can these examples run inside a panel?
    Thanks in advance
  17. alhowiriny

    alhowiriny Member Licensed User

    I've being away from this forum for months.. its good to see high quality library like this one. Thank you Informatix.
    Informatix likes this.
  18. Informatix

    Informatix Expert Licensed User

    What you're trying to do is not really clear to me. You can place a libGDX view inside a panel, of course, but you cannot add this view in your designer. It has been done programmatically.
  19. sterlingy

    sterlingy Active Member Licensed User


    I hope you had a great vacation!

    You'd be stunned by the progress I've made with your lib. Of course, I still struggle, but I think I'm days away from an alpha release of my app. Right now, I am stumbling over one issue.

    I used the application Tiled to create a map and some polyline objects. I want to read the polylines and use their vertices to create a BOX2D edge, but I can't figure out how to access this information from the tiled map object. I can see the object layer, but not sure how to get its vertices.


  20. Informatix

    Informatix Expert Licensed User

    Yes, I left La Reunion a few days before a cyclone strikes it. I just had news from my family on the island and they are out of danger now.

    Great news! I'm working too with libGDX currently.

    To be honest, I didn't test at all the lgMapPolylineMapObject class so I'm afraid that I'm of no help. I suppose that you get a polyline with one of the functions of this class and you can get its vertices with the getVertices function of the lgMathPolyline class.

    I wish you (and everybody) a happy new year !
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice