Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | PE4 |
Hello, i wanted to convert my project 3.5.2 to 4.0.2 but many things changed and i resolve many problem but there are some problems that i can’t solve like this one:
I had a script for procedural generation (the script at the bottom), the problem is for convert the function update_bitmask_region() its not work (Invalid Call. Nonexistent function ‘update_bitmask_region’ in base ‘TileMap’.
I have already tried replacing this function many times but it never worked.
(the script is from the tutorial from HeartBeast)
Script:
extends Node2D
const Player = preload(“res://Entity/Character/Player.tscn”)
var borders = Rect2(1, 1, 4048, 4048)
@onready var tileMap = $TileMap
func _ready():
randomize()
generate_level()
func generate_level():
var walker = Walker.new(Vector2(19, 11), borders)
var map = walker.walk(200)
var player = Player.instantiate()
add_child(player)
player.position = map.front()*32
walker.queue_free()
for location in map:
tileMap.set_cell(0, location, -1)
tileMap.update_bitmask_region(borders.position, borders.end)
func reload_level():
get_tree().reload_current_scene()
func _input(event):
if event.is_action_pressed(“ui_accept”):
reload_level()