Dusk Engine

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!

Ok, I’ve found out that it is possible to get coordiantes of tiles on your map.

By using  map.tilesToPixels

@lvl9hero: thanks for asking, the answer was useful for me as well  :)

Basically, when you add map properties to your map in Tiled, it looks like this:

name/ value

playerLocation/ !json! {“x” : 5, “y” :11}

Those X and Y values are units in Tiled AKA tiles. 5 means 5 tiles from left and 11 means 11 tiles from top.

Corona doesn’t know what tiles are, so you have to convert those values to pixels.

Luckily, Dusk does that for you, by using map.tilesToPixels.

For example- If your tiles have a size of 80x 80, 1 tile is converted to 80x 80 pixels.

This is how I’ve solved the problem with my character getting stuck between vertical tiles.

I removed the physic bodies from my current wall tiles, as well as disabled physics for them (so that they don’t fall down).

Then I’ve displayed objects to serve as walls (yes, thank you for recommending it to me).

And then, you just insert that object into one of the map layers, so that it doesn’t follow around when your character moves.

Correct me if I’m wrong, but I think I understand this now.

@Azmar:
Yes, that does seem to be a bug :frowning:

If it surfaces again, you can try filing a bug report on GitHub and I’ll see what I can do. I’d like to ask, though: Have you seen it on any other maps (i.e. create a new blank map, add a tileset, make objects, and run it and the problem appears)?

@tilen.curin:
That’s right :slight_smile:

One thing off-topic that I’d mention is that because the properties “playerLocation” and “finishLocation” are prefixed with !json! , Dusk knows to send the rest of the property to the JSON reader. Thus, it creates a table according to the JSON notation that follows.

You could just as easily do this, because of the way Dusk (by default; it can be disabled if you need dots to be read literally) treats the dot character:
[lua]
playerLocation.x = 5
playerLocation.y = 11
[/lua]

(another thing off-topic I’d like to mention is that I’ve written a notation parser for a future version of Dusk that takes notation in the exact form as a Lua table: {abc = 123, [“something else”] = 64.388} so as to remove the gap between properties and Lua code. I’ve also completed a fully-featured math solver with a complete implementation of the Shunting-Yard algorithm and variables; imagine this for a property: someWeirdValue = sin(map.width) * 64 + (map.height / cos(layer.alpha)))

  • C

I’m currently trying to get rid of another wierd problem.

When my character lands on the edge of the platform (if one part of the character object isn’t touching the tiles), he will bounce back up a little.

If I print the character’s y value, I can see that he moves up a little when he lands.

It’s wierd, because I’ve set bounce to 0 on the character and the tiles.

This is problematic when it comes to sprite animations- when the character already lands, it still plays the falling animation.

I don’t know what could be causing this to happen.

The function that check if the character moves up/ down is fine. There is nothing wrong with the functions for playing animations.

The character actually moves up a bit after he collides with the ground tiles. If it’s not the bounce- what could it be?

@Caleb P:

Yeah I’ve recreated multiple brand new maps and reloaded everything from scratch and the problem still would occur exactly when I create an object layer. I would just create an object layer save and export and the flickers on the screen would go nuts, but if I delete the object layers or make the object layer at the very bottom the flickers 100% go away. If I move it up +1 layer they come back… I don’t mind filing a report to help get this solved, I will try to make the file as minimal as possible.

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.