Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Dusk Engine
Started by Caleb P Dec 13 2013 12:22 PM

490 replies to this topic
dusk engine tilemap game engine opensource
[TOPIC CONTROLS]
« Page 20 of 20 18 19 20
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#476

Painconfess

[GLOBAL: userInfoPane.html]
Painconfess
  • Enthusiast

  • 49 posts
  • Corona SDK

@carlos.rafael

 

For the host object you set custom properties in Tiled and in code in the objectType.build or objectType. remove function you use event.object."something" to get the property you added in Tiled.



[TOPIC: post.html]
#477

carlos.rafael

[GLOBAL: userInfoPane.html]
carlos.rafael
  • Observer

  • 28 posts
  • Corona SDK

@carlos.rafael

 

For the host object you set custom properties in Tiled and in code in the objectType.build or objectType. remove function you use event.object."something" to get the property you added in Tiled.

Hello @Painconfess, thank you for the quick reply.

I have already set the property in Tiled but the remove function receives the child object as a parameter and not an event, so when I try to set for example event.object.name, I receive an error "attempt to index event a nill value"

 

 

In the build function, as it receives an event as parameter I can print the custom property, but not in the remove function. Do you know what should I do?



[TOPIC: post.html]
#478

Painconfess

[GLOBAL: userInfoPane.html]
Painconfess
  • Enthusiast

  • 49 posts
  • Corona SDK

Oh I am sorry I have never needed the host objects properties in remove function I just assumed it works there also :D Make a local variable outside the objectType.build and .remove function and set in build function the value for variable you desire. That should definitely work :P

 

EDIT: The better way to do this might be set in build function object.name = event.object.name. 



[TOPIC: post.html]
#479

carlos.rafael

[GLOBAL: userInfoPane.html]
carlos.rafael
  • Observer

  • 28 posts
  • Corona SDK

Thank you for your help @Painconfess, I am trying to implement and make it work, soon I will post here what I was able to do.



[TOPIC: post.html]
#480

PLAYCUBE

[GLOBAL: userInfoPane.html]
PLAYCUBE
  • Enthusiast

  • 43 posts
  • Corona SDK

well, i'm not sure if these were asked before or I have a different thought..

 

1. is it possible to snap the objects to the respective tiles like most of the simulation games? like you will build a house and you will drag the house to your prospective area, also can we detect if this tile is already occupied?

 

2. zooming in and out. can we stretch the tile map for zooming in and out? also stretched for other devices resolution?

 

tnx



[TOPIC: post.html]
#481

joshuacalebbryan

[GLOBAL: userInfoPane.html]
joshuacalebbryan
  • Observer

  • 25 posts
  • Corona SDK

Hey Caleb,
It's been a while since I've been on the forum. Does Dusk support orthongonal maps from tiled?

[TOPIC: post.html]
#482

sakib.farid

[GLOBAL: userInfoPane.html]
sakib.farid
  • Observer

  • 27 posts
  • Corona SDK

Just want to say a big thank you to Caleb!

Finally released our game that uses the Dusk engine. The game has been in development for over a year and showcases what Dusk can do.

Hurtle the Turtle


[TOPIC: post.html]
#483

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Corona Geek

  • 1,424 posts
  • Corona SDK

@joshuacalebbryan:

I'm assuming "orthogonal" is a typo and you mean "isometric," correct? If so, unfortunately no. Dusk only supports orthogonal maps.

 

@sakid.farid:

Congratulations! Looking good!

 

- Caleb



[TOPIC: post.html]
#484

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 725 posts
  • Corona SDK

I'm playing around with Dusk right now and encountered a strange error:

 

I'm using physics and when the screen is touched applyForce to an object to move it on the x axis. The camera is moving with the object when it is moved. When applyForce is used and the object is moved the following error is stopping the movement after about 1 second:

 

Attempt to compare nil with number

 

File: Dusk/dusk_core/misc/functions.lua
Line: 49

 

stack traceback:
    Dusk/dusk_core/misc/functions.lua:49: in function 'clamp'
    Dusk/dusk_core/run/camera.lua:212: in function 'processCameraViewpoint'
    Dusk/dusk_core/run/update.lua:112: in function <Dusk/dusk_core/run/update.lua:111>
    ?: in function <?:205>

 

Any idea what I have to look at to fix this?

 

Somehow it seems like the map.setCameraFocus is causing the problem. When turned off everything works fine BUT when turned on it looks like the error appears exactly where the object normally would leave the screen (when the cam movement is turned off). Can it be a object culling problem?



[TOPIC: post.html]
#485

luis.pablo.lopez.lopez

[GLOBAL: userInfoPane.html]
luis.pablo.lopez.lopez
  • Observer

  • 1 posts
  • Corona SDK

Hello Caleb! I'm new in Corona SDK and I need to do a little 2D game for a class in my school, so I found Dusk and created my map with Tiled, so I exported it in .json and in .lua, my tiles are in the corona project folder, I could make it and put my map into corona but the thing is it shows enormous in emulator, how I can create a map to the size for the phone? Or what I need to do to fit in the phone? My map looks like this and shows up like this:

 

HkO4bAT.png



[TOPIC: post.html]
#486

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 725 posts
  • Corona SDK

I still can't figure out the problem (see last post). It looks like a culling problem with the object. The camera is holding the object in the center of the screen, but the error appears when the map (background) is moved the distance from the centered object to the screen borders. It seems like the object is "culled" even when the camera is following the object and keep it centered. Could this be it?

 

Do you have an idea what this could be Caleb?

 

Thx in advance for any hint!



[TOPIC: post.html]
#487

carlos.rafael

[GLOBAL: userInfoPane.html]
carlos.rafael
  • Observer

  • 28 posts
  • Corona SDK

Hello Caleb! I'm new in Corona SDK and I need to do a little 2D game for a class in my school, so I found Dusk and created my map with Tiled, so I exported it in .json and in .lua, my tiles are in the corona project folder, I could make it and put my map into corona but the thing is it shows enormous in emulator, how I can create a map to the size for the phone? Or what I need to do to fit in the phone? My map looks like this and shows up like this:

 

HkO4bAT.png

Hello @Luiz.pablo.lopez. I guess you could scale down your map after you've created it. So, after the code that creates the map you code this:

map:scale(0.5, 0.5)--scales down the map
map.updateView()--update the view of the map

You have to call the updateView function, so the map can scale after it has been created.

If you want it to get bigger, use values bigger than 1, else then you use lower values than 1, for example: 0.5.

 

Hope it is what you are looking for.

 



[TOPIC: post.html]
#488

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Corona Geek

  • 1,424 posts
  • Corona SDK

I'll add to @carlos.rafael's answer with this: If you want to fit the map into the screen, just use some basic algebra:

-- Calculate the scale the map needs to be to fit into the screen
local mapScaleX, mapScaleY = display.contentWidth / map.data.width, display.contentHeight / map.data.height

-- ...and scale the map
map:scale(mapScaleX, mapScaleY)

- Caleb



[TOPIC: post.html]
#489

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Corona Geek

  • 1,424 posts
  • Corona SDK

Please note for future reference: I am going to completely stop answering questions on this topic. If you need help, please create a new topic in the "Gymbyl Coding" subforum.

 

- Caleb



[TOPIC: post.html]
#490

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,860 posts
  • Corona Staff

Caleb, would you like me to lock this thread?

 

Rob



[TOPIC: post.html]
#491

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Corona Geek

  • 1,424 posts
  • Corona SDK

That would be great, thanks.

 

- Caleb




[topic_controls]
« Page 20 of 20 18 19 20
 
[/topic_controls]