Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Checking for object collision in a map
Started by fwcarlitos Apr 28 2018 05:56 AM

2 replies to this topic
tiled ponytiled physics

Best Answer davebollinger , 28 April 2018 - 06:20 AM

try queryRegion before placing

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

fwcarlitos

[GLOBAL: userInfoPane.html]
fwcarlitos
  • Enthusiast

  • 56 posts
  • Corona SDK

I am currently working on adding an "endless mode" to my game. There is an object on the map (loaded with ponytiled) that moves to a random position any time the player collides with it. However, sometimes the random position embeds it in a map object. How would I go about checking for this so I can move it to a different position?  I can't use the x and y of the objects by themselves because some of the objects are too long. 

 

Thanks in advance for your help!



[TOPIC: post.html]
#2

davebollinger

[GLOBAL: userInfoPane.html]
davebollinger
  • Corona Geek

  • 1,087 posts
  • Enterprise

  Best Answer

try queryRegion before placing



[TOPIC: post.html]
#3

fwcarlitos

[GLOBAL: userInfoPane.html]
fwcarlitos
  • Enthusiast

  • 56 posts
  • Corona SDK

I didn’t even know queryRegion existed! Thanks! That solved the problem.


[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: tiled, ponytiled, physics