This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node | |
export(int) var max_amount = 10 | |
var current_hp : int = 1 | |
onready var health_bar = $"../HealthBar" | |
func hp_changed(_value : int): | |
current_hp += _value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node | |
signal max_changed(new_max) | |
signal changed(new_amount) | |
export(int) var max_amount = 10 setget set_max | |
onready var current = max_amount setget set_current | |
var current_hp | |
func _ready(): | |
_initialize() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node | |
signal max_changed(new_max) | |
signal changed(new_amount) | |
export(int) var max_amount = 10 setget set_max | |
onready var current = max_amount setget set_current | |
func _ready(): | |
_initialize() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Actor | |
func _physics_process(delta: float) -> void: | |
if is_on_wall(): | |
$RayCast2D.position.x = $collisionShape2D.shape.get_extents().x * direction | |
direction = direction * -1.0 | |
var is_jump_interrupted: = Input.is_action_just_released("jump") and velocity.y < 0.0 | |
var direction = get_direction() | |
velocity = calculate_move_velocity(velocity, direction, speed, is_jump_interrupted) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends KinematicBody2D | |
class_name Actor | |
var direction = -1 | |
func _ready(): | |
if direction == 1.0: | |
$RayCast2D.position.x = $collisionShape2D.shape.get_extents().x * direction | |
const FLOOR_NORMAL: = Vector2.UP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends KinematicBody2D | |
class_name Actor | |
const FLOOR_NORMAL: = Vector2.UP | |
export var speed: = Vector2(300.0, 1000.0) | |
export var gravity: = 4000.0 | |
var velocity: = Vector2.ZERO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Actor | |
func _physics_process(delta: float) -> void: | |
var is_jump_interrupted: = Input.is_action_just_released("jump") and velocity.y < 0.0 | |
var direction = get_direction() | |
velocity = calculate_move_velocity(velocity, direction, speed, is_jump_interrupted) | |
velocity = move_and_slide(velocity, FLOOR_NORMAL) |