I am having trouble figuring out how to setup a collision box for a tilemap layer and i can’t find anything about it anywhere i have read the docs and i can’t find anything so if anyone knows how to set this up please let me know.
all i need is to add a collision to a tilemaplayer and i have no clue how and i cant figure it out with the docs i also suck at game dev so please explain like ur explaining to a 4 yr old lol
ok so i didnt work i just drew on top of it and its probably cuz my brain dont work so here are somescreenshots one is a test launch and one is the editor
default and i just realized that the way i am moving my character probably has something to do with this issue so i am currently using lerp whenever the right mouse button is pressed so maybe that is overriding the collision?
ok so i ran some tests and it is definitely because i am lerping the player to the mouse whenever the mouse is clicked i just tested with some rigid bodies and they are stopped by the fence so does anyone know how to workaround this
ok so two questions how would i set the velocity and whats the difference between move_and_slide() and move_and_collide()
and also could i put it in a proccess funtion instead of the physics proccess function or are they different
they are different, the physics-process method gets called every physics-frame and is therefore meant to be used for moving physics-objects to ensure correct physics-behaviour. the difference between move_and_slide and move_and_collide can be found in the docs: “They are mainly used to provide high-level API to move objects with wall and slope detection (move_and_slide() method) in addition to the general collision detection provided by PhysicsBody2D.move_and_collide().”
Every characterbody has the velocity-variable:
func _physics_process(delta):
velocity = 100 # set the velocity here
move_and_slide()
ok thank you my brain tried to do this and i thought you had to get the velocity and then set the velocity to that so now i have a buggy version but i will swap to this thank you and im sorry if i made you explain simple things to me as my brain doesn’t like to work most days