Godot Engine
I need HELP!
Basically, Im doing the Tutorial for the Godot Engine, But im stuck.
Here is my Situation: "Parser Error: Identifier not found: position"
My Script:
extends Area2D
export (int) var SPEED
var screensize
func _ready():
screensize = get_viewport_rect().size
func _process(delta):
var velocity = Vector2() # the player's movement vector
if Input.is_action_pressed("ui_right"):
velocity.x += 1
if Input.is_action_pressed("ui_left"):
velocity.x -= 1
if Input.is_action_pressed("ui_down"):
velocity.y += 1
if Input.is_action_pressed("ui_up"):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * SPEED
get_node("AnimatedSprite").play()
else:
get_node("AnimatedSprite").stop()
position += velocity * delta
position.x = clamp(position.x, 0, screensize.x)
position.y = clamp(position.y, 0, screensize.y)
The Godot Script:
extends Area2D

export (int) var SPEED
var screensize
func _ready():
screensize = get_viewport_rect().size
func _process(delta):
var velocity = Vector2() # the player's movement vector
if Input.is_action_pressed("ui_right"):
velocity.x += 1
if Input.is_action_pressed("ui_left"):
velocity.x -= 1
if Input.is_action_pressed("ui_down"):
velocity.y += 1
if Input.is_action_pressed("ui_up"):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * SPEED
$AnimatedSprite.play()
else:
$AnimatedSprite.stop()
position += velocity * delta
position.x = clamp(position.x, 0, screensize.x)
position.y = clamp(position.y, 0, screensize.y)
The game im trying to do is called Dodge the Creeps in the tutorial. I really need help.
< >
1-5 / 5 のコメントを表示
What version Godot? Make sure your version of tutorial is meant for the version of Godot that you are running.
Valdar の投稿を引用:
What version Godot? Make sure your version of tutorial is meant for the version of Godot that you are running.
The version I'm using is 2.1?
It looks like you're following the tutorial for Godot 3, so you need to be using that version of Godot.

If you're just starting with Godot, use the latest stable version. I don't think there's any reason to use 2.1 for new projects these days.
Okay, Thank you! Ill appreciate!
But what if, I cant run version three? Is there any way i can buy pass it?
flesk 2018年4月6日 23時31分 
If you can't use Godot 3.0, you'll need to follow the 2.1 docs instead:

http://docs.godotengine.org/en/2.1/learning/step_by_step/index.html
< >
1-5 / 5 のコメントを表示
ページ毎: 1530 50

投稿日: 2018年4月5日 19時04分
投稿数: 5