init
This commit is contained in:
BIN
objects/enemies/ascii-art(1).png
Executable file
BIN
objects/enemies/ascii-art(1).png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
40
objects/enemies/ascii-art(1).png.import
Executable file
40
objects/enemies/ascii-art(1).png.import
Executable file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cxpd16b5ebba5"
|
||||
path="res://.godot/imported/ascii-art(1).png-b6b244adb19f2eea0c40a314c5c3b8a5.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://objects/enemies/ascii-art(1).png"
|
||||
dest_files=["res://.godot/imported/ascii-art(1).png-b6b244adb19f2eea0c40a314c5c3b8a5.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
|
||||
42
objects/enemies/enemy.gd
Executable file
42
objects/enemies/enemy.gd
Executable file
@@ -0,0 +1,42 @@
|
||||
class_name Enemy
|
||||
extends Node2D
|
||||
|
||||
@export var damage:int = 1
|
||||
@export var max_health:int = 10
|
||||
@export var speed:int = 10
|
||||
@export var accuracy:int = 100
|
||||
@export var max_money:int = 10
|
||||
|
||||
@export var level:int = 1
|
||||
@export var level_multiplier:float = 1.2
|
||||
|
||||
@export var health_label:RichTextLabel
|
||||
@export var animation_player:AnimationPlayer
|
||||
var min_money:int = 1
|
||||
var health:int = 0:
|
||||
set(value):
|
||||
health = value
|
||||
if health != max_health:
|
||||
if health_label != null:
|
||||
if health <= round(max_health / 4):
|
||||
health_label.text = "[color=red]" + str(health) + "[/color]" + " / " + str(max_health)
|
||||
elif health <= round(max_health / 2):
|
||||
health_label.text = "[color=yellow]" + str(health) + "[/color]" + " / " + str(max_health)
|
||||
else:
|
||||
health_label.text = str(health) + " / " + str(max_health)
|
||||
|
||||
if animation_player != null:
|
||||
animation_player.play("hurt")
|
||||
else:
|
||||
health_label.text = str(health) + " / " + str(max_health)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if level > 1:
|
||||
for i in range(level):
|
||||
damage = round(damage * level_multiplier)
|
||||
max_health = round(max_health * level_multiplier)
|
||||
speed = round(speed * level_multiplier)
|
||||
min_money = round(min_money * level_multiplier)
|
||||
max_money = round(max_money * level_multiplier)
|
||||
health = max_health
|
||||
1
objects/enemies/enemy.gd.uid
Executable file
1
objects/enemies/enemy.gd.uid
Executable file
@@ -0,0 +1 @@
|
||||
uid://b0q3j0msvb7ai
|
||||
90
objects/enemies/slime.tscn
Executable file
90
objects/enemies/slime.tscn
Executable file
@@ -0,0 +1,90 @@
|
||||
[gd_scene load_steps=6 format=4 uid="uid://cba8xar11bpfs"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b0q3j0msvb7ai" path="res://objects/enemies/enemy.gd" id="1_dvgkk"]
|
||||
[ext_resource type="TileSet" uid="uid://bfkalv0skoxy2" path="res://tileset.tres" id="2_nfxyp"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_nfxyp"]
|
||||
resource_name = "hurt"
|
||||
length = 0.3
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("TileMapLayer:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2(-35, -65), Vector2(-5, -65), Vector2(-45, -65), Vector2(-35, -65)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("TileMapLayer:modulate")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0, 1, 0, 1), Color(1, 0, 0, 1), Color(0, 1, 0, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_4plf3"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("TileMapLayer:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-35, -65)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("TileMapLayer:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0, 1, 0, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_3a0bb"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_4plf3"),
|
||||
&"hurt": SubResource("Animation_nfxyp")
|
||||
}
|
||||
|
||||
[node name="Slime" type="Node2D" node_paths=PackedStringArray("health_label", "animation_player")]
|
||||
script = ExtResource("1_dvgkk")
|
||||
health_label = NodePath("RichTextLabel")
|
||||
animation_player = NodePath("AnimationPlayer")
|
||||
|
||||
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
||||
modulate = Color(0, 1, 0, 1)
|
||||
position = Vector2(-35, -65)
|
||||
tile_map_data = PackedByteArray("AAAAAAAAAAAPAAUAAAABAAAAAAAPAAUAAAACAAAAAAAPAAUAAAADAAAAAAAPAAUAAAAEAAAAAAAPAAUAAAAFAAAAAAAPAAUAAAAGAAEAAAAMAAUAAAAHAAIAAAAMAAUAAAAIAAMAAAAMAAUAAAAJAAQAAAAMAAUAAAD//wEAAAAPAAIAAAD+/wIAAAAPAAIAAAD9/wMAAAAPAAIAAAD8/wQAAAAPAAIAAAD7/wUAAAADAAsAAAD7/wcAAAADAAsAAAD7/wgAAAADAAsAAAD7/wYAAAADAAsAAAAKAAUAAAADAAsAAAAKAAYAAAADAAsAAAAKAAcAAAADAAsAAAAKAAkAAAADAAsAAAAKAAgAAAADAAsAAAD7/wkAAAADAAsAAAAJAAoAAAAPAAIAAAAIAAsAAAAPAAIAAAAHAAwAAAAPAAIAAAD8/woAAAAMAAUAAAD9/wsAAAAMAAUAAAD+/wwAAAAMAAUAAAD//w0AAAANAAIAAAAAAA0AAAANAAIAAAABAA0AAAANAAIAAAACAA0AAAANAAIAAAADAA0AAAANAAIAAAAEAA0AAAANAAIAAAAFAA0AAAANAAIAAAAGAA0AAAANAAIAAAA=")
|
||||
tile_set = ExtResource("2_nfxyp")
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="."]
|
||||
offset_left = -45.0
|
||||
offset_top = 85.0
|
||||
offset_right = 45.0
|
||||
offset_bottom = 125.0
|
||||
bbcode_enabled = true
|
||||
text = "100 / 100"
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_3a0bb")
|
||||
}
|
||||
Reference in New Issue
Block a user