0 votes

I'm guessing this is a new update problem. I am getting this error and it will not let me run the game. I've seen people saying how to ignore it and the error code says I can ignore it with underscore but even when I do it will not run.
the error is in the func buildlevel( )
the error is with add
room(free_regions)

const TILE_SIZE = 32

const LEVEL_SIZES = [
Vector2(30,30),
Vector2(35,35),
Vector2(40,40),
Vector2(45,45),
Vector2(50,50),
]

class_name Game

const LEVELROOMCOUNTS = [5, 7, 9, 12, 15]
const MINROOMDIMENSION = 5
const MAXROOMDIMENSION = 8

enum Tile {Brick, Door, Ground, Ladder, Stone}

var levelnum = 0
var map = []
var rooms = []
var level
size

onready var tile_map = $TileMap
onready var player = $Player

var player_tile
var score = 0

func ready():
OS.set
windowsize(Vector2(1280, 720))
randomize()
build
level()

func build_level():

    rooms.clear()
    map.clear()
    tile_map.clear()

    level_size = LEVEL_SIZES[level_num]
    for x in range(level_size.x):
        map.append([])
        for y in range(level_size.y):
            map[x].append(Tile.Stone)
            tile_map.set_cell(x, y, Tile.Stone)

    var free_regions = [Rect2(Vector2(2, 2), level_size - Vector2(4, 4))]
    var num_rooms = LEVEL_ROOM_COUNTS[level_num]
    for i in range(num_rooms):
        add_room(free_regions)


        if free_regions.empty():
            break
in Engine by (21 points)
edited by

Please post the relevant code, and format it via the { } button in the forum editor.

You can't ignore it if the argument doesn't have a default value to fallback on. The docs for the method will either say (type name) or (type name=default value)

for example the AnimationPlayer seek method is seek ( float seconds, bool update=false ), seconds needs a value but update can be ignored.

I've uploaded the code now. any help would be much appreciated.

Can you please edit your post and format the code as I mentioned in an earlier response above? It makes it so much easier to read...

And, you're getting a specific error. What line of code is that error associated with? Godot should tell you that, so rather than us guessing, it'd be good if you just tell us...

*** EDIT ***
Ah, I see you mentioned in the OP that the error was with the add_room(free_regions) call, so that's really what I was looking for here...

Can you post the code for the add_room() function also?

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.