Godot Engine

2019-04-28  本文已影响0人  散人_800d

首先创建一个名为 Node 2d 命名为Stage ONE

创建一个名为 KinemeaticBody 2D 命名为Player的节点

添加脚本Sprite 赋予人物材质,导入选择pixel 2d 重新导入使其画面不模糊

在Player节点也就是( KinemeaticBody 2D)里面写脚本文件

将Player节点保存,并且添加到SteageOne场景中区 run 游戏 


xtends KinematicBody2D

var velocity = Vector2()

func _physics_process(delta):

if Input.is_action_pressed("ui_right"):

velocity.x = 100

elif Input.is_action_pressed("ui_left"):

velocity.x =-200

else:

velocity.x=0

if Input.is_action_pressed("ui_up"):

velocity.y = -100

elif Input.is_action_pressed("ui_down"):

velocity.y=100

else:

velocity.y=0

move_and_slide(velocity)


上一篇 下一篇

猜你喜欢

热点阅读