0 votes

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

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

in Engine by (31 points)

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.

Here is my script:
extends TileMap

onready var positionNow = getusedcells() #[0]
onready var body = getnode("body")
onready var anime = get
node("body/anime")

export var referencetile = 5
export var base
speed = 100.0
export var move_size = 64
export var debug = false

var moving = false
var locked = false
var movedir = null
var delta
= 0

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

signal moverequest(dir, mappos)
signal moveupdate(layer, newpos, last_pos)

func ready():
set
cellv(positionNow, referencetile)
body.move(map
toworld(positionNow) + Vector2(movesize/2, movesize/2))
body.set
hidden(false)
setphysicsprocess(true)

#

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

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.

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.

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 Frequently asked questions and 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 [email protected] with your username.