Added some Level 5 implementation and reorganized file structure
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
const ACCELERATION: int = 1000
|
||||
const MAX_SPEED: int = 120
|
||||
const FRICTION: int = 1000
|
||||
const HEALTH_SLICES: Array = [0, 20, 35, 50, 65, 80, 100]
|
||||
export var ACCELERATION: int = 1000
|
||||
export var MAX_SPEED: int = 120
|
||||
export var FRICTION: int = 1000
|
||||
|
||||
const HEALTH_SLICES: Array = [0, 18, 35, 50, 65, 82, 100]
|
||||
var health_index: int = 6
|
||||
|
||||
var hud: CanvasLayer = null
|
||||
var velocity: Vector2 = Vector2.ZERO
|
||||
|
||||
@@ -57,3 +58,15 @@ func _on_Hitbox_body_entered(body: Node) -> void:
|
||||
health_index -= 1
|
||||
hud.update_health(HEALTH_SLICES[health_index])
|
||||
return
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed('screenshot'):
|
||||
var img: Image = get_viewport().get_texture().get_data()
|
||||
yield(get_tree(), "idle_frame")
|
||||
yield(get_tree(), "idle_frame")
|
||||
|
||||
img.flip_y()
|
||||
if img.save_png('user://screenshot.png') != OK:
|
||||
print('ERROR: Failed saving screenshot.')
|
||||
return
|
||||
|
Reference in New Issue
Block a user