aaaaa
This commit is contained in:
@@ -4,8 +4,8 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://bsv3h2lpv7h77" path="res://virus.tscn" id="2_oi3di"]
|
[ext_resource type="PackedScene" uid="uid://bsv3h2lpv7h77" path="res://virus.tscn" id="2_oi3di"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bldi3fw0vmlu3" path="res://music.tscn" id="3_oi3di"]
|
[ext_resource type="PackedScene" uid="uid://bldi3fw0vmlu3" path="res://music.tscn" id="3_oi3di"]
|
||||||
[ext_resource type="TileSet" uid="uid://c20bl25rqyf68" path="res://assets/tiles/new_tile_set.tres" id="4_0b4ue"]
|
[ext_resource type="TileSet" uid="uid://c20bl25rqyf68" path="res://assets/tiles/new_tile_set.tres" id="4_0b4ue"]
|
||||||
[ext_resource type="PackedScene" uid="uid://co8jnr2dew5ts" path="res://hand.tscn" id="5_f2txt"]
|
[ext_resource type="PackedScene" uid="uid://cpp7v4jp8kt74" path="res://hand.tscn" id="5_f2txt"]
|
||||||
[ext_resource type="Script" uid="uid://dycpk6lxabn1l" path="res://virus_spawner.gd" id="6_1ainy"]
|
[ext_resource type="Script" path="res://virus_spawner.gd" id="6_1ainy"]
|
||||||
|
|
||||||
[node name="Level" type="Node2D"]
|
[node name="Level" type="Node2D"]
|
||||||
|
|
||||||
@@ -25,6 +25,17 @@ scale = Vector2(2, 2)
|
|||||||
[node name="Hand" parent="CanvasLayer" instance=ExtResource("5_f2txt")]
|
[node name="Hand" parent="CanvasLayer" instance=ExtResource("5_f2txt")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
||||||
|
[node name="ScoreCounter" type="RichTextLabel" parent="CanvasLayer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
offset_left = 16.0
|
||||||
|
offset_top = 19.0
|
||||||
|
offset_right = 117.0
|
||||||
|
offset_bottom = 65.0
|
||||||
|
text = "Score: 0
|
||||||
|
High Score: 0"
|
||||||
|
fit_content = true
|
||||||
|
autowrap_mode = 0
|
||||||
|
|
||||||
[node name="VirusSpawner" type="Node" parent="."]
|
[node name="VirusSpawner" type="Node" parent="."]
|
||||||
script = ExtResource("6_1ainy")
|
script = ExtResource("6_1ainy")
|
||||||
Virus = ExtResource("2_oi3di")
|
Virus = ExtResource("2_oi3di")
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ enum MoveState {Still, Moving, Dashing, Knockback}
|
|||||||
@onready var camera: Camera2D = %PlayerCamera
|
@onready var camera: Camera2D = %PlayerCamera
|
||||||
@onready var sprite: AnimatedSprite2D = $PlayerSprite
|
@onready var sprite: AnimatedSprite2D = $PlayerSprite
|
||||||
@onready var hand: Control = %Hand;
|
@onready var hand: Control = %Hand;
|
||||||
|
@onready var shield: Sprite2D = $Shield
|
||||||
|
@onready var score_counter: RichTextLabel = %ScoreCounter
|
||||||
|
|
||||||
|
var score = 0;
|
||||||
|
var high_score = 0;
|
||||||
|
|
||||||
var shield_active = true;
|
var shield_active = true;
|
||||||
var move_direction = Vector2.ZERO;
|
var move_direction = Vector2.ZERO;
|
||||||
@@ -117,6 +122,16 @@ func take_hit(_damage, knockback_vector, knockback_strength = 1):
|
|||||||
else:
|
else:
|
||||||
reboot();
|
reboot();
|
||||||
|
|
||||||
|
func add_to_score(amount):
|
||||||
|
score += amount;
|
||||||
|
if score > high_score:
|
||||||
|
high_score = score;
|
||||||
|
score_counter.text = "Score: %d\nHigh Score: %d" % [score, high_score]
|
||||||
|
|
||||||
|
func reset_score():
|
||||||
|
score = 0;
|
||||||
|
score_counter.text = "Score: %d\nHigh Score: %d" % [score, high_score]
|
||||||
|
|
||||||
func reboot():
|
func reboot():
|
||||||
# Called when the player dies
|
# Called when the player dies
|
||||||
# For now, just reset position and state
|
# For now, just reset position and state
|
||||||
@@ -124,4 +139,5 @@ func reboot():
|
|||||||
velocity = Vector2.ZERO;
|
velocity = Vector2.ZERO;
|
||||||
move_state = MoveState.Still;
|
move_state = MoveState.Still;
|
||||||
shield_active = true;
|
shield_active = true;
|
||||||
|
reset_score();
|
||||||
# hand.discard_all();
|
# hand.discard_all();
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ func take_hit(damage, knockback_vector, knockback_strength = 1):
|
|||||||
else:
|
else:
|
||||||
health -= damage
|
health -= damage
|
||||||
if health <= 0:
|
if health <= 0:
|
||||||
|
get_node("../../Player").add_to_score(1);
|
||||||
queue_free()
|
queue_free()
|
||||||
elif knockback_strength > 0:
|
elif knockback_strength > 0:
|
||||||
knockback = -knockback_vector;
|
knockback = -knockback_vector;
|
||||||
|
|||||||
Reference in New Issue
Block a user