i need help with this type of movement
When you press up, down, left, right, i cant find a way to transport it perfectly to that block
Use the position behavior and you can either use the grid movement, or pixel movement. Each grid in the editor is 32 by 32 pixels so if you want to move by pixels, just add 32 or -32 (Depending on direction) into the position behavior’s +X or +Y input to add coordinates onto the players current coordinates.
yeah
uhh but that will go through walls
not if i put a block that kills the user it it gets out lol
Or you could just raycast in the direction the player is trying to move, and simply not move the player if the raycast hits a wall.
What .-.
Idk how to use raycast XD
A raycast is basically drawing a line in a direction (the angle), and it will output whether it hits something. So in that context, the player would shoot a raycast in the direction where its trying to move (e.x. You press D to move right, and the raycast would shoot at 90°, which is right). So, the raycast would be looking to hit a wall (you can select what the raycast looks for inside the block), and if the raycast hits the wall, it would output from the hit output. So then if the hit output was outputted, it wouldn’t activate the movement code.
Thanks for this, it will be helpful
Glad I could help! Raycast is useful for lots of other stuff as well.
Flowlab Game Creator - Grid Movement Example
Here’s an example by the one and only grazer for a grid-based movement. This might explain a bit better on what you’re trying to achieve. Plus, it has wall collisions.