I’m working on a 2D platformer with a gimmick, you can turn the level 90 degrees, instantly. so the level turns but the player stays in the same location on the screen.
The problem I’m having is is i can get the tile map to turn without getting an “Invalid get index ‘rotation_degrees’ (on base: ‘TileMap’)” and i also can figure out how to rotate the tilemap on its center.
your wordings probably not right, hence it’s confusing to read
this should be:
The problem I’m having is i can’t get the tile map to turn without getting an “Invalid get index ‘rotation_degrees’ (on base: ‘TileMap’)” and i also can’t figure out how to rotate the tilemap on its center.
show how you rotate the TileMap from Code?
Oh dang it
Your absolutely right
I can’t believe I messed up like that on my first post
I’m on my phone rn but I can get the code soon
(Indent) if Input.is_action_pressed(“turn_left”):
(Indent) (Indent) TileMap.rotation_degrees += 90
yeah it’s not right.
click drag and drop the tilemap node to the script here so you get the correct nodepath to reference it
or simply if tilemap is the one having this script, just
indent rotation_degrees += 90
ok, it works
but how do I make it rotate around its center and not the corner?
that will need to set it from parent Node2D of this TileMap
set the Node2D’s position to be exact center as parent of this TileMap, Or move the tilemap to be the center of this Node2D node
then rotate this Node2D node instead of the TileMap
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.