嗨,这里新人加一。
有没有人跟着官网教程走过?
我之前完全没有编程基础,现在刚入手godot,跟着官网教程走,输入官网代码之后,player根本不动我想知道是哪里出了问题,代码附在下面,请大家指点迷津,谢谢。
extends Area2D
export var speed = 400 # How fast the player will move (pixels/sec).
var screen_size # Size of the game window.
func _ready():
screen_size = get_viewport_rect().size
func _process(delta):
var velocity = Vector2.ZERO # The player's movement vector.
if Input.is_action_pressed("move_right"):
velocity.x += 1
if Input.is_action_pressed("move_left"):
velocity.x -= 1
if Input.is_action_pressed("move_down"):
velocity.y += 1
if Input.is_action_pressed("move_up"):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * speed
$AnimatedSprite.play()
else:
$AnimatedSprite.stop()
# pass
初衷和宗旨:共同努力,推动Godot游戏引擎在国内的普及和发展.
1.本站所有内容皆为用户发布,如有涉嫌侵权请联系hareqj#163.com,告知内容右上角所在编号以及侵权证据.
2.禁止发布色情/暴恐/时政/商广/带网址或二维码水印/涉嫌隐私或未经授权的私人图片.
3.举报和投稿:hareqj#163.com