Looks like you're not logged in

Login or Register to continue

Lesson Q&A

Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.

  • Godot4 Room.gd RevyenSo this took me longer and I thought, since these things are valuable resources have it for prosperity. Also a bunch of errors(mostly that stuff didn't exist anymore) were never shown by godot so double check what you write in there when porting godot3 code to 4. Room.gd ```gdscript @tool class_name Room extends Area2D @export var size : Vector2 = Vector2.ONE : set(value): for axis in [Vector2.AXIS_X, Vector2.AXIS_Y]: size[axis] = max(1, value[axis]) _setup_extents() get: return size var _tilemap: TileMap = null @onready var collision_shape: CollisionShape2D = $CollisionShape2D func setup(tilemap: TileMap) -> void: _tilemap = tilemap _setup_extents() func _setup_extents() -> void: if _tilemap != null: collision_shape.shape.set_size(Vector2i(size) * _tilemap.tile_set.tile_size) ``` - tool, export and onready have an @ now in front of them. - the collision_shape.shape.extents are size now and you need to use the setter of the shape now. see line 23 - map_to_world has changed to map_to_local but it also (with help from GDQuest) changed the point it returns. - It returned top left before and now it is the center. Which is why you need to adjust accordingly and can't just swap the name. - setget is completely changed and caused also some headache basically SetterGetter needs to follow a certain style. I added the content of the set_size function into the setter. Mostly because there is somekind of possibility for an infinite loop if you don't understand exactly how it works, which basically crashed my godot. This way worked for me and since it is utility it should be fine like that. 1 0 Feb. 26, 2024
Site is in BETA!found a bug?