Added level 1
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
class_name ContolGuidanceSwitcher
|
||||
extends Node
|
||||
|
||||
|
||||
@export var keyboard_guidance : Guidance
|
||||
@export var gamepad_guidance : Guidance
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if not Engine.is_editor_hint():
|
||||
_updated_by_input_type(InputManager.get_type())
|
||||
InputManager.type_changed.connect(_updated_by_input_type)
|
||||
|
||||
|
||||
func _updated_by_input_type(type: InputManager.Type) -> void:
|
||||
match type:
|
||||
InputManager.Type.Keyboard:
|
||||
if keyboard_guidance:
|
||||
keyboard_guidance.show()
|
||||
if gamepad_guidance:
|
||||
gamepad_guidance.hide()
|
||||
InputManager.Type.Gamepad:
|
||||
if keyboard_guidance:
|
||||
keyboard_guidance.hide()
|
||||
if gamepad_guidance:
|
||||
gamepad_guidance.show()
|
||||
@@ -0,0 +1 @@
|
||||
uid://bbhog55aay31d
|
||||
@@ -0,0 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://dcls1laigghr4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bbhog55aay31d" path="res://game/entities/guidance/control_guidance_switcher.gd" id="1_mw6mb"]
|
||||
|
||||
[node name="ControlGuidanceSwitcher" type="Node" unique_id=552528483]
|
||||
script = ExtResource("1_mw6mb")
|
||||
@@ -0,0 +1,45 @@
|
||||
@tool
|
||||
class_name Guidance
|
||||
extends Node2D
|
||||
|
||||
|
||||
enum Size {
|
||||
Small,
|
||||
Big,
|
||||
}
|
||||
|
||||
|
||||
@export var size := Size.Small:
|
||||
set(value):
|
||||
size = value
|
||||
if is_node_ready():
|
||||
_update_size()
|
||||
|
||||
@export var text := "":
|
||||
set(value):
|
||||
text = value
|
||||
if is_node_ready():
|
||||
_update_text()
|
||||
|
||||
|
||||
@onready var small_sprite : Sprite2D = $SmallSprite
|
||||
@onready var big_sprite : Sprite2D = $BigSprite
|
||||
@onready var label : Label = $Label
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_update_size()
|
||||
_update_text()
|
||||
|
||||
|
||||
func _update_size() -> void:
|
||||
match size:
|
||||
Size.Small:
|
||||
small_sprite.show()
|
||||
big_sprite.hide()
|
||||
Size.Big:
|
||||
small_sprite.hide()
|
||||
big_sprite.show()
|
||||
|
||||
func _update_text() -> void:
|
||||
label.text = text
|
||||
@@ -0,0 +1 @@
|
||||
uid://unj7gyl50bh4
|
||||
@@ -0,0 +1,33 @@
|
||||
[gd_scene format=3 uid="uid://d8wwtdj30wwr"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://unj7gyl50bh4" path="res://game/entities/guidance/guidance.gd" id="1_0gb2d"]
|
||||
[ext_resource type="Texture2D" uid="uid://dc3j8hs0ld4cg" path="res://images/entities/guidance.png" id="2_37fbl"]
|
||||
[ext_resource type="Theme" uid="uid://bqj884yfvhhft" path="res://game/themes/main_menu.tres" id="3_1vdxa"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0gb2d"]
|
||||
atlas = ExtResource("2_37fbl")
|
||||
region = Rect2(0, 0, 48, 48)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_37fbl"]
|
||||
atlas = ExtResource("2_37fbl")
|
||||
region = Rect2(48, 0, 96, 48)
|
||||
|
||||
[node name="Guidance" type="Node2D" unique_id=1797017316]
|
||||
script = ExtResource("1_0gb2d")
|
||||
|
||||
[node name="SmallSprite" type="Sprite2D" parent="." unique_id=1649957299]
|
||||
texture = SubResource("AtlasTexture_0gb2d")
|
||||
|
||||
[node name="BigSprite" type="Sprite2D" parent="." unique_id=835120450]
|
||||
visible = false
|
||||
texture = SubResource("AtlasTexture_37fbl")
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=1747099762]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("3_1vdxa")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
@@ -7,12 +7,14 @@ signal dead()
|
||||
|
||||
|
||||
const MAX_HEALTH = 100.0
|
||||
const CAMERA_OFFSET_FACTOR = 0.4
|
||||
const CAMERA_OFFSET_TIME = 1.0
|
||||
|
||||
|
||||
@export_group("Movement", "move")
|
||||
@export_range(0.0, 1000.0) var move_max_speed_normal := 350
|
||||
@export_range(0.0, 1000.0) var move_max_speed_slowed := 250
|
||||
@export_range(0.0, 1000.0) var move_acceleration := 1000.0
|
||||
@export_range(0.0, 1000.0) var move_acceleration := 750.0
|
||||
|
||||
@export_group("Jump", "jump")
|
||||
@export_range(0.0, 1000.0) var jump_max_fall_speed := 1000
|
||||
@@ -30,8 +32,15 @@ const MAX_HEALTH = 100.0
|
||||
@export_range(0.0, 1000.0) var slow_down_sustain := 0.70
|
||||
@export_range(0.0, 1000.0) var slow_down_release := 0.25
|
||||
|
||||
@export var camera_limit_right := 10000000:
|
||||
set(value):
|
||||
camera_limit_right = value
|
||||
if is_node_ready():
|
||||
_update_camera_limit_right()
|
||||
|
||||
|
||||
var _slow_down_tween: Tween
|
||||
var _camera_offset_tween: Tween
|
||||
|
||||
var _last_wall_normal: = 0.0
|
||||
|
||||
@@ -79,6 +88,8 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
_update_camera_limit_right()
|
||||
|
||||
if is_on_floor():
|
||||
floor_coyote_time_timer.start()
|
||||
_last_wall_normal = 0.0
|
||||
@@ -136,6 +147,12 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
move_and_slide()
|
||||
state_machine.physics_process(delta)
|
||||
|
||||
if _camera_offset_tween and _camera_offset_tween.is_running():
|
||||
_camera_offset_tween.kill()
|
||||
_camera_offset_tween = create_tween()
|
||||
var new_camera_position := Vector2(velocity.x * CAMERA_OFFSET_FACTOR, 0)
|
||||
_camera_offset_tween.tween_property(camera, "position", new_camera_position, CAMERA_OFFSET_TIME)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
@@ -153,6 +170,10 @@ func deal_damage(value: float) -> void:
|
||||
dead.emit()
|
||||
|
||||
|
||||
func _update_camera_limit_right() -> void:
|
||||
camera.limit_right = camera_limit_right
|
||||
|
||||
|
||||
func _can_attack() -> bool:
|
||||
if not attack_cooldown_timer.is_stopped():
|
||||
return false
|
||||
|
||||
@@ -64,10 +64,6 @@ region = Rect2(96, 192, 32, 32)
|
||||
atlas = ExtResource("2_cjfdk")
|
||||
region = Rect2(128, 192, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_t56eh"]
|
||||
atlas = ExtResource("2_cjfdk")
|
||||
region = Rect2(0, 64, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6pmmc"]
|
||||
atlas = ExtResource("2_cjfdk")
|
||||
region = Rect2(32, 64, 32, 32)
|
||||
@@ -88,9 +84,9 @@ region = Rect2(128, 64, 32, 32)
|
||||
atlas = ExtResource("2_cjfdk")
|
||||
region = Rect2(160, 64, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8pcyd"]
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_t56eh"]
|
||||
atlas = ExtResource("2_cjfdk")
|
||||
region = Rect2(0, 96, 32, 32)
|
||||
region = Rect2(0, 64, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_fq5t3"]
|
||||
atlas = ExtResource("2_cjfdk")
|
||||
@@ -112,6 +108,10 @@ region = Rect2(128, 96, 32, 32)
|
||||
atlas = ExtResource("2_cjfdk")
|
||||
region = Rect2(160, 96, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8pcyd"]
|
||||
atlas = ExtResource("2_cjfdk")
|
||||
region = Rect2(0, 96, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_66tqw"]
|
||||
atlas = ExtResource("2_cjfdk")
|
||||
region = Rect2(96, 256, 32, 32)
|
||||
@@ -181,9 +181,6 @@ animations = [{
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_t56eh")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6pmmc")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
@@ -197,6 +194,9 @@ animations = [{
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4neg5")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_t56eh")
|
||||
}],
|
||||
"loop": 1,
|
||||
"name": &"run_left",
|
||||
@@ -204,9 +204,6 @@ animations = [{
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_8pcyd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_fq5t3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
@@ -220,6 +217,9 @@ animations = [{
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_588tj")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_8pcyd")
|
||||
}],
|
||||
"loop": 1,
|
||||
"name": &"run_right",
|
||||
@@ -555,7 +555,7 @@ shape = SubResource("CapsuleShape2D_bhunq")
|
||||
|
||||
[node name="PlayerSprite" type="AnimatedSprite2D" parent="." unique_id=2025942250]
|
||||
sprite_frames = SubResource("SpriteFrames_bhunq")
|
||||
animation = &"wall_right"
|
||||
animation = &"run_left"
|
||||
|
||||
[node name="BladeSprite" type="AnimatedSprite2D" parent="." unique_id=1561250707]
|
||||
position = Vector2(0, 8)
|
||||
|
||||
@@ -31,6 +31,7 @@ func exit() -> void:
|
||||
|
||||
|
||||
func physics_process(_delta: float) -> void:
|
||||
player.player_sprite.speed_scale = max(player.velocity.x / player.move_max_speed_normal, 0.5)
|
||||
if player.is_on_floor():
|
||||
if is_zero_approx(player.velocity.x):
|
||||
switch_state.emit(idle)
|
||||
|
||||
@@ -5,8 +5,8 @@ extends Node2D
|
||||
const CORRUPTION_DAMAGE = 10.0
|
||||
|
||||
|
||||
@export var initial_corruption_x := 0.0
|
||||
@export var corruption_speed := 0.0
|
||||
@export var initial_corruption_x := -400.0
|
||||
@export var corruption_speed := 200.0
|
||||
@export var desctruction_offset := 100.0
|
||||
|
||||
|
||||
|
||||
@@ -1885,12 +1885,10 @@ glow_hdr_threshold = 0.5
|
||||
glow_hdr_scale = 4.0
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bhunq"]
|
||||
size = Vector2(20, 200)
|
||||
|
||||
[node name="AbstractLevel" type="Node2D" unique_id=1001045799]
|
||||
script = ExtResource("1_o2mui")
|
||||
initial_corruption_x = null
|
||||
corruption_speed = null
|
||||
desctruction_offset = null
|
||||
|
||||
[node name="Background" type="Node2D" parent="." unique_id=753724440]
|
||||
|
||||
@@ -1911,6 +1909,8 @@ tile_set = SubResource("TileSet_71ysb")
|
||||
|
||||
[node name="Dangers" type="Node2D" parent="." unique_id=608961351]
|
||||
|
||||
[node name="Guidances" type="Node2D" parent="." unique_id=1356136322]
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1125559156]
|
||||
|
||||
[node name="LevelColorRect" type="ColorRect" parent="CanvasLayer" unique_id=739757562]
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,62 @@
|
||||
class_name CInputManager
|
||||
extends Node
|
||||
|
||||
|
||||
signal type_changed(type: Type)
|
||||
|
||||
|
||||
enum Type {
|
||||
Keyboard,
|
||||
Gamepad,
|
||||
}
|
||||
|
||||
|
||||
@export_range(0.0, 1.0, 0.01) var dead_zone := 0.2
|
||||
|
||||
|
||||
@onready var _type : Type:
|
||||
set(value):
|
||||
_type = value
|
||||
type_changed.emit(_type)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if Input.get_connected_joypads().size() > 0:
|
||||
_type = Type.Gamepad
|
||||
else:
|
||||
_type = Type.Keyboard
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if _is_keyboard_event(event):
|
||||
_type = Type.Keyboard
|
||||
elif _is_gamepad_event(event):
|
||||
_type = Type.Gamepad
|
||||
|
||||
|
||||
func _is_keyboard_event(event: InputEvent) -> bool:
|
||||
if event is InputEventKey:
|
||||
return true
|
||||
if event is InputEventMouse:
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
func _is_gamepad_event(event: InputEvent) -> bool:
|
||||
if event is InputEventJoypadButton:
|
||||
return true
|
||||
if event is InputEventJoypadMotion and not _is_deadzone(event):
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
func _is_deadzone(event: InputEventJoypadMotion) -> bool:
|
||||
if event.axis_value < -dead_zone:
|
||||
return false
|
||||
if event.axis_value > dead_zone:
|
||||
return false
|
||||
return true
|
||||
|
||||
|
||||
func get_type() -> Type:
|
||||
return _type
|
||||
@@ -0,0 +1 @@
|
||||
uid://0axtbnrglq15
|
||||
@@ -0,0 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://c8gid73siy882"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://0axtbnrglq15" path="res://game/managers/input_manager.gd" id="1_tiryt"]
|
||||
|
||||
[node name="InputManager" type="Node" unique_id=1641468352]
|
||||
script = ExtResource("1_tiryt")
|
||||
@@ -1,8 +1,9 @@
|
||||
[gd_scene format=3 uid="uid://bk2pkmgxsgars"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cm1lme51ido64" path="res://game/managers/level_manager.gd" id="1_te7jw"]
|
||||
[ext_resource type="PackedScene" uid="uid://deto1j12jm5rf" path="res://game/levels/level_1.tscn" id="2_dp0cj"]
|
||||
[ext_resource type="PackedScene" uid="uid://cuig5x5fd47hs" path="res://game/levels/test_level.tscn" id="2_ow2rn"]
|
||||
|
||||
[node name="LevelManager" type="Node" unique_id=1657502743]
|
||||
script = ExtResource("1_te7jw")
|
||||
levels = Array[PackedScene]([ExtResource("2_ow2rn")])
|
||||
levels = Array[PackedScene]([ExtResource("2_dp0cj"), ExtResource("2_ow2rn")])
|
||||
|
||||
@@ -20,26 +20,4 @@ void fragment() {
|
||||
float fade = clamp(pixel_dist / edge_width, 0.0, 1.0);
|
||||
|
||||
COLOR.a *= fade;
|
||||
|
||||
|
||||
|
||||
//vec4 tex_color = texture(TEXTURE, UV);
|
||||
//
|
||||
//// Расстояние до каждого края в пикселях экрана
|
||||
//float dist_left = UV.x / fwidth(UV.x);
|
||||
//float dist_right = (1.0 - UV.x) / fwidth(UV.x);
|
||||
//float dist_bottom = UV.y / fwidth(UV.y);
|
||||
//float dist_top = (1.0 - UV.y) / fwidth(UV.y);
|
||||
//
|
||||
//// Берём ближайший край
|
||||
//float pixel_dist = min(min(dist_left, dist_right),
|
||||
//min(dist_bottom, dist_top));
|
||||
//
|
||||
//// Плавное затухание: 0 на самой границе, 1 на расстоянии edge_width и дальше
|
||||
//float fade = clamp(pixel_dist / edge_width, 0.0, 1.0);
|
||||
//
|
||||
//COLOR = tex_color;
|
||||
//COLOR.a *= fade;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dc3j8hs0ld4cg"
|
||||
path="res://.godot/imported/guidance.png-832cb67502e6655e432d10a4490cb58d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://images/entities/guidance.png"
|
||||
dest_files=["res://.godot/imported/guidance.png-832cb67502e6655e432d10a4490cb58d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -27,6 +27,7 @@ SettingsManager="*uid://cuyv26utj07j4"
|
||||
HitstopManager="*uid://ba262w3ebkyo1"
|
||||
LevelManager="*uid://bk2pkmgxsgars"
|
||||
SaveManager="*uid://2pbgcr5yk7iy"
|
||||
InputManager="*uid://c8gid73siy882"
|
||||
|
||||
[debug]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user