Berry - Tiled Loader for Corona SDK


(ldurniat) #1

Hi,

I just let know that I have finished my new project called Berry. It is a simple Tiled loader. May be it will be useful for someone :slight_smile: Berry is based on out of date project Lime. Along project itself I have created example (Sticker-Knight-Platformer game from Ponywolf) and wiki.

Link to github with my work.

List of features:

  • [x] Loads .JSON export from www.mapeditor.org
  • [x] Adds basic properties from Tiled including physics
  • [x] Supports object layers and tile layers
  • [x] Supports collections of images and tileset images
  • [x] Supports object x/y flipping and re-centering of anchorX/anchorY for Corona
  • [x] Supports object animations using Corona sequences
  • [x] Rectangle shape with fillColor and strokeColor support
  • [x] Supports custom collision shapes. Only rectangles and polygons for now
  • [x] Supports Text object

ldurniat


(Thorbjørn Lindeijer) #2

That looks great! Can you tell a bit about the advantages of Berry over ponytiled or Dusk Engine? Is this about features, performance and/or API? Why a new project rather than contributing to an existing one?


(ldurniat) #3

I have created Berry as learning project to improve my Lua and Corona SDK skills as programmer. It is similar to ponytiled and use OOP (Object-Oriented Programming) with 30log module.

Advantages of Berry over ponytiled or Dusk Engine:

  • Supports object animations using Corona sequences,
  • Supports custom collision shapes. Only rectangles and polygons for now,
  • Supports Text object.

I have contributed to ponytiled project but it was not enough for me so I have decided to create my own project.

I’m planning add more functionalities in future. See What’s next section on github page for more information.

ldurniat


(Shahjada Ahmed) #4

Hi Idurniat,

I am currently trying out your super awesome Tile loader for corona sdk. However I am unable to a torch animation in corona sdk from the Tiled map. The animation works fine in the Tiled map editor, but it does not show in the corona simulator. Could you please give me a step by step guide on how to do this? I just want to display animated tiles which I create using the Tiled map editor in corona, at the moment they are appearing all static. I have used isAnimated option in custom property.


(ldurniat) #5

Hi Shahjada_Ahmed,

Check out Adding Life Through Animation section on wiki page for Berry. It contain many useful informaction for you. Furthermore, check out Sticker Knight Platformer game. It include animated characters e.g. hero and enemy.

NOTE: Only objects can be animated.

If you like the project, please consider a donation:)

Thanks:)

ldurniat


(Shahjada Ahmed) #6

Hi Idurniat, Thanks a million for the quick response and the the informative links. I did not know only objects could be animated. I am currently using Berry to try out animation of objects. Thanks once again and keep up your good work. I plan to donate to your cause. :slight_smile:


(Thorbjørn Lindeijer) #7

Hmm, about time that we added Berry to the list here:

Will come online once it is merged to master (committed to 1.1 branch so that upon release it will be listed in the “stable” version of the manual).


(Shahjada Ahmed) #8

Hi,
Could you give me a little tutorial on how collision can be detected between object in corona sdk and wall made in Tiled map edtor using Berry? Thanks


(ldurniat) #9

Hi Ahmed,

Sure. First of all read

After that you should look on ldurniat/Sticker-Knight-Platformer game. It uses Berry. Main character in this game, hero uses collision detection to interact with world objects like enemies or coins.

Good luck Ahmed:)

ldurniat


(Shahjada Ahmed) #10

Hi Idurniat,
I have gone through the tutorials, but I am really struggling in the case of sprite object animation with accurate collsion. It seems the animated player stops many pixels away from a solid wall. :frowning:
I have implemented collision detection between object, I understand the concepts, they are fairly straight forward. What I am struggling is how to make collision accurate. Should I be using any third party tool such as SpriteHelper or PhysicsEditor for this? Feeling a bit frustrated…


(ldurniat) #11

Hi Ahmed,

If I understand you correctly collision detection is not accurate because of collision area of image don’t corespond to represention of image. If you use default collision shape (i.e. rectangle) that may happened. Using polygonal shape should solve your problem.
Berry supports polygonal shapes for objects or tiles. To add new shapes use Tile Collision Editor from Tiled.

To show collision shapes use setDrawMode method from physics module

berry.buildPhysical( map )
physics.setDrawMode( 'hybrid' )

You may find my last Tiled Collision Editor Plugin useful. It uses Tiled.:slight_smile:

Do you plan publish your game?:slight_smile:

Have a nice day Ahmed:)


(Shahjada Ahmed) #12

Hi Idurniat,

First of all thanks a lot taking time responding to me. Your feedback has always been very useful to me. I have tried using radius option too but not very accurate. I think the default rectangle is used in collision, you are right. Can you please let me know how to use the polygonal shape ? A tutorial link would be useful. Thanks.

I will now try the setDrawMode method as you suggested and will also try out the Tiled Collsion Editor plugin. But the thing is the rpg game character is using sprite animation from corona code, not as an object from the Tiled map editor.

I am a QA engineer in real life, but love game development, I am learning. I plan to build a small rpg engine and based on that plan to build a game and then publish. Lets see how far I can go!


(Shahjada Ahmed) #13

Just to let you know the problem I am facing :
Issue video


(ldurniat) #14

@Shahjada_Ahmed:

Can you please let me know how to use the polygonal shape ?

Check Polygonal Body Section from Corona doumentation.

But the thing is the rpg game character is using sprite animation from corona code, not as an object from the Tiled map editor.

TCE Plugin still can be useful for you. Just copy table with vertices produces by plugin to lua file from console. Next pass it as shape parameter. Since shape doesn’t change in time you need do this once.

How use TCE Plugin (short version):

  1. Create new Orthogonal and CSV map in Tiled,
  2. Add tileset or collection of images to it,
  3. Select ‘Edit Tileset’ button,
  4. Select Tile Collision Editor,
  5. Choose tile or image to add polygonal shape,
  6. Add polygonal shape in editor,
  7. Save map and export it to LUA format,
  8. Use instructions from documenation page to know how use it in Corona.

ldurniat


(Shahjada Ahmed) #15

Thanks for your valuable input. I will go through the links and learn as I code.