You can also set the type of the objects in Tiled (where it has name and type), then use the Dusk iterator .typeIs():
[lua]
for object in map.layer[“LayerCoins”].typeIs(“coin”) do
– Whatever
end
[/lua]
- Caleb
You can also set the type of the objects in Tiled (where it has name and type), then use the Dusk iterator .typeIs():
[lua]
for object in map.layer[“LayerCoins”].typeIs(“coin”) do
– Whatever
end
[/lua]
Hi again, I can solve this problem, in the tiled map editor, i need write properties " name : coin" for each object or not found…
I have a other problem, can I center the camera, and when the player move, map move with him?
I do it:
[lua]
function reloadMap()
map:setReferencePoint(display.CenterReferencePoint)
map.setCameraFocus(circle)
end
Runtime:addEventListener(“enterFrame”, reloadMap)
[/lua]
And well, found the moves, but not good, I see the player more up, and map more down, the map move if I move the player, but I have collisions out of tiles walls(image).
Sorry for all questions, and for bad english, maybe someone know a guide of this dusk engine?
Thx, regards!
The object properties window in Tiled with ‘Name’ and ‘Type’ correspond to the object properties ‘_name’ and ‘_type’. I would recommend using the ‘Type’ field to identify your objects as coins, then using the Dusk built-in typeIs(“coin”) iterator.
map.setCameraFocus should work fine, just remember you’ll need to call map.updateView() each frame to keep it updated.
As for a guide, sorry, there isn’t an up-to-date one right now :(.
caleb are we able to zoom with the camera in dusk?
Thx caleb, you can see my problem here:
Without map.setCameraFocus() I have good the tiles and physics, but with this function all map(images) are moved.
The player is the red rect.
Some idea?
Thx!
@tommowas: Yes, just set the map’s xScale/yScale
@jcarlosnunezperez: Can you turn on physics hybrid draw mode and show what it looks like?
[lua]
physics.setDrawMode(“hybrid”)
[/lua]
See, so rare…
EDIT: I have now the code of map.setCameraFocus() in the function scene:createScene( event ), now the physics are good, the player walk on the ground (green rect) but no on the ground tiles (images).
SEE:
One question more, can I have position of enemys in a tile selected, maybe
pos = map.layer[].tile[x][y]
enemy.x = pos.x
enemy.y = pos.y
???
Or too if I have a enemy , do one for each object?
I try :
for object in map.layer[“layer”].objects() do
enemy = display.newRect(100, 100, 50, 80)
enemy.x = object.x
enemy.y = object.y
end
But not found, I have 4 objects but only one enemy is created.
And the last question, can I move the camera with the player, only in the y-axis?
Thx
Getting the pixel position of a tile is done like so:
[lua]
local pixelX, pixelY = map.tilesToPixels(x, y)
[/lua]
The two arguments are the X- and Y- locations of the tile.
You can also get an actual tile object like so:
[lua]
local tile = map.layer[“layer”].tile(x, y)
[/lua]
And yes, you can move the camera in a single axis by setting the bounds to 0 in that axis:
[lua]
map.setCameraBounds({
xMin = 0,
xMax = 0,
yMin = whatever,
yMax = whatever
})
[/lua]
As for your physics issue, can you open a GitHub issue for that?
Caleb, are we able to bring the fps to 30 with dusk? tried it runs very laggy…
How big are your tiles? How many are on-screen at any given time?
Don’t forget to include device info…
tiles are 70x70 running a lg g2, lag is also present in the simulator. this is with your bob demo with tile culling enabled etc… exact jittery frame-rate present in my games aswell… smooth at 60fps though
I think what you’re seeing is 30 FPS. After seeing 60 FPS for a while, changing to 30 FPS can make it look jittery. Since Dusk is running at 60 FPS (requires more speed), it should run fine at 30 FPS, too.
hmm… whats defined in the config.lua is 60fps. so im seeing 30fps when defined at 60fps?
exact jittery frame-rate present in my games aswell… smooth at 60fps though
According to your post, it sounded like the game is smooth at 60 FPS but jittery at 30 FPS. Is that not what you meant?
yeh thats what i meant. were you saying when defining 60fps in the config im really seeing 30fps due to the amount of resources dusk chews?
If, when config.lua says 60 FPS, it’s smooth, but when config.lua says 30 FPS, it’s jittery, then you’re just seeing the difference between 30 and 60 FPS. If, however, when config.lua says 60 FPS, it’s jittery, but when config.lua says 30 FPS, it’s smooth, then Dusk is running slowly. What situation do you have?
Hello people ,
i am trying to make a game and was thinking how to make levels and thght about using Dusk engine but right now em in a lil mess my tiles dont load up on corona simulator properly for some reasons ( dunno why )
here is what i see
running bob for example at 60fps in the config runs smooth but running it with 30fps runs juttery. the reason im asking is because i have designed another game with parallax backgrounds and i have to run it at 60fps, the game lags heavily sometimes for a short period of time and am told its the high fps settings…