fkl;dsnak;l gjmbsdfjlabgscajmg njl,.bfnelkjqbgmf
This commit is contained in:
parent
e09681afec
commit
8efed5d4d6
@ -5,19 +5,21 @@ extends CharacterBody2D
|
|||||||
@export var FRICTION = 1500.0;
|
@export var FRICTION = 1500.0;
|
||||||
@export var HP = 100;
|
@export var HP = 100;
|
||||||
@export var DAMAGE = 10;
|
@export var DAMAGE = 10;
|
||||||
@export var COOLDOWN = 2;
|
@export var COOLDOWN = 1;
|
||||||
|
|
||||||
@onready var raycast = $RayCast2D;
|
@onready var raycast = $RayCast2D;
|
||||||
@onready var cooldown_timer = $CooldownTimer;
|
@onready var cooldown_timer = $CooldownTimer;
|
||||||
|
@onready var sprite = $AnimatedSprite2D;
|
||||||
|
|
||||||
var player = null;
|
var player = null;
|
||||||
var is_on_cooldown = false;
|
var is_on_cooldown = false;
|
||||||
|
var attacking = false;
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
add_to_group("enemies");
|
add_to_group("enemies");
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
if player == null:
|
if player == null || !attacking:
|
||||||
return
|
return
|
||||||
|
|
||||||
var vec_to_player = player.global_position - global_position;
|
var vec_to_player = player.global_position - global_position;
|
||||||
@ -43,6 +45,7 @@ func take_damage(damage):
|
|||||||
kill();
|
kill();
|
||||||
|
|
||||||
func kill():
|
func kill():
|
||||||
|
emit_signal("is_killed");
|
||||||
queue_free();
|
queue_free();
|
||||||
|
|
||||||
func set_player(p):
|
func set_player(p):
|
||||||
@ -50,3 +53,9 @@ func set_player(p):
|
|||||||
|
|
||||||
func _on_cooldown_timer_timeout():
|
func _on_cooldown_timer_timeout():
|
||||||
is_on_cooldown = false;
|
is_on_cooldown = false;
|
||||||
|
|
||||||
|
func _on_area_2d_body_entered(body):
|
||||||
|
if body.name == "Player":
|
||||||
|
attacking = true;
|
||||||
|
|
||||||
|
signal is_killed()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://c661br4lh30r8"]
|
[gd_scene load_steps=6 format=3 uid="uid://c661br4lh30r8"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Enemies/basic_enemy.gd" id="1_5vi5k"]
|
[ext_resource type="Script" path="res://Enemies/basic_enemy.gd" id="1_5vi5k"]
|
||||||
[ext_resource type="Texture2D" uid="uid://ds4uvvrcxoay1" path="res://Sprites/placeholder_enemy.png" id="1_o8nfm"]
|
[ext_resource type="Texture2D" uid="uid://ds4uvvrcxoay1" path="res://Sprites/placeholder_enemy.png" id="1_o8nfm"]
|
||||||
@ -17,6 +17,9 @@ animations = [{
|
|||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_47nt3"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_47nt3"]
|
||||||
size = Vector2(41, 64)
|
size = Vector2(41, 64)
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_237ox"]
|
||||||
|
radius = 390.185
|
||||||
|
|
||||||
[node name="BasicEnemy" type="CharacterBody2D"]
|
[node name="BasicEnemy" type="CharacterBody2D"]
|
||||||
script = ExtResource("1_5vi5k")
|
script = ExtResource("1_5vi5k")
|
||||||
|
|
||||||
@ -38,4 +41,12 @@ default_color = Color(1, 0, 0, 0.392157)
|
|||||||
|
|
||||||
[node name="CooldownTimer" type="Timer" parent="."]
|
[node name="CooldownTimer" type="Timer" parent="."]
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
collision_layer = 2
|
||||||
|
collision_mask = 2
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||||
|
shape = SubResource("CircleShape2D_237ox")
|
||||||
|
|
||||||
[connection signal="timeout" from="CooldownTimer" to="." method="_on_cooldown_timer_timeout"]
|
[connection signal="timeout" from="CooldownTimer" to="." method="_on_cooldown_timer_timeout"]
|
||||||
|
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
|
||||||
|
21
Levels/level.gd
Normal file
21
Levels/level.gd
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
@onready var doors = $Doors;
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _on_pickable_t_shirt_picked():
|
||||||
|
doors.remove_child($Doors/FrontDoor_Left);
|
||||||
|
doors.remove_child($Doors/FrontDoor_Right);
|
||||||
|
|
||||||
|
|
||||||
|
func _on_outside_enemy_is_killed():
|
||||||
|
doors.remove_child($Doors/ClassDoor);
|
||||||
|
|
||||||
|
|
||||||
|
func _on_shoes_picked():
|
||||||
|
doors.remove_child($Doors/Bathroom_Top);
|
@ -1,10 +1,22 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://b8rvp5g0vj8q1"]
|
[gd_scene load_steps=11 format=3 uid="uid://b8rvp5g0vj8q1"]
|
||||||
|
|
||||||
[ext_resource type="TileSet" uid="uid://bi3tupdxmgcim" path="res://TileSets/tiles.tres" id="1_8igly"]
|
[ext_resource type="TileSet" uid="uid://bi3tupdxmgcim" path="res://TileSets/tiles.tres" id="1_8igly"]
|
||||||
|
[ext_resource type="Script" path="res://Levels/level.gd" id="1_x3isi"]
|
||||||
[ext_resource type="PackedScene" uid="uid://xev8p1td1icx" path="res://Player/player.tscn" id="2_raadk"]
|
[ext_resource type="PackedScene" uid="uid://xev8p1td1icx" path="res://Player/player.tscn" id="2_raadk"]
|
||||||
[ext_resource type="AudioStream" uid="uid://dhuxf2eklsha5" path="res://Music/school.ogg" id="3_rnkol"]
|
[ext_resource type="AudioStream" uid="uid://dhuxf2eklsha5" path="res://Music/school.ogg" id="3_rnkol"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://chhokm3rf6pd3" path="res://OTHERS/door.tscn" id="4_oukel"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bbg5x0apue0ei" path="res://PickableItems/pickable_t_shirt.tscn" id="5_kahe8"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c661br4lh30r8" path="res://Enemies/basic_enemy.tscn" id="7_qt4sv"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://degce2jvx3sli" path="res://PickableItems/pickable_shoes.tscn" id="8_qnb3g"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8jn25"]
|
||||||
|
size = Vector2(85, 5534.75)
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5xvim"]
|
||||||
|
size = Vector2(4186, 55)
|
||||||
|
|
||||||
[node name="Level" type="Node2D"]
|
[node name="Level" type="Node2D"]
|
||||||
|
script = ExtResource("1_x3isi")
|
||||||
|
|
||||||
[node name="Floor1" type="TileMap" parent="."]
|
[node name="Floor1" type="TileMap" parent="."]
|
||||||
tile_set = ExtResource("1_8igly")
|
tile_set = ExtResource("1_8igly")
|
||||||
@ -37,3 +49,97 @@ position = Vector2(3075, 488)
|
|||||||
stream = ExtResource("3_rnkol")
|
stream = ExtResource("3_rnkol")
|
||||||
volume_db = -6.0
|
volume_db = -6.0
|
||||||
autoplay = true
|
autoplay = true
|
||||||
|
|
||||||
|
[node name="Outside_Wall" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="StaticBody2D" type="StaticBody2D" parent="Outside_Wall"]
|
||||||
|
position = Vector2(1029, 0)
|
||||||
|
|
||||||
|
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Outside_Wall/StaticBody2D"]
|
||||||
|
position = Vector2(4094.5, 2720.63)
|
||||||
|
shape = SubResource("RectangleShape2D_8jn25")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Outside_Wall/StaticBody2D"]
|
||||||
|
position = Vector2(0, 2770)
|
||||||
|
shape = SubResource("RectangleShape2D_8jn25")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Outside_Wall/StaticBody2D"]
|
||||||
|
position = Vector2(2023, -0.5)
|
||||||
|
shape = SubResource("RectangleShape2D_5xvim")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D4" type="CollisionShape2D" parent="Outside_Wall/StaticBody2D"]
|
||||||
|
position = Vector2(2023, 5393)
|
||||||
|
shape = SubResource("RectangleShape2D_5xvim")
|
||||||
|
|
||||||
|
[node name="Doors" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="FrontDoor_Left" parent="Doors" instance=ExtResource("4_oukel")]
|
||||||
|
position = Vector2(2906, 758)
|
||||||
|
scale = Vector2(4.47547, 4.07547)
|
||||||
|
|
||||||
|
[node name="FrontDoor_Right" parent="Doors" instance=ExtResource("4_oukel")]
|
||||||
|
position = Vector2(3239, 762)
|
||||||
|
rotation = -3.14159
|
||||||
|
scale = Vector2(4.47547, 4.07547)
|
||||||
|
|
||||||
|
[node name="ClassDoor" parent="Doors" instance=ExtResource("4_oukel")]
|
||||||
|
position = Vector2(2763, 1339)
|
||||||
|
rotation = 1.57079
|
||||||
|
scale = Vector2(3.57152, 3.25231)
|
||||||
|
|
||||||
|
[node name="Bathroom_Top" parent="Doors" instance=ExtResource("4_oukel")]
|
||||||
|
position = Vector2(3368, 1473)
|
||||||
|
rotation = 1.57079
|
||||||
|
scale = Vector2(3.57152, 3.25231)
|
||||||
|
|
||||||
|
[node name="Bathroom_Bottom" parent="Doors" instance=ExtResource("4_oukel")]
|
||||||
|
position = Vector2(3368, 1984)
|
||||||
|
rotation = 4.71238
|
||||||
|
scale = Vector2(3.57152, 3.25231)
|
||||||
|
|
||||||
|
[node name="Cafeteria" parent="Doors" instance=ExtResource("4_oukel")]
|
||||||
|
position = Vector2(2763, 2436)
|
||||||
|
rotation = 4.71238
|
||||||
|
scale = Vector2(3.57152, 3.25231)
|
||||||
|
|
||||||
|
[node name="Locker" parent="Doors" instance=ExtResource("4_oukel")]
|
||||||
|
position = Vector2(3388, 2494)
|
||||||
|
rotation = 4.71238
|
||||||
|
scale = Vector2(3.57152, 3.25231)
|
||||||
|
|
||||||
|
[node name="Gym" parent="Doors" instance=ExtResource("4_oukel")]
|
||||||
|
position = Vector2(3388, 3579)
|
||||||
|
rotation = 4.71238
|
||||||
|
scale = Vector2(3.57152, 3.25231)
|
||||||
|
|
||||||
|
[node name="BackDoor_Left" parent="Doors" instance=ExtResource("4_oukel")]
|
||||||
|
position = Vector2(2906, 4086)
|
||||||
|
scale = Vector2(4.47547, 4.07547)
|
||||||
|
|
||||||
|
[node name="BackDoor_Right" parent="Doors" instance=ExtResource("4_oukel")]
|
||||||
|
position = Vector2(3239, 4090)
|
||||||
|
rotation = -3.14159
|
||||||
|
scale = Vector2(4.47547, 4.07547)
|
||||||
|
|
||||||
|
[node name="pickable_t_shirt" parent="." instance=ExtResource("5_kahe8")]
|
||||||
|
position = Vector2(3586, 650)
|
||||||
|
rotation = 0.286545
|
||||||
|
|
||||||
|
[node name="Outside_Enemy" parent="." instance=ExtResource("7_qt4sv")]
|
||||||
|
position = Vector2(3939, 657)
|
||||||
|
|
||||||
|
[node name="Class_Enemy01" parent="." instance=ExtResource("7_qt4sv")]
|
||||||
|
position = Vector2(2248, 1257)
|
||||||
|
|
||||||
|
[node name="Class_Enemy02" parent="." instance=ExtResource("7_qt4sv")]
|
||||||
|
position = Vector2(2310, 1138)
|
||||||
|
|
||||||
|
[node name="Class_Enemy03" parent="." instance=ExtResource("7_qt4sv")]
|
||||||
|
position = Vector2(2367, 1350)
|
||||||
|
|
||||||
|
[node name="shoes" parent="." instance=ExtResource("8_qnb3g")]
|
||||||
|
position = Vector2(2595, 969)
|
||||||
|
|
||||||
|
[connection signal="picked" from="pickable_t_shirt" to="." method="_on_pickable_t_shirt_picked"]
|
||||||
|
[connection signal="is_killed" from="Outside_Enemy" to="." method="_on_outside_enemy_is_killed"]
|
||||||
|
[connection signal="picked" from="shoes" to="." method="_on_shoes_picked"]
|
||||||
|
29
OTHERS/door.tscn
Normal file
29
OTHERS/door.tscn
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://chhokm3rf6pd3"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://q82l3e6t4whv" path="res://Sprites/HAHAHAs.png" id="1_6fehd"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_76cdb"]
|
||||||
|
size = Vector2(63, 7)
|
||||||
|
|
||||||
|
[node name="Door" type="StaticBody2D"]
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
position = Vector2(0, 6)
|
||||||
|
scale = Vector2(0.279902, 0.279902)
|
||||||
|
texture = ExtResource("1_6fehd")
|
||||||
|
|
||||||
|
[node name="Sprite2D2" type="Sprite2D" parent="."]
|
||||||
|
position = Vector2(-8, 3)
|
||||||
|
rotation = 0.0752773
|
||||||
|
scale = Vector2(0.245176, 0.245176)
|
||||||
|
texture = ExtResource("1_6fehd")
|
||||||
|
|
||||||
|
[node name="Sprite2D3" type="Sprite2D" parent="."]
|
||||||
|
position = Vector2(14, 11)
|
||||||
|
rotation = -0.215964
|
||||||
|
scale = Vector2(0.222094, 0.310601)
|
||||||
|
texture = ExtResource("1_6fehd")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2(0.5, 0.5)
|
||||||
|
shape = SubResource("RectangleShape2D_76cdb")
|
@ -9,4 +9,7 @@ func _on_body_entered(body):
|
|||||||
|
|
||||||
func pickup_routine(player):
|
func pickup_routine(player):
|
||||||
player.pickup(self);
|
player.pickup(self);
|
||||||
|
emit_signal("picked");
|
||||||
queue_free();
|
queue_free();
|
||||||
|
|
||||||
|
signal picked();
|
||||||
|
@ -6,6 +6,10 @@ extends CharacterBody2D
|
|||||||
@export var HP = 100;
|
@export var HP = 100;
|
||||||
|
|
||||||
@onready var raycast = $RayCast2D;
|
@onready var raycast = $RayCast2D;
|
||||||
|
@onready var sprite = $AnimatedSprite2D;
|
||||||
|
|
||||||
|
var animation_count = 0;
|
||||||
|
|
||||||
var current_weapon = null;
|
var current_weapon = null;
|
||||||
var weapons = [null,null,null];
|
var weapons = [null,null,null];
|
||||||
|
|
||||||
@ -40,9 +44,11 @@ func attack():
|
|||||||
current_weapon.fire(velocity);
|
current_weapon.fire(velocity);
|
||||||
|
|
||||||
func take_damage(damage):
|
func take_damage(damage):
|
||||||
HP = HP - damage;
|
if sprite.animation != "damage":
|
||||||
if HP <= 0:
|
HP = HP - damage;
|
||||||
kill();
|
sprite.play("damage");
|
||||||
|
if HP <= 0:
|
||||||
|
kill();
|
||||||
|
|
||||||
func pickup(item):
|
func pickup(item):
|
||||||
if item.Type == "weapon":
|
if item.Type == "weapon":
|
||||||
@ -87,3 +93,11 @@ func _on_area_2d_area_exited(area):
|
|||||||
$"../School_Bass".volume_db(-80);
|
$"../School_Bass".volume_db(-80);
|
||||||
$"../School_Flute".volume_db(-80);
|
$"../School_Flute".volume_db(-80);
|
||||||
$"../School_Brass".volume_db(-80);
|
$"../School_Brass".volume_db(-80);
|
||||||
|
|
||||||
|
|
||||||
|
func _on_animated_sprite_2d_animation_finished():
|
||||||
|
if sprite.animation == "damage":
|
||||||
|
animation_count+=1;
|
||||||
|
if animation_count > 3:
|
||||||
|
animation_count = 0;
|
||||||
|
sprite.play("default");
|
||||||
|
@ -8,6 +8,17 @@ animations = [{
|
|||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": ExtResource("2_bqbmq")
|
"texture": ExtResource("2_bqbmq")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": null
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"damage",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": ExtResource("2_bqbmq")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"default",
|
"name": &"default",
|
||||||
@ -39,3 +50,5 @@ visible = false
|
|||||||
points = PackedVector2Array(0, 0, 2000, 0)
|
points = PackedVector2Array(0, 0, 2000, 0)
|
||||||
width = 5.0
|
width = 5.0
|
||||||
default_color = Color(1, 0, 0, 0.392157)
|
default_color = Color(1, 0, 0, 0.392157)
|
||||||
|
|
||||||
|
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"]
|
||||||
|
BIN
Sprites/Door_1.png
Normal file
BIN
Sprites/Door_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 407 B |
34
Sprites/Door_1.png.import
Normal file
34
Sprites/Door_1.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://de3lmcqcag5ay"
|
||||||
|
path="res://.godot/imported/Door_1.png-0b82fd4258b936d355687545c7459cb5.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Sprites/Door_1.png"
|
||||||
|
dest_files=["res://.godot/imported/Door_1.png-0b82fd4258b936d355687545c7459cb5.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
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
|
BIN
Sprites/HAHAHAs.png
Normal file
BIN
Sprites/HAHAHAs.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
34
Sprites/HAHAHAs.png.import
Normal file
34
Sprites/HAHAHAs.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://q82l3e6t4whv"
|
||||||
|
path="res://.godot/imported/HAHAHAs.png-120240e91c027940086d629e54ae02e0.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Sprites/HAHAHAs.png"
|
||||||
|
dest_files=["res://.godot/imported/HAHAHAs.png-120240e91c027940086d629e54ae02e0.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
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
|
Loading…
Reference in New Issue
Block a user