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…
Please file an issue on GitHub for this, thanks
FPS means “number of times the game updates in a second”, obviously. So a 60FPS game gives the code ~16 milliseconds to run all its stuff each frame. If the code takes longer than that, the frame has to be delayed and you get a lag. Simple enough.
A 30FPS game, on the other hand, gives a game ~33 milliseconds (twice as much) to do it’s frame stuff. So there’s a lot more leeway for lag. Something has to take twice as long to make the game lag. Of course, this improvement comes at the cost of not as smooth animation and movement and such.
So, when you make a game at 60FPS, sometimes you need to optimize things to keep it running smoothly. If your lag is more than just a “click” every now and then, it’s probably not Dusk, but your game code. What’s your lag like?
- Caleb
im familiar with fps, sorry if i didnt make that clear. most likely issue with optimizations with my code, thanks for your explanation. i was just wondering why dusk could not be set to 30fps instead of 60fps in the settings i see now dusk requries the higher frame rate…
thanks again
Good idea; I’ll add that when I can.
- C
I see the github page says “open source” but what’s the license for Dusk?
Jay
I haven’t thought of this before, but I guess it’d be MIT.
I’ll add it to the GitHub repository.
- C
Awesome, thanks!
Jay
Caleb is it possible to do curved tiles?
What do you mean by “curved”? The physics shape?
- C
curved as in many edges to the tile to give a curved appearance.
i figured it out just gotta set the physics shape in the tiled properties…
physics:shape = !json! [35,34,-35,35,35,-34]
cheers caleb
I too was facing the same problem initially and solved it with adding a physics:shape property in Tiled. This process was extremely time consuming. Any idea if it is possible to do this graphically?
You can try adding two physics shapes to the tile; one with a radius, and one shape filling the rest of the tile:
(assuming 32x32 tiles)
[lua]
physics:radius : 16
physics2:shape : !json! [16,-16, 16,16, -16,16, -16,0, 0,-16]
[/lua]
Basically what that does is uses Dusk’s multiple-body-parameter feature to create two physics sections of the tiles, just like you can do with normal Corona physics:
[lua]
physics.addBody(tile, “static”,
{radius = 16, bounce = bounce, friction = friction},
{shape = {16,-16, 16,16, -16,16, -16,0, 0,-16}, bounce = bounce, friction = friction}
)
[/lua]
One is a 16-radius circle, to form the curve part, and one is a sort of diamond shape that blocks off the other three corners of the curve.
- C
Hi Caleb,
The tileset I am using has a purple background, so when I imported it into Tiled, I chose it as the transparent color and proceeded to make my map.
I loaded the map into my project and it worked, except that the background color was still showing.
I noticed in the .json file there is a part that says the value of the transparent color, but is there already a way in the engine to make this color transparent?
Thankyou in advance.
Unfortunately, Corona doesn’t allow us to do that. You’ll have to use an image editor like Pixelmator to edit out the purple color. Many bitmap editors come with a “Select Color” function, which should do exactly the same as what Tiled does.
- Caleb
Ok I will do this, thankyou for the quick reply!
Hi, I have a problem, Im doing Coins in my game, and I create Coins in Tiled Map Editor, with physics, and when have collision with some coin, this coin is removed.
The problem is when I have more coins, with same name “coins” to the objects, not found.
I have this code:
[lua]
local coin = map.layer[“LayerCoins”].object[“coin”];
moneda.myName = “Coin”
local function onCollision( event )
if ( event.phase == “began” ) then
if ( event.object2 == coin or event.object1 == coin ) then
print( “Bost” )
bost = bost + 1
textBost.text = bost
coin:removeSelf()
end
end
end
Runtime:addEventListener( “collision”, onCollision )
[/lua]
Some idea for select all objects of one layer, or what can i do it?
regards, thx!
this is what i do and it works…
iterate through each object. for each object named “coins” add addEventListener( “collision”,coinCollision())
for object in map.layer[“objects”].objects() do
if object.name == “coins” then
addeventlistenere here
end
end
Im trying but not found, I do:
[lua]
function coinCollision( event )
if ( event.phase == “began” ) then
print( “Bost” )
bost = bost + 1
textBost.text = bost
coin:removeSelf()
end
end
for object in map.layer[“LayerCoins”].objects() do
if object.name == “coin” then
Runtime:addEventListener( “collision”, coinCollision() )
end
end
[/lua]
But not found, i do too the function coinCollision() in the FOR, but nothing…
thx!
are you adding it on the object?
object:addEventListener(“collision”,coinCollision)
do not include the “()” in the eventlistener.
if you have specified that the object names within “objects” layer are named coin it will find them.
right click on the object name in tiled, select properties, under the name column type name under value type coin