M2I 研究所 2022/05/18 08:27

Godotによるプログラミング成果

お久しぶりです Godotを使っての2Dゲームのスクリプト移動できるようになりました
ほめて?


extends KinematicBody2D

export (int) var speed = 200
export (int) var jump_speed = -500
export (int) var gravity = 700

var velocity = Vector2.ZERO

func get_input():

velocity.x = 0
if Input.is_action_pressed("ui_right"):
	velocity.x += speed
if Input.is_action_pressed("ui_left"):
	velocity.x -= speed

func _physics_process(delta):

get_input()
velocity.y += gravity * delta
velocity = move_and_slide(velocity, Vector2.UP)
if Input.is_action_just_pressed("ui_accept"):
	if is_on_floor():
		velocity.y = jump_speed
		

動かす命令をしただけです PCのGPUが貧弱だけどゲーム作りたい人 Godotおすすめデス・

この記事が良かったらチップを贈って支援しましょう!

チップを贈るにはユーザー登録が必要です。チップについてはこちら

記事のタグから探す

月別アーカイブ

限定特典から探す

記事を検索