Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / 2d tile map loading and collision detection tutorial

Author
Message
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 16th May 2016 05:37
Hi all,

Im still learning AppGameKit both 2d and 3d..but im more clueless in 2d.

Is there any simple sample program on loading tilemap, setting up collision for the tiles and check collision with player?
Im thinking on using Tilemap editor but im clueless on how to implement in AGK
Thanks
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 16th May 2016 11:25
Yes, the Tiled editor can help you:
https://forum.thegamecreators.com/thread/201373

search on google:
AGK Tiled site:forum.thegamecreators.com

There are quite some threads for tiled. There you can find any information you need

[/url]
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 16th May 2016 12:01
Hi..Thanks Bro...

I learning the foundation on clueless on how things happen.

Let say i skip using custom tile map format but create the .png map(10X10,320pixels) as attached here.How to code to get specific tiles that will collide with the player.

Thanks

Attachments

Login to view attachments
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 18th May 2016 15:22 Edited at: 18th May 2016 15:27
Hi...after exploding my brain i manage to do some loading to collision sprite based on CSV data from Tiled Editor coded as below
Im creating 5X5 32 pixel tilemap,and the creating second layer for collision but im using only the CSV data to draw tiles with collision values.(in the CSV 0 is collided,-1 is passable)



But im having THREE questions.

1.Although the collision tile drawn correctly as in tiled editor CSV, but collision wont happen.Can someone check and help my code?
2. Here i use colid to assign value to dummy (colbox type) to keep track on how many dummy have i created.
Any better way to keep track of this dummy?Notice that i set dim dummy as 99 in case i dont know how may collision tile have i made in the map, any better way todo this?
3.Are these method on the right path since i never tried 2d.

Thanks

Login to post a reply

Server time is: 2024-11-21 20:17:49
Your offset time is: 2024-11-21 20:17:49