Flopsy/objects/characters/character.gd
2022-07-17 14:24:15 +02:00

19 lines
363 B
GDScript

extends KinematicBody2D
var motion = Vector2(0, 0)
const UP = Vector2(0, -1)
const GRAVITY = 30
export var health : int = 100
func _process_gravity():
if not is_on_floor():
motion.y += GRAVITY
else:
motion.y = 1
if is_on_ceiling():
motion.y = GRAVITY
func _physics_process(delta):
if motion != null:
move_and_slide(motion, UP)
_process_gravity()