Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Disable physics in a layer [Dusk]
Started by Anthony Keffel Dec 27 2015 03:49 PM

4 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Anthony Keffel

[GLOBAL: userInfoPane.html]
Anthony Keffel
  • Enthusiast

  • 30 posts
  • Corona SDK

Hi there,

after working hour for hour to convert my old game to Dusk Engine  I'm on a good way :-)

The problem: I made a map in Tiled, I'm using two layers with the same tiles (working, no problem), but ...

 

I added some physics to the tiles, and now the physics is on every layer - but I want to disable it on Layer two ("BG"). One time it works, but after moving the tiles every layer get's his physics back. Any Idea?

 

Thank you for every idea...

 

Anthony

 



[TOPIC: post.html]
#2

Caleb P

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

  • 1,424 posts
  • Corona SDK

Dusk handles physics in a hierarchy - if a tile says it has physics, it takes precedence over a layer's physics designations. You could try setting isBodyActive on all tiles in your layer:

tiles:isBodyActive     :     false

- Caleb



[TOPIC: post.html]
#3

Anthony Keffel

[GLOBAL: userInfoPane.html]
Anthony Keffel
  • Enthusiast

  • 30 posts
  • Corona SDK

HI Caleb - thank you!

Yes, it works - but only one time - after culling (?) it's active again. I added the physics in Tiled - maybe this is the problem? If I would add the physics part later in Corona I could choose the layers - but... This would be the same problem - after culling everything will be gone. Ahhhhhh! The best solution for me would be disable permanently the physics in a layer.

 

Anthony



[TOPIC: post.html]
#4

Caleb P

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

  • 1,424 posts
  • Corona SDK

I mean set the physics on your tiles, then, on the layer physics needs to be disabled on, add the property "tiles:isBodyActive" and set it to false. The tile bodies will still be made, but because of the Corona property isBodyActive they won't collide with anything else.

 

- Caleb



[TOPIC: post.html]
#5

Anthony Keffel

[GLOBAL: userInfoPane.html]
Anthony Keffel
  • Enthusiast

  • 30 posts
  • Corona SDK

Ok - thank you - I'll give it a try!

-Anthony




[topic_controls]
[/topic_controls]