Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

How can i detect collisions between tiles and sprite?

(+1)

You have to do it the old fashioned way - comparing values. In the most basic of senses, comparing positions in relation to your character is basically what you'll be doing all the time. Tile based games are simpler, but with velocity added it becomes a bit harder.

how do i do that?

Find the coordinates of the sprites ie top right, top left, bottom right, bottom left corners. Then check whether any of those points overlap. Here's a tutorial on it that should be helpful. https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_Breakout_game_pure_J...