I've been making a simple grid-based movement just for a little project and for some reason no matter how I use maptoworld or worldtomap it keeps giving me this error whenever I give any input. Here is my code:
##All extensions and imports that the script needs:
onready var map = get_node("TileMap")
##All Exported Variables
export var TileSize = 16 ##This is the size of the tileset.
export var MoveAllowance = .25 ## this is the time that the player must wait before the next move is taken.
##All Internal Variables:
var timeDelay = 0
var mapGoal = Vector2(0,0)
var pos = Vector2(0,0) ##This will be where the player is.
var goalPos = Vector2(0,0) ## This is where the player wants to be.
##This will happen Only at the beginning of the game.
self.position = Vector2(8,0) ## this is an alignment thing. for some reason if it isn't started with (+8,+0) it doesn't line up.
##This will happen at every tick of the game.
pos = self.position
if timeDelay == 0:
if goalPos.x != 0 || goalPos.y != 0:
self.position = map.map_to_world(goalPos)
goalPos.x = 0
goalPos.y = 0
timeDelay = 1 ##this can be edited to determine how long the player must wait before moving.
timeDelay = 0
timeDelay += -MoveAllowance*delta
##getInput Simply loads the next input into the _process function for processing.
if goalPos.x == 0:
goalPos.x += 1
goalPos.x += -1
if goalPos.y == 0:
goalPos.y += -1
Sorry about how messy it is, I just recently got back into coding. Any help would be appreciated