gover man!
This commit is contained in:
parent
55059788b2
commit
81b01b7508
8 changed files with 185 additions and 36 deletions
|
|
@ -7,23 +7,24 @@ extends CharacterBody2D
|
|||
@export var move_focused_speed: float
|
||||
@onready var startpos = position
|
||||
|
||||
var can_die = true
|
||||
|
||||
var focused: bool:
|
||||
get(): return Input.is_action_pressed(&"focus")
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
var input_dir = Input.get_vector(&"move_left", &"move_right", &"move_up", &"move_down").sign()
|
||||
|
||||
velocity = input_dir.normalized() * (move_focused_speed if focused else move_normal_speed)
|
||||
move_and_slide()
|
||||
|
||||
|
||||
func _on_hurtbox_area_entered(area: Area2D) -> void:
|
||||
%DeathSound.play()
|
||||
position = startpos
|
||||
CurrentGame.change_lives(-1)
|
||||
if CurrentGame.lives < 0:
|
||||
gover()
|
||||
if can_die:
|
||||
%DeathSound.play()
|
||||
position = startpos
|
||||
CurrentGame.change_lives(-1)
|
||||
can_die = false
|
||||
|
||||
func gover():
|
||||
print("yeeeowtch!!!")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=13 format=3 uid="uid://c714s5d7d5765"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://c714s5d7d5765"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bpo15kuxdmulu" path="res://objects/player/player.gd" id="1_cqmt1"]
|
||||
[ext_resource type="Texture2D" uid="uid://cre6i8tsdlt7j" path="res://graphics/player/player_1.png" id="2_jnjyq"]
|
||||
|
|
@ -33,11 +33,7 @@ size = Vector2(22, 22)
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_gnkmh"]
|
||||
radius = 13.038404
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_aeam7"]
|
||||
offsets = PackedFloat32Array(0, 0.513333, 1)
|
||||
colors = PackedColorArray(0, 0.647059, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1)
|
||||
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
[node name="Player" type="CharacterBody2D" groups=["player"]]
|
||||
collision_layer = 2
|
||||
script = ExtResource("1_cqmt1")
|
||||
move_normal_speed = 200.0
|
||||
|
|
@ -84,21 +80,10 @@ debug_color = Color(0.7740294, 0.14773864, 0.99999994, 0.41960785)
|
|||
unique_name_in_owner = true
|
||||
stream = ExtResource("5_gnkmh")
|
||||
|
||||
[node name="GrazeParticles" type="CPUParticles2D" parent="." instance=ExtResource("6_xkryw")]
|
||||
[node name="GrazeParticles" parent="." instance=ExtResource("6_xkryw")]
|
||||
unique_name_in_owner = true
|
||||
emitting = false
|
||||
amount = 10
|
||||
lifetime = 0.15
|
||||
one_shot = true
|
||||
speed_scale = 0.5
|
||||
explosiveness = 0.6
|
||||
randomness = 1.0
|
||||
lifetime_randomness = 1.0
|
||||
spread = 154.09
|
||||
gravity = Vector2(0, 630)
|
||||
initial_velocity_min = 251.99
|
||||
initial_velocity_max = 484.86
|
||||
color_ramp = SubResource("Gradient_aeam7")
|
||||
script = null
|
||||
|
||||
[connection signal="area_entered" from="Hurtbox" to="." method="_on_hurtbox_area_entered"]
|
||||
[connection signal="area_entered" from="GrazeBox" to="." method="_on_graze_box_area_entered"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue