Added some Level 5 implementation and reorganized file structure

This commit is contained in:
VoidTwo
2021-11-27 17:36:06 -06:00
parent 2c98c112bd
commit aac45f808c
114 changed files with 1892 additions and 638 deletions

16
Player/Item.gd Normal file
View File

@@ -0,0 +1,16 @@
# Item Class
var name: String
var type: String
func _init(name: String, type: String) -> void:
self.name = name
self.type = type
return
func equals(other) -> bool:
if(self.name == other.name and self.type == other.type):
return true
return false

View File

@@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

View File

@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Player.png-3d0801c65bdfc563657cfa304115f1c7.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Player/Player.png"
dest_files=[ "res://.import/Player.png-3d0801c65bdfc563657cfa304115f1c7.stex" ]
[params]
compress/mode=3
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=2
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=0
process/fix_alpha_border=false
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@@ -1,16 +1,16 @@
[gd_scene load_steps=20 format=2]
[ext_resource path="res://Player/Player.gd" type="Script" id=1]
[ext_resource path="res://Player/Player.png" type="Texture" id=2]
[ext_resource path="res://Player/Player_Down.png" type="Texture" id=3]
[ext_resource path="res://Player/Player_Up.png" type="Texture" id=4]
[ext_resource path="res://Sprites/Player/Player.png" type="Texture" id=2]
[ext_resource path="res://Sprites/Player/Player_Down.png" type="Texture" id=3]
[ext_resource path="res://Sprites/Player/Player_Up.png" type="Texture" id=4]
[ext_resource path="res://Player/Inventory.tscn" type="PackedScene" id=5]
[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 4 ) ],
"frames": [ ExtResource( 2 ) ],
"loop": false,
"name": "look_up",
"name": "look_right",
"speed": 5.0
}, {
"frames": [ ExtResource( 2 ) ],
@@ -18,9 +18,9 @@ animations = [ {
"name": "look_left",
"speed": 5.0
}, {
"frames": [ ExtResource( 2 ) ],
"frames": [ ExtResource( 4 ) ],
"loop": false,
"name": "look_right",
"name": "look_up",
"speed": 5.0
}, {
"frames": [ ExtResource( 3 ) ],
@@ -161,14 +161,14 @@ animation = "Look Up"
[sub_resource type="AnimationNodeBlendSpace2D" id=12]
blend_point_0/node = SubResource( 8 )
blend_point_0/pos = Vector2( -1.01, 0 )
blend_point_0/pos = Vector2( -1, 0 )
blend_point_1/node = SubResource( 9 )
blend_point_1/pos = Vector2( 0, 1.1 )
blend_point_2/node = SubResource( 10 )
blend_point_2/pos = Vector2( 1, 0 )
blend_point_3/node = SubResource( 11 )
blend_point_3/pos = Vector2( 0, -1.1 )
min_space = Vector2( -1.01, -1.1 )
min_space = Vector2( -1, -1.1 )
max_space = Vector2( 1, 1.1 )
blend_mode = 1
@@ -181,12 +181,14 @@ graph_offset = Vector2( -3591.37, -302.6 )
[sub_resource type="AnimationNodeStateMachinePlayback" id=14]
[node name="Player" type="KinematicBody2D"]
collision_layer = 2
script = ExtResource( 1 )
[node name="Sprite" type="AnimatedSprite" parent="."]
position = Vector2( 0, -5 )
light_mask = 2
frames = SubResource( 1 )
animation = "look_right"
offset = Vector2( 0, -5 )
[node name="Collision" type="CollisionShape2D" parent="."]
visible = false
@@ -194,6 +196,8 @@ rotation = 1.5708
shape = SubResource( 2 )
[node name="Hitbox" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
visible = false
@@ -212,7 +216,7 @@ tree_root = SubResource( 13 )
anim_player = NodePath("../AnimationPlayer")
active = true
parameters/playback = SubResource( 14 )
parameters/Idle/blend_position = Vector2( 0.993787, 0.0189655 )
parameters/Idle/blend_position = Vector2( 0.0760697, 0 )
[node name="Inventory" parent="." instance=ExtResource( 5 )]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 B

View File

@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Player_Down.png-0720a85ec5e36101f691c750d323946c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Player/Player_Down.png"
dest_files=[ "res://.import/Player_Down.png-0720a85ec5e36101f691c750d323946c.stex" ]
[params]
compress/mode=3
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=2
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=0
process/fix_alpha_border=false
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

View File

@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Player_Up.png-889a827868f4dc454da2bef028bdec76.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Player/Player_Up.png"
dest_files=[ "res://.import/Player_Up.png-889a827868f4dc454da2bef028bdec76.stex" ]
[params]
compress/mode=3
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=2
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=0
process/fix_alpha_border=false
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0