qaz233   ♀  喵她  
 

嗨,这里新人加一。

有没有人跟着官网教程走过?

我之前完全没有编程基础,现在刚入手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


   
[投稿须知]
投稿邮箱:hareqj@163.com
教程投稿:可提供B站视频BV号,会直接生成视频播放页。
游戏投稿:须原创,请提供 作品web版文件、作者、简要操控说明。
内容举报邮箱:hareqj@163.com,请告知内容编号(右上角)及违规说明。
Copyright Godot社区 Godot2D.com All Rights Reserved.
京ICP备13032831号