Dusk Engine

Thanks for the input - I just committed the fix for that :slight_smile:

There are two copies so that you can have the easiest access:

[lua]

map.layer[1] – Will always point to the first layer

map.layer[“name”] – Or you can do it from the name

[/lua]

As for the tiles in the tables twice… Can you please expand a bit? That doesn’t sound so good :frowning:

[EDIT] I think I’ve got what you mean, actually - you mean the object layer’s objects? They’re the same:

[lua]

layer.object[1] – For for i = 1, #layer.object iteration

layer.object[“name”] – For easier object access

[/lua]

  • C

Yep, that was exactly what I meant. I was a bit confused when iterating through the objects and they seemed to be there twice.

Thanks for the quick answer.

For the reference, using layer.objects() should always go through the objects but once; you can use it for iterating:

[lua]

for object in map.layer[1].objects() do

  – Whatever

end

[/lua]

  • C

I created an object layer in Tiled. Named it platform, and assigned the following properties:

bodyType = static

collisionType = platform

physics:bodyType = static

physics:enabled = true

I was expecting this to make all objects on the layer physics static bodies. For line objects I couldn’t see them. For boxes the objects were dynamic. 

Setting properties on each object worked. Though,

physics:bodyType = static

did not set the body type, while:

body=static 

Did set the body type to static. 

Is it possible to set the properties for all objects on a layer in one place? Seems like this worked in the pervious version?

bodyType is a special value; it’s not added (not even in “normal” circumstances) from within the physics table. So when you want to set the bodyType, you have to just add it to the object, not the physics table (which means bodyType isn’t prefixed by physics:).

As for properties for the objects, use the objects: prefix:

[lua]

objects:bodyType = static

[/lua]

For tile layers, note that this prefix is tiles: instead.

  • Caleb

great! i hope i can start playing with dusk engine soon, just have a lot on my plate at the moment… but seems great and good job!

Working with Tiled, I created some platforms from lines. I had a problem where the “player” object jumps visibly above a platform but it still passes through. If the player object gets high enough above the platform it will land on it. Trying to sort the problem out I was looking at the bounds of the platforms. The platforms were drawn as single lines with two points in Tiled. When I examine the bounds in Corona these lines appear to have a height of 12pixels! 

If I draw a platform as a box, with a height of 0, the bounds work out correctly. Though in Tiled it’s impossible to get to the properties of an object with 0 height. 

This picture shows Tiled in the background. The red lines are platforms. In the Corona simulator in the foreground you can see magenta rectangles. I drew these using the contentBounds of each of the line platforms. 

Screen-Shot-2013-12-19-at-4.39.07-PM.png

Not sure what I’m doing wrong here. I have an objects layer in Tiled. If I set properties on the Layer all the objects the properties. If I set the same properties on objects individually they don’t seem to get the properties. For example, I set the layer properties as:

objects:collisionType = platform <-- works fine

Setting the same property on an object has no effect. Setting the property as: collisionType = platform, doesn’t work either.

What am I missing here? 

The platforms were drawn as single lines with two points in Tiled. When I examine the bounds in Corona these lines appear to have a height of 12pixels! 

This could be because of the display part of the line; Dusk gives line objects strokeWidth so that you can see them for debugging.

To see your line objects, use this:

[lua]

dusk.setPreference(“virtualObjectsVisible”, true)

[/lua]

Everything is working for me, so I’m not sure what’s happening. If this issue turns out to be a real problem, can you file an issue with a test case included at the GitHub page?

Same with the property thing; setting it on the object works for me.

  • Caleb

My work around was to use rectangles for platforms. In Tiled, if you set these to 0 height you can’t select them, which is frustrating. Be sure to set the height! This was a problem I was having with the Platformer, in the previous Ceramic demos. Many of the platforms were unelectable, which I realize now was due to the 0 height. 

So it’s still not working for you? If not, please (please, please, please!) file an issue with a test case included.

  • C

Is there some sort of maximum allowed tile size for Dusk?

I’m trying to add a map, and the console tells me that it can’t find a certain tile.

I’m 100% sure that the path is correct, and the image(tile) is .png format.

What’s your terminal output (starting with “Dusk Error:”)?

  • C

Looks like this:

Tileset image <“Documents/coding projects/sidescroller/tiles/ground01.png”> not found.

State: Tileset #1 - “ground01”

Traceback: [Base]:[Build Map]:[Load Tilesets]

And that’s the correct directory and name of your tileset image?

  • C

I just did a quick test to print the size of a line element in the terminal. It showed a height of 12 pixels with the virtualObjectsVisible true or false. I’ll make a test example and file an issue later today. 

“Documents/coding projects/sidescroller/tiles/ground01.png”

I checked multiple times.

The image is definitely there.

If there is no maximum tile size, then I must have made a mistake somewhere. I’ll try out some things…

The iphone has a limit on the max image size. 1024 for iphone, and 2048 for retina devices. 

Well…my tiles are 80x80.

I just wanted to have sharp graphics for my game.

Might think of scaling them down all.

The limit is a maximum file dimension (width and height). Check the the dimension on your file, if it’s larger you can break your tiles into two sheets. 

If you’re testing in the simulator this is probably not a problem. I don’t think the simulator recognizes this limit.