Dusk Engine

Please open a new topic for this :slight_smile:

  • Caleb

Thank you, I opened another topic for the question @Caleb

do we have any updates for isometric mapping? i tried isometric map from tile editor to corona using dusk and it looks like a chess board :frowning:

Unfortunately, no, Dusk does not currently support isometric maps. Once I roll out version 1.0 (yes, it’s technically not even out of beta!), with documentation, bug-free-ness (or as close as I can get to that), and other basic foundation stuff like that, I’ll think about adding isometric maps. If you happen to be an isometric wizard, feel free to try adding isometric maps and submit a pull request.

  • Caleb

Hello @Caleb, based on the first answer you gave to @Aatos I am implementig this part of code where if the child object has been removed and the player goes offscreen, when he comes back, this child object must not be displayed. You said we have to set the properties of the host object, but how do I reference the host object? I can set and change properties of the child object using the object.“something”…, but I don’t know how to do it for the host object. 

Could you help me?

Thank you in advance!!!

@carlos.rafael

For the host object you set custom properties in Tiled and in code in the objectType.build or objectType. remove function you use event.object.“something” to get the property you added in Tiled.

Hello @Painconfess, thank you for the quick reply.

I have already set the property in Tiled but the remove function receives the child object as a parameter and not an event, so when I try to set for example event.object.name, I receive an error “attempt to index event a nill value”

In the build function, as it receives an event as parameter I can print the custom property, but not in the remove function. Do you know what should I do?

Oh I am sorry I have never needed the host objects properties in remove function I just assumed it works there also :smiley: Make a local variable outside the objectType.build and .remove function and set in build function the value for variable you desire. That should definitely work :stuck_out_tongue:

EDIT: The better way to do this might be set in build function object.name = event.object.name. 

Thank you for your help @Painconfess, I am trying to implement and make it work, soon I will post here what I was able to do.

well, i’m not sure if these were asked before or I have a different thought…

  1. is it possible to snap the objects to the respective tiles like most of the simulation games? like you will build a house and you will drag the house to your prospective area, also can we detect if this tile is already occupied?

  2. zooming in and out. can we stretch the tile map for zooming in and out? also stretched for other devices resolution?

tnx

Hey Caleb,
It’s been a while since I’ve been on the forum. Does Dusk support orthongonal maps from tiled?

Just want to say a big thank you to Caleb! Finally released our game that uses the Dusk engine. The game has been in development for over a year and showcases what Dusk can do. Hurtle the Turtle

@joshuacalebbryan:

I’m assuming “orthogonal” is a typo and you mean “isometric,” correct? If so, unfortunately no. Dusk only supports orthogonal maps.

@sakid.farid:

Congratulations! Looking good!

  • Caleb

I’m playing around with Dusk right now and encountered a strange error:

I’m using physics and when the screen is touched applyForce to an object to move it on the x axis. The camera is moving with the object when it is moved. When applyForce is used and the object is moved the following error is stopping the movement after about 1 second:

Attempt to compare nil with number

File: Dusk/dusk_core/misc/functions.lua
Line: 49

stack traceback:
    Dusk/dusk_core/misc/functions.lua:49: in function ‘clamp’
    Dusk/dusk_core/run/camera.lua:212: in function ‘processCameraViewpoint’
    Dusk/dusk_core/run/update.lua:112: in function <Dusk/dusk_core/run/update.lua:111>
    ?: in function <?:205>

Any idea what I have to look at to fix this?

Somehow it seems like the map.setCameraFocus is causing the problem. When turned off everything works fine BUT when turned on it looks like the error appears exactly where the object normally would leave the screen (when the cam movement is turned off). Can it be a object culling problem?

Hello Caleb! I’m new in Corona SDK and I need to do a little 2D game for a class in my school, so I found Dusk and created my map with Tiled, so I exported it in .json and in .lua, my tiles are in the corona project folder, I could make it and put my map into corona but the thing is it shows enormous in emulator, how I can create a map to the size for the phone? Or what I need to do to fit in the phone? My map looks like this and shows up like this:

HkO4bAT.png

I still can’t figure out the problem (see last post). It looks like a culling problem with the object. The camera is holding the object in the center of the screen, but the error appears when the map (background) is moved the distance from the centered object to the screen borders. It seems like the object is “culled” even when the camera is following the object and keep it centered. Could this be it?

Do you have an idea what this could be Caleb?

Thx in advance for any hint!

Hello @Luiz.pablo.lopez. I guess you could scale down your map after you’ve created it. So, after the code that creates the map you code this:

map:scale(0.5, 0.5)--scales down the map map.updateView()--update the view of the map

You have to call the updateView function, so the map can scale after it has been created.

If you want it to get bigger, use values bigger than 1, else then you use lower values than 1, for example: 0.5.

Hope it is what you are looking for.

I’ll add to @carlos.rafael’s answer with this: If you want to fit the map into the screen, just use some basic algebra:

-- Calculate the scale the map needs to be to fit into the screen local mapScaleX, mapScaleY = display.contentWidth / map.data.width, display.contentHeight / map.data.height -- ...and scale the map map:scale(mapScaleX, mapScaleY)
  • Caleb

Please note for future reference: I am going to completely stop answering questions on this topic. If you need help, please create a new topic in the “Gymbyl Coding” subforum.

  • Caleb

Caleb, would you like me to lock this thread?

Rob