|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
tumzithesavage |
So i assigned a variable,
var movedir = Vector2(0,0)
then when i did this
movedir.x = -int(left) + int(right)
movedir.y = -int(up down) + int()
i get this error:
Unexpected token: Identifier: movedir
(by the way i had assigned left, right, up and down)
|
|
|
|
Reply From: |
kidscancode |
You probably tried to do this outside a function. Show the rest of your script.
extends KinematicBody2D
var movespeed = 300
var movedir = Vector2(0,0)
func controls_loop():
var left = Input.is_action_just_pressed("ui_left")
var right = Input.is_action_just_pressed("ui_right")
var up = Input.is_action_just_pressed("ui_up")
var down = Input.is_action_just_pressed("ui_down")
movedir.x = -int(left) + int(right)
movedir.y = -int(up) + int(down)
i didnt continue because of this error
tumzithesavage | 2019-06-07 15:54
Those last two lines must be indented so that they’re part of the controls_loop()
function.
kidscancode | 2019-06-07 15:57
thanks, by the way, do you have a youtube sries for godot, because i watched your for python.
tumzithesavage | 2019-06-07 16:02
Yes, there are many Godot videos on my channel.
kidscancode | 2019-06-07 16:03
ok thanks, i will be sure to watch
tumzithesavage | 2019-06-07 16:04