Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
CBUMP + TILED = I AM HAPPY TO SHARE :-) — Gideros Forum

CBUMP + TILED = I AM HAPPY TO SHARE :-)

MoKaLuxMoKaLux Member
edited November 2019 in Code snippets
I am building some platformers using gideros.
I modified the tiledmap class written by some nice guy to take care of collisions!
1- you draw your map in tiled
2- you use the modified version of tiledmap
3- and voilà, you have your player colliding with the tiles!

I am super happy to share what I have got. Please tell me if you see anything wrong in the modified version of tiledmap.

I am planning to do another platformer tutorial using TILED this time and adding the modified class to the wiki somewhere.


PS: I have used my program to draw the tileset B) https://mokalux.itch.io/onetiletotileset

Likes: rrraptor, antix

my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
+1 -1 (+2 / -0 )Share on Facebook

Comments

  • rrraptorrrraptor Member
    Accepted Answer
    Just wondering, why you use "bit" lib?
    Check this out :)
    bit.band(
    	gid, 
    	bit.bnot(
    		bit.bor(
    			FLIPPED_HORIZONTALLY_FLAG, 
    			FLIPPED_VERTICALLY_FLAG, 
    			FLIPPED_DIAGONALLY_FLAG
    		)
    	)
    )

    VS

    gid = gid & ~(
    	FLIPPED_HORIZONTALLY_FLAG | 
    	FLIPPED_VERTICALLY_FLAG |
    	FLIPPED_DIAGONALLY_FLAG 
    )
    +1 -1 (+2 / -0 )Share on Facebook
  • @rrraptor I have no idea :p I just updated what was already existing.
    I will try your suggestion and modify my code, thank you for your help!
    PS: I added it to the wiki:
    https://wiki.giderosmobile.com/index.php/CBump

    Likes: SinisterSoft

    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited November 2019
    @rrraptor I have a question please, do you know how to "optimise" this piece of code as well:
    flipHor = bit.band(gid, FLIPPED_HORIZONTALLY_FLAG)
    flipVer = bit.band(gid, FLIPPED_VERTICALLY_FLAG)
    flipDia = bit.band(gid, FLIPPED_DIAGONALLY_FLAG)
    Thank you for your help.

    I found it, thank you!
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • antixantix Member
    Accepted Answer
    Cool stuff @MoKaLux :)

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.