feat: arrows and stuff
This commit is contained in:
36
arrow/arrow.gd
Normal file
36
arrow/arrow.gd
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
extends RigidBody2D
|
||||||
|
|
||||||
|
@onready var area_2d: Area2D = $Area2D
|
||||||
|
@onready var kill_after: Timer = $KillAfter
|
||||||
|
|
||||||
|
@export var speed = 100
|
||||||
|
@export var rotation_speed = 1
|
||||||
|
@export var jump_strength_on_death = 100
|
||||||
|
var is_moving = true
|
||||||
|
var first_frame_available = true
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
freeze = true
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
if is_moving:
|
||||||
|
position.x -= speed
|
||||||
|
else:
|
||||||
|
freeze = false
|
||||||
|
area_2d.monitoring = false
|
||||||
|
area_2d.monitorable = false
|
||||||
|
|
||||||
|
linear_velocity.x = 0
|
||||||
|
linear_velocity += get_gravity() * delta
|
||||||
|
angular_velocity = rotation_speed
|
||||||
|
|
||||||
|
if first_frame_available:
|
||||||
|
apply_impulse(Vector2.UP * jump_strength_on_death)
|
||||||
|
first_frame_available = false
|
||||||
|
|
||||||
|
func _on_kill_after_timeout() -> void:
|
||||||
|
queue_free()
|
||||||
|
|
||||||
|
func _on_body_entered(body: Node) -> void:
|
||||||
|
is_moving = false
|
||||||
|
kill_after.start()
|
1
arrow/arrow.gd.uid
Normal file
1
arrow/arrow.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://127t4dvlp6tv
|
48
arrow/arrow.tscn
Normal file
48
arrow/arrow.tscn
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
[gd_scene load_steps=6 format=3 uid="uid://4bfkbcr7v8tj"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://127t4dvlp6tv" path="res://arrow/arrow.gd" id="1_d2qln"]
|
||||||
|
[ext_resource type="Script" uid="uid://dt2lsk3je41th" path="res://damageable/hitbox.gd" id="2_d2qln"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://lhq6h8f81qrr" path="res://player/assets/Fleche.png" id="2_ofxgm"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_d2qln"]
|
||||||
|
size = Vector2(2, 2)
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_yaehf"]
|
||||||
|
size = Vector2(12, 5)
|
||||||
|
|
||||||
|
[node name="Arrow" type="RigidBody2D"]
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 0
|
||||||
|
freeze_mode = 1
|
||||||
|
linear_velocity = Vector2(-100, 0)
|
||||||
|
script = ExtResource("1_d2qln")
|
||||||
|
speed = 1
|
||||||
|
rotation_speed = 10
|
||||||
|
jump_strength_on_death = 500
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_d2qln")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("2_ofxgm")
|
||||||
|
region_rect = Rect2(717, 6, 35, 9)
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
collision_layer = 4
|
||||||
|
collision_mask = 5
|
||||||
|
script = ExtResource("2_d2qln")
|
||||||
|
hitback_direction = Vector2(-1, -1)
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||||
|
position = Vector2(1, 0.5)
|
||||||
|
shape = SubResource("RectangleShape2D_yaehf")
|
||||||
|
|
||||||
|
[node name="KillAfter" type="Timer" parent="."]
|
||||||
|
wait_time = 3.0
|
||||||
|
one_shot = true
|
||||||
|
ignore_time_scale = true
|
||||||
|
|
||||||
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||||
|
[connection signal="body_entered" from="Area2D" to="Area2D" method="_on_body_entered"]
|
||||||
|
[connection signal="body_entered" from="Area2D" to="." method="_on_body_entered"]
|
||||||
|
[connection signal="timeout" from="KillAfter" to="." method="_on_kill_after_timeout"]
|
10
arrow/arrow_spawner.gd
Normal file
10
arrow/arrow_spawner.gd
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
@export var arrow_scene: PackedScene
|
||||||
|
@onready var spawn_timing: Timer = $SpawnTiming
|
||||||
|
|
||||||
|
|
||||||
|
func _on_spawn_timing_timeout() -> void:
|
||||||
|
var arrow: Node2D = arrow_scene.instantiate()
|
||||||
|
arrow.global_position = global_position
|
||||||
|
add_sibling(arrow)
|
1
arrow/arrow_spawner.gd.uid
Normal file
1
arrow/arrow_spawner.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://bej0paudsyd7h
|
14
arrow/arrow_spawner.tscn
Normal file
14
arrow/arrow_spawner.tscn
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://c5tp7c70qkxe3"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bej0paudsyd7h" path="res://arrow/arrow_spawner.gd" id="1_7je20"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://4bfkbcr7v8tj" path="res://arrow/arrow.tscn" id="2_ek028"]
|
||||||
|
|
||||||
|
[node name="ArrowSpawner" type="Node2D"]
|
||||||
|
script = ExtResource("1_7je20")
|
||||||
|
arrow_scene = ExtResource("2_ek028")
|
||||||
|
|
||||||
|
[node name="SpawnTiming" type="Timer" parent="."]
|
||||||
|
wait_time = 3.0
|
||||||
|
autostart = true
|
||||||
|
|
||||||
|
[connection signal="timeout" from="SpawnTiming" to="." method="_on_spawn_timing_timeout"]
|
18
main.tscn
18
main.tscn
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=30 format=4 uid="uid://s1cx1gvt4bed"]
|
[gd_scene load_steps=32 format=4 uid="uid://s1cx1gvt4bed"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cvtt52wodbopm" path="res://main.gd" id="1_272bh"]
|
[ext_resource type="Script" uid="uid://cvtt52wodbopm" path="res://main.gd" id="1_272bh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://yvp44oauis4n" path="res://player/player.tscn" id="1_ig7tw"]
|
[ext_resource type="PackedScene" uid="uid://yvp44oauis4n" path="res://player/player.tscn" id="1_ig7tw"]
|
||||||
@ -13,6 +13,7 @@
|
|||||||
[ext_resource type="TileSet" uid="uid://tyrwsjeq31vu" path="res://world_assets/bubbles.tres" id="6_7mycd"]
|
[ext_resource type="TileSet" uid="uid://tyrwsjeq31vu" path="res://world_assets/bubbles.tres" id="6_7mycd"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c5ruphrd8ebuu" path="res://ennemy/armored_ennemy.tscn" id="9_kek77"]
|
[ext_resource type="PackedScene" uid="uid://c5ruphrd8ebuu" path="res://ennemy/armored_ennemy.tscn" id="9_kek77"]
|
||||||
[ext_resource type="Texture2D" uid="uid://deu2palri4pji" path="res://ui/kenney_1-bit-input-prompts-pixel-16/tilemap_white.png" id="10_efxa6"]
|
[ext_resource type="Texture2D" uid="uid://deu2palri4pji" path="res://ui/kenney_1-bit-input-prompts-pixel-16/tilemap_white.png" id="10_efxa6"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c5tp7c70qkxe3" path="res://arrow/arrow_spawner.tscn" id="15_vivmo"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ycdy4"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ycdy4"]
|
||||||
atlas = ExtResource("3_dg77c")
|
atlas = ExtResource("3_dg77c")
|
||||||
@ -248,6 +249,8 @@ _data = {
|
|||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ycdy4"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ycdy4"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_w48qg"]
|
||||||
|
|
||||||
[node name="Main" type="Node2D"]
|
[node name="Main" type="Node2D"]
|
||||||
script = ExtResource("1_272bh")
|
script = ExtResource("1_272bh")
|
||||||
parallax_far = 0.5
|
parallax_far = 0.5
|
||||||
@ -335,7 +338,7 @@ minimum_location = 2720
|
|||||||
maximum_location = 3500
|
maximum_location = 3500
|
||||||
|
|
||||||
[node name="NPC" type="AnimatedSprite2D" parent="."]
|
[node name="NPC" type="AnimatedSprite2D" parent="."]
|
||||||
position = Vector2(2151, -28)
|
position = Vector2(2080, -28)
|
||||||
sprite_frames = SubResource("SpriteFrames_ryguw")
|
sprite_frames = SubResource("SpriteFrames_ryguw")
|
||||||
animation = &"idle"
|
animation = &"idle"
|
||||||
autoplay = "idle"
|
autoplay = "idle"
|
||||||
@ -446,6 +449,17 @@ collision_mask = 2
|
|||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="TriggerNPCFirstDialogue"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="TriggerNPCFirstDialogue"]
|
||||||
shape = SubResource("RectangleShape2D_ycdy4")
|
shape = SubResource("RectangleShape2D_ycdy4")
|
||||||
|
|
||||||
|
[node name="ArrowBlocker" type="StaticBody2D" parent="."]
|
||||||
|
position = Vector2(2399, -13)
|
||||||
|
collision_layer = 4
|
||||||
|
collision_mask = 4
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="ArrowBlocker"]
|
||||||
|
shape = SubResource("RectangleShape2D_w48qg")
|
||||||
|
|
||||||
|
[node name="ArrowSpawner" parent="." instance=ExtResource("15_vivmo")]
|
||||||
|
position = Vector2(3392, -8)
|
||||||
|
|
||||||
[connection signal="dialogue_ended" from="OpeningDialogue" to="Player" method="_on_dialogue_manager_dialogue_ended"]
|
[connection signal="dialogue_ended" from="OpeningDialogue" to="Player" method="_on_dialogue_manager_dialogue_ended"]
|
||||||
[connection signal="dialogue_ended" from="NPCFirstDialogue" to="Player" method="_on_dialogue_manager_dialogue_ended"]
|
[connection signal="dialogue_ended" from="NPCFirstDialogue" to="Player" method="_on_dialogue_manager_dialogue_ended"]
|
||||||
[connection signal="body_entered" from="TriggerNPCFirstDialogue" to="NPCFirstDialogue" method="_on_body_entered_trigger_dialogue"]
|
[connection signal="body_entered" from="TriggerNPCFirstDialogue" to="NPCFirstDialogue" method="_on_body_entered_trigger_dialogue"]
|
||||||
|
BIN
player/assets/Bouclier.png
(Stored with Git LFS)
Normal file
BIN
player/assets/Bouclier.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
player/assets/Bouclier.png.import
Normal file
34
player/assets/Bouclier.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bfxgjrja1ah60"
|
||||||
|
path="res://.godot/imported/Bouclier.png-e7c965646f348bf410efb0824b431e45.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://player/assets/Bouclier.png"
|
||||||
|
dest_files=["res://.godot/imported/Bouclier.png-e7c965646f348bf410efb0824b431e45.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
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/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
player/assets/Défense.png
(Stored with Git LFS)
Normal file
BIN
player/assets/Défense.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
player/assets/Défense.png.import
Normal file
34
player/assets/Défense.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dcyawv770lkhp"
|
||||||
|
path="res://.godot/imported/Défense.png-c9911fdbdfe0bbcdb6f1b11801052875.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://player/assets/Défense.png"
|
||||||
|
dest_files=["res://.godot/imported/Défense.png-c9911fdbdfe0bbcdb6f1b11801052875.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
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/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
player/assets/Epee.png
(Stored with Git LFS)
Normal file
BIN
player/assets/Epee.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
player/assets/Epee.png.import
Normal file
34
player/assets/Epee.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://db3oaynrhd7wg"
|
||||||
|
path="res://.godot/imported/Epee.png-2f948674a42be1d4f0f32c5289e9c5d8.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://player/assets/Epee.png"
|
||||||
|
dest_files=["res://.godot/imported/Epee.png-2f948674a42be1d4f0f32c5289e9c5d8.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
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/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
player/assets/Fleche.png
(Stored with Git LFS)
Normal file
BIN
player/assets/Fleche.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
player/assets/Fleche.png.import
Normal file
34
player/assets/Fleche.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://lhq6h8f81qrr"
|
||||||
|
path="res://.godot/imported/Fleche.png-fd23037ecccb3463f4413f9430b058a1.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://player/assets/Fleche.png"
|
||||||
|
dest_files=["res://.godot/imported/Fleche.png-fd23037ecccb3463f4413f9430b058a1.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
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/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
player/assets/Stab .png
(Stored with Git LFS)
Normal file
BIN
player/assets/Stab .png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
player/assets/Stab .png.import
Normal file
34
player/assets/Stab .png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://d2rfo6ilwusak"
|
||||||
|
path="res://.godot/imported/Stab .png-066cf9b96545ad05213c48d15dd6666a.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://player/assets/Stab .png"
|
||||||
|
dest_files=["res://.godot/imported/Stab .png-066cf9b96545ad05213c48d15dd6666a.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
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/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
|
Reference in New Issue
Block a user