Trying to understand tilemap collision detection

Get help using Construct 2

Post » Wed Jan 29, 2014 4:13 pm


Hi I'm playing around with tilemaps and how they detect collisions.

Check out the following setup;
https://www.dropbox.com/s/p0kc3ys5922hutw/TilemapCollisions.capx

Why aren't the tiles being erased properly please? It seems collisions on tiles are only at the top left of each tile but, I don't know how to offset this correctly.

Thanks,
Dave
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Wed Jan 29, 2014 5:50 pm

Right - I don't know much about tilemaps. (Or many things come to think about it...) In fact this is one of my first looks at tile maps so take this with a pinch of salt, ok ?

I think that when you are getting the sprites x and y then it is not quite over the tilemap - so when it hits the far left of the tilemap the sprites x is referencing -1 on the tilemap (if sprite hits the right then it is referencing tilemap "width" +1 (19 in this case). Same for the y positions.

How to fix this ? Not sure and too tired to think straight - Here is an (almost) solution but....



test
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Fri Jan 31, 2014 11:33 am

Thanks I appreciate the help, I have now solved it by using the following.

bullet Overlapping Tilemap
--- For "cycletiles" 0 to (amount of tile types)
---- Tile (Tilemap.PositionToTileX(bullet.x), Tilemap.PositionToTileY(bullet.y)) = loopindex("cycletiles")
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Fri Jan 31, 2014 1:15 pm

Please post the updated capx ?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Fri Jan 31, 2014 1:22 pm

No probs, here you go;
https://www.dropbox.com/s/xzml5v3b1lqwa42/updatedtilemapcollisions.capx
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Fri Jan 31, 2014 9:46 pm

Thanks for that.

I knew there had to be a better solution than the one I tried !

I've had another look and made a couple of alterations.

Slight edit
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Sun Feb 02, 2014 10:57 am

Far better way of doing it, thanks
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Sun Sep 20, 2015 2:01 am

@MiniHulk would you be able to repost your capx?
Check out my games on Google Play:
BEAST ATTACK (991,300+ downloads!)
ZOMBIE BASH (Android) (Launched Feb 17)
ZOMBIE BASH (iOS) (Launched March 17)
B
51
S
15
G
2
Posts: 428
Reputation: 5,191

Post » Mon Sep 21, 2015 3:48 pm

here is my edit if you want

https://goo.gl/lHsP2c
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Fri Feb 19, 2016 10:56 pm

@RamPackWobble This is great stuff, but it doesn't seem to work when the tilemap has a solid behavior. :(
Check out my games on Google Play:
BEAST ATTACK (991,300+ downloads!)
ZOMBIE BASH (Android) (Launched Feb 17)
ZOMBIE BASH (iOS) (Launched March 17)
B
51
S
15
G
2
Posts: 428
Reputation: 5,191

Next

Return to How do I....?

Who is online

Users browsing this forum: Syazanie Amirin and 12 guests