Architectural problems

Please tell me. How to organize the display of a character on the screen if it can consist of several different sprites? head, body, legs.

For example, the head is sprite 1, the legs are sprite 2, etc. I have all the data on what parts the character consists of. It is also important that there can be several characters.

All the examples that I have seen are static, that is, the character is pre-created. But I need to collect dynamically. After loading scene proxy.



I would use one game object per body part, and have one sprite per object. The individual body parts can either be animated individually, or using a root game object, or by attaching physics joints between each part. You can use sprite.play_flipbook() to change which image to use for a body part, and if needed also change the atlas using go.set("#sprite", “image”, atlas_resource).

1 Like

I use property animation, and how i show this game object on scene?

go.set_position(url, position)

go.show ?

I’m just learning the defold. I was planning to use a GUI, but decided to use a perspective camera for 2.5d.

You can create a file robot.collection and have a root game object on that then you add other game objects for robot’s parts as its components. After that you create a file robot.script and attach to the root game object. In the script file you can define properties which helps you customize your robot

Gui work fine. Fully code control

why i cant create sprite how box_node?

i need to build robot programmatically

GUI is ok if you don’t need 3d. Actually I’m also making a game just by GUI nodes. However it’s quite basic and less libraries for filters, drawing, animations…

Yes, but i use perspective camera for 2,5D

What do you mean by programatically? Doesn’t GO allow you to do that? You might already known that you can create a new GO with factory.create(), and by that you can create a module to control your all robots, kind of that

i have array what kind of

{usrs = 
  {id = 1, robot = {leg = 1, body = 2, head = 3}},
  {id = 2, robot = {leg = 2, body = 3, head = 1}},
  {id = 3, robot = {leg = 1, body = 1, head = 2}},
  {id = 4, robot = {leg = 4, body = 4, head = 4}}
 }

and i need create robots

That’s what I am saying. On your main script you can loop your table and use collectionfactory.create() or factory.create() to create your new robots

Thanks, im try this ))