cellv argument 1 not recognized, godot v.3.2.1

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mabelair88

onready var positionNow = get_used_cells()
set_cellv(positionNow, 5)

getting error with cellv argument 1 not recognized,
godot v.3.2.1

You should include exactly your error message, because otherwise we have to guess at what’s happening. Also, where is this code? Are you trying to run set_cellv() outside of a function? These two lines would have to be in different places. Show your script.

Finally, get_used_cells() returns an Array, and set_cellv() takes a Vector2. This also won’t work.

kidscancode | 2020-09-05 23:40

Here is my script:
extends TileMap

onready var positionNow = get_used_cells() #[0]
onready var body = get_node(“body”)
onready var anime = get_node(“body/anime”)

export var reference_tile = 5
export var base_speed = 100.0
export var move_size = 64
export var debug = false

var moving = false
var locked = false
var move_dir = null
var delta_ = 0

var direction = {
“up”: Vector2(0, -1),
“down”: Vector2(0, 1),
“left”: Vector2(-1, 0),
“right”: Vector2(1, 0)
}

signal move_request(dir, map_pos)
signal move_update(layer, new_pos, last_pos)

func _ready():
set_cellv(positionNow, reference_tile)
body.move(map_to_world(positionNow) + Vector2(move_size/2, move_size/2))
body.set_hidden(false)
set_physics_process(true)

###########
I try: set_cellv(Vector2(positionNow), reference_tile)
not working.
How can i send a Vector2 value to set_cellv
thank you.

mabelair88 | 2020-09-08 11:38

Please format your code with the “Code Sample” button when posting. It is very hard to read this way.

Again, get_used_cells() returns an array - a list of coordinates where you have placed tiles in the TileMap. It’s a list of Vector2s. set_cellv() should be given one Vector2 of a single tile to change.

What exactly are you trying to do? Describe your goal.

kidscancode | 2020-09-08 20:22

My gold is creating a Sokoban style game for my kids. I want to know want is on my tiles, walls, boxes, and obstacles and the final destination of the boxes. I want to create a 2D variables that will contain all the information of the particular level. Later on, I want to give the opportunity to the player, to construct their own level, and save it to a file.

mabelair88 | 2020-09-09 18:52