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")
|
||||
}
|
||||
18
objects/interact_obj/enemy/enemy_spawner.gd
Executable file
18
objects/interact_obj/enemy/enemy_spawner.gd
Executable file
@@ -0,0 +1,18 @@
|
||||
class_name EnemySpawner
|
||||
extends InteractableObject
|
||||
|
||||
@export var enemy_list:Array[PackedScene] = [null, null, null]
|
||||
@export var enemies_names:Array[String] = ["Enemy1", "Enemy2", "Enemy3"]
|
||||
var parent:Level
|
||||
|
||||
func _ready() -> void:
|
||||
if get_parent() == null:
|
||||
printerr("EnemySpawner must be a child of a Level")
|
||||
return
|
||||
parent = get_parent()
|
||||
parent.interactble_objects[global_position] = self
|
||||
|
||||
func use_object(requested_object:Node2D) -> void:
|
||||
if requested_object is World:
|
||||
requested_object.start_battle(enemy_list, enemies_names)
|
||||
|
||||
1
objects/interact_obj/enemy/enemy_spawner.gd.uid
Executable file
1
objects/interact_obj/enemy/enemy_spawner.gd.uid
Executable file
@@ -0,0 +1 @@
|
||||
uid://doklv2vrsog8h
|
||||
16
objects/interact_obj/enemy/enemy_spawner.tscn
Executable file
16
objects/interact_obj/enemy/enemy_spawner.tscn
Executable file
@@ -0,0 +1,16 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://cftk62y6lk3dm"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://doklv2vrsog8h" path="res://objects/interact_obj/enemy/enemy_spawner.gd" id="1_oe50a"]
|
||||
[ext_resource type="TileSet" uid="uid://bfkalv0skoxy2" path="res://tileset.tres" id="2_8s34m"]
|
||||
[ext_resource type="PackedScene" uid="uid://cba8xar11bpfs" path="res://objects/enemies/slime.tscn" id="2_jbnmd"]
|
||||
|
||||
[node name="EnemySpawner" type="Node2D"]
|
||||
script = ExtResource("1_oe50a")
|
||||
enemy_list = Array[PackedScene]([ExtResource("2_jbnmd"), null, null])
|
||||
enemies_names = Array[String](["Slime", "Enemy2", "Enemy3"])
|
||||
metadata/_custom_type_script = "uid://cbadxwb4uhv6p"
|
||||
|
||||
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
||||
position = Vector2(-5, -5)
|
||||
tile_map_data = PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 14, 0, 1, 0)
|
||||
tile_set = ExtResource("2_8s34m")
|
||||
14
objects/player/player.gd
Executable file
14
objects/player/player.gd
Executable file
@@ -0,0 +1,14 @@
|
||||
class_name Player
|
||||
extends Node2D
|
||||
|
||||
signal stats_changed()
|
||||
|
||||
@export var damage:int = 1:
|
||||
set(value):
|
||||
damage = value
|
||||
stats_changed.emit()
|
||||
|
||||
@export var health:int = 100
|
||||
@export var speed:int = 10
|
||||
|
||||
|
||||
1
objects/player/player.gd.uid
Executable file
1
objects/player/player.gd.uid
Executable file
@@ -0,0 +1 @@
|
||||
uid://c52d5au7kw685
|
||||
14
objects/player/player.tscn
Executable file
14
objects/player/player.tscn
Executable file
@@ -0,0 +1,14 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://ccynhcgx88bgq"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://lxto72ieesw2" path="res://cp437_10x10.png" id="1_cqmt1"]
|
||||
[ext_resource type="Script" uid="uid://c52d5au7kw685" path="res://objects/player/player.gd" id="1_g7ett"]
|
||||
|
||||
[node name="Player" type="Node2D"]
|
||||
script = ExtResource("1_g7ett")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
texture = ExtResource("1_cqmt1")
|
||||
hframes = 16
|
||||
vframes = 16
|
||||
frame = 80
|
||||
Reference in New Issue
Block a user