Discord
Login
Community
DARK THEME

I need help making collisions

I don't know how to make my player collide with my map.please help.

you could add specific things to help it collide like

init = function() player.x=0 player.y=0 end update = function() if player.x>= 0-310 and player.x<= 310 then if keyboard.RIGHT then player.x+=1 end if keyboard.LEFT then player.x-=1 end else if player.x<= -310 then if keyboard.RIGHT then player.x+=1 end else if player.x>= 310 then if keyboard.LEFT then player.x-=1 end end end end end then just do that with the y you can also add other parameters using and so as long as it doesnt go to that position it can move any direction

I already have something like that to change the levels but I don't have a way to make him able to collide with the levels he just goes through them but thank you so much trying to help :)

i also don't want to have to code every X and Y coordinates for every indent and spike it terrain (it takes place on a rocky planet)

you most likely will have to do they x and y for each but mabye someone else has an idea and i might actually be able to make it easier

For tiles where the hitbox takes up the entire tile, you can use (self-promotion alert) something like my Tilemap Collision. You could also add code for collisions with partial tiles.

also you could invite me and i would add all the x's and y's for the collsions

https://microstudio.dev/i/microstudio/collisions/

https://microstudio.dev/i/gilles/platformerbasics/

https://microstudio.dev/i/gilles/quickengine/

https://microstudio.dev/i/KimsGames/collisionexample/

https://microstudio.dev/i/Loginus/mapcollision/

https://microstudio.dev/i/Loginus/collision/

https://microstudio.dev/i/PaulSt/collisiondetection/

thanks guys :)

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community