Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+10 votes

Right now my game is 2D and the character walks in a straight line, how do I create a scene where she can walk over the entire map not just based on Collison layers?

asked in CSC380Jan2024 by (1 point)
+2

Is your game in a top down view? If so it’s a good idea to set the CharacterBody2D’s motion mode to floating.

4 Answers

+3 votes

what do you mean by walk over the entire map? I dont understand your question

answered by (1 point)
+3

In Martian Mike you walk left or right, my game is currently like that but I also want some scenes where my character is able to walk up and down

+2 votes

You can add collision to certain tiles on a tile map. What you do is create a new tile map, create a new tile set in the inspector tab on the right, and click on the tile set you just created. There will be a drop down menu called "Physics Layers" and you'll want to select "Add Element" and add select what physics layers you want everything to be. Then add in the tile set asset you want to use and select the Paint tab next to Select and Setup. In the dropdown under "Paint Properties" select the Physics layer you just created and select the tiles you want to have collision. This should make it so that your player can walk over any tiles that don't have collision. Hopefully this is what you were asking and is helpful!

answered by (1 point)
+1 vote

Something that I remember being pretty necessary for most characters is the move_and_slide() function. Maybe you are missing that

answered by (1 point)
+1 vote

Has making its motion mode to floating and possibly disabling gravity work?

answered by (1 point)
...