Dusk Engine

You should just be able to do something like

for object in map.layer["markers"].nameIs("startmarker") do character.x = object.x end  

Maybe Dusk is not compatible with composer…

I have something like

    local screenGroup = self.view     map = dusk.buildMap("levels/level"..selectedLevel..".json")     screenGroup:insert(map)  

and startmarkers / spawnpoints are working ok…

Wow thanks Sakib you’ve put me on the right track! Brilliant! I can see and reference objects now. Thanks very much!

 

Can I ask what the difference is between ‘dusk.buildMap’ and ‘dusk.buildMapFromLayers’ - the former lets me access layer info whilst the latter throws up an error…?

 

Also, I’m using:  map = dusk.buildMap(“level.lua”, {3,3})

 

I guess the {3,3} refers to the layers?

 

Many thanks

 

– oh and if I scale up the map, the positions of objects don’t appear to scale - they need to be scaled separately…is this what should be happening?

MapCutter is a plugin that allows you to build a map from specified layers of a map file. Normal dusk.buildMap() builds the entire thing, but when you load MapCutter (what you’re doing on the line right after you require() Dusk), it gives the engine dusk.buildMapFromLayers(). Then, you can load specific layers that are entries in the table: {3, 4} as the second argument means load only layers 3 and 4.

“cutting” the layer out means you’re not loading the layer you have in Tiled; you’re calling dusk.buildMapFromLayers() and not providing that layer’s index as an element in the layer indices table.

As a side note, you shouldn’t do {3,3} because that’s loading layer #3 twice.

  • C

Great, that’s really helpful. 

Am I correct in thinking then that I could use just dusk.buildMap() to build the entire map and not load MapCutter or use dusk.buildMapFromLayers() if I don’t need to?

Thanks for your help, I feel like I’m making progress here.

Yep, MapCutter would be for if you made one big map with 100 layers, each of which is a different level of your game, or something like that.

  • C

Ah right - got it! Brilliant. Thanks a lot, I really appreciate your advice.

No problem :slight_smile:

  • C

Hi all,

thanks for making dusk Engine, it works pretty well. I’m thinking of a way of moving my characther just from one tile to another(I was guessing to make he go from center of one tile to another center, but dunno really…) so I was wondering if someone had already did it and can help me out with some algorism or something to implement that. Searched in documentation so far and hadnt found anything.

Wishing hearing from you,

Cordar.

map.tilesToPixels() (or map.layer[x].tilesToPixels()) will give you the pixel X/Y of a certain tile.

  • C

I am looking to make a zelda-link to the past type game. Is the Dusk Engine able to make a game like this? I been working already a lot with the dusk engine and it has helped me learn a lot with Lua.

Would the million tile engine be better suited for a zelda-type game or Dusk engine?

Dusk is the ideal engine for that (already know Dyson said the same about MTE :D). I’d say it’s better than MTE for that specific role, because Dusk provides extremely easy APIs for tile position access, map insertion, and such as that (which would make RPG interface creation waaay easier). On any account, you may as well try :slight_smile:

  • C

Thank you for the quick response, I do very much enjoy Dusk and have put a lot of work around the Dusk engine. How do I go about to reference or source Dusk Engine/Tiled when I publish my app?

You don’t have to do it in any way. If you really want to, you can always just say “Made with the Dusk Engine” in your attributions page and let me know about it, but that’s purely optional.

  • C

Ok sounds good, the only thing that I was concerned about that I came across was the stuff that are off screen become unresponsive and react weird when I move my player around. Ex. I push a monster off screen and when it goes off screen it starts to react really weird (even disappear). I know I saw some posts above that helped solve the problem.

I’d assume that’s because tiles that are offscreen are deleted. If your monster is disappearing, that wouldn’t be a problem with Dusk - it doesn’t remove anything but tiles.

You can always file a bug report and see where that gets you :slight_smile:

  • C

If I built the entire game off the Dusk engine there won’t be any FPS
issues, especially with the older phones? Since I know Dusk is not built
around speed?

Dusk can usually run quite fast even with very large maps. It can have a delay in initially loading the map, but once you get the map onscreen, there shouldn’t be any issues with speed.

To test, you can try out the benchmarks (tests/test_benchmarks).

  • C

Sorry to jump back to the topic of map layers, but I am really struggling. Dusk seems to be the perfect tools for my project and I am
totally impressed by what it can do, it’s just tricky working out some of it.

I have created a map in Tiled with 2 layers and have used:

[lua] map = dusk.buildMapFromLayers(“name.json”,{2}))[/lua]

to build the map, but I either get both layers showing at once or only the first layer defined in the json file. I assumed I could something like:

[lua] map.layer[1]:insert(object)

map.layer[2]:insert(object)[/lua] but this throws up an error message…index field ? (a nil value).

I actually want to switch between layers and show layer 1 then layer 2 and then go back to layer 1.

How do I do it?

OK, I have worked out that I should have used: [lua]map = dusk.buildMapFromLayers(“name.json”,{1,2}))[/lua] initially and I can now control layers individually, except that I cannot see how to only make layer 1 ‘active’. I can fade out layer 2 but the physics remains in place.

I know I asked this a while back, but this flicker screen problem is still a pain and looks bad when deployed, and became a more serious problem. I am going straight from your updated Dusk github “Bob” example, the screen flickers in the example and I even added my own map using only the code from Bob like solid colour (ex green) and it looks even worse (I am trying to do flat colours in my game and this is why I’m coming back to this topic).

I’ve tried tinkering with a lot of stuff over the months to figure it out, but nothing really did fix it. Yes I have the exact code following the display.setDefault(“minTextureFilter”, “nearest”)display.setDefault(“magTextureFilter”, “nearest”) line that was given months ago and that is also in the Bob code.

How do I go about extruding, not sure what that means :S

On a side note what does:

dusk.detectMapPath = true

do?