diff --git a/.import/Arrow.png-b56f04d1758996141f2ed93e732b5504.md5 b/.import/Arrow.png-b56f04d1758996141f2ed93e732b5504.md5 new file mode 100644 index 0000000..8d85a39 --- /dev/null +++ b/.import/Arrow.png-b56f04d1758996141f2ed93e732b5504.md5 @@ -0,0 +1,3 @@ +source_md5="97a1aad633916f32016c83d8e6d26c85" +dest_md5="5f230eceb13bee0eb1f9668d48296c23" + diff --git a/.import/Arrow.png-b56f04d1758996141f2ed93e732b5504.stex b/.import/Arrow.png-b56f04d1758996141f2ed93e732b5504.stex new file mode 100644 index 0000000..1152c61 Binary files /dev/null and b/.import/Arrow.png-b56f04d1758996141f2ed93e732b5504.stex differ diff --git a/.import/Crossbow.png-1c44d5a236fb4e3633b253c8aa061ca9.md5 b/.import/Crossbow.png-1c44d5a236fb4e3633b253c8aa061ca9.md5 new file mode 100644 index 0000000..cec7ded --- /dev/null +++ b/.import/Crossbow.png-1c44d5a236fb4e3633b253c8aa061ca9.md5 @@ -0,0 +1,3 @@ +source_md5="267539b6fe85a306ba3094d840700091" +dest_md5="c1ce6c9d1400ca0fcd5281b7209524ed" + diff --git a/.import/Crossbow.png-1c44d5a236fb4e3633b253c8aa061ca9.stex b/.import/Crossbow.png-1c44d5a236fb4e3633b253c8aa061ca9.stex new file mode 100644 index 0000000..fc1dc3f Binary files /dev/null and b/.import/Crossbow.png-1c44d5a236fb4e3633b253c8aa061ca9.stex differ diff --git a/Art/Arrow.png b/Art/Arrow.png new file mode 100644 index 0000000..c73a5b3 Binary files /dev/null and b/Art/Arrow.png differ diff --git a/Art/Arrow.png.import b/Art/Arrow.png.import new file mode 100644 index 0000000..d7d4e0d --- /dev/null +++ b/Art/Arrow.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Arrow.png-b56f04d1758996141f2ed93e732b5504.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/Arrow.png" +dest_files=[ "res://.import/Arrow.png-b56f04d1758996141f2ed93e732b5504.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/Art/Crossbow.png b/Art/Crossbow.png new file mode 100644 index 0000000..0211dfb Binary files /dev/null and b/Art/Crossbow.png differ diff --git a/Art/Crossbow.png.import b/Art/Crossbow.png.import new file mode 100644 index 0000000..dbee66d --- /dev/null +++ b/Art/Crossbow.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Crossbow.png-1c44d5a236fb4e3633b253c8aa061ca9.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/Crossbow.png" +dest_files=[ "res://.import/Crossbow.png-1c44d5a236fb4e3633b253c8aa061ca9.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/Characters/Enemies/Goblin/Goblin.gd b/Characters/Enemies/Goblin/Goblin.gd index a8c27cd..097ad65 100644 --- a/Characters/Enemies/Goblin/Goblin.gd +++ b/Characters/Enemies/Goblin/Goblin.gd @@ -1,6 +1,6 @@ extends Enemy -const THROWABLE_KNIFE_SCENE: PackedScene = preload("res://Characters/Enemies/Goblin/ThrowableKnike.tscn") +const THROWABLE_KNIFE_SCENE: PackedScene = preload("res://Characters/Enemies/Goblin/ThrowableKnife.tscn") const MAX_DISTANCE_TO_PLAYER: int = 80 const MIN_DISTANCE_TO_PLAYER: int = 40 diff --git a/Characters/Enemies/Goblin/ThrowableKnife.tscn b/Characters/Enemies/Goblin/ThrowableKnife.tscn new file mode 100644 index 0000000..8185d0f --- /dev/null +++ b/Characters/Enemies/Goblin/ThrowableKnife.tscn @@ -0,0 +1,5 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Weapons/Projectile.tscn" type="PackedScene" id=1] + +[node name="ThrowableKnife" instance=ExtResource( 1 )] diff --git a/Rooms/SpawnRoom1.tscn b/Rooms/SpawnRoom1.tscn index 060e210..b32ffd7 100644 --- a/Rooms/SpawnRoom1.tscn +++ b/Rooms/SpawnRoom1.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://Rooms/Room.tscn" type="PackedScene" id=1] [ext_resource path="res://Rooms/Furniture and Traps/Door.tscn" type="PackedScene" id=2] [ext_resource path="res://Rooms/Furniture and Traps/Torch.tscn" type="PackedScene" id=3] +[ext_resource path="res://Weapons/Crossbow.tscn" type="PackedScene" id=4] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 32, 24 ) @@ -33,3 +34,7 @@ position = Vector2( 56, 24 ) [node name="Torch2" parent="." index="10" instance=ExtResource( 3 )] position = Vector2( 168, 104 ) + +[node name="Crossbow" parent="." index="11" instance=ExtResource( 4 )] +position = Vector2( 166, 70 ) +on_floor = true diff --git a/Weapons/Arrow.tscn b/Weapons/Arrow.tscn new file mode 100644 index 0000000..2623aa2 --- /dev/null +++ b/Weapons/Arrow.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://Weapons/Projectile.tscn" type="PackedScene" id=1] +[ext_resource path="res://Art/Arrow.png" type="Texture" id=2] + +[sub_resource type="CapsuleShape2D" id=1] +resource_local_to_scene = true +radius = 1.41421 +height = 15.5564 + +[node name="Arrow" instance=ExtResource( 1 )] +collision_mask = 2 + +[node name="CollisionShape2D" parent="." index="0"] +shape = SubResource( 1 ) + +[node name="Sprite" parent="." index="1"] +texture = ExtResource( 2 ) diff --git a/Weapons/Crossbow.gd b/Weapons/Crossbow.gd new file mode 100644 index 0000000..bb32968 --- /dev/null +++ b/Weapons/Crossbow.gd @@ -0,0 +1,15 @@ +extends Weapon + +const ARROW_SCENE: PackedScene = preload("res://Weapons/Arrow.tscn") + + +func shoot(offset: int) -> void: + var arrow: Area2D = ARROW_SCENE.instance() + get_tree().current_scene.add_child(arrow) + arrow.launch(global_position, Vector2.LEFT.rotated(deg2rad(rotation_degrees + offset)), 400) + + +func triple_shoot() -> void: + shoot(0) + shoot(12) + shoot(-12) diff --git a/Weapons/Crossbow.tscn b/Weapons/Crossbow.tscn new file mode 100644 index 0000000..4f272af --- /dev/null +++ b/Weapons/Crossbow.tscn @@ -0,0 +1,234 @@ +[gd_scene load_steps=13 format=2] + +[ext_resource path="res://Weapons/Weapon.tscn" type="PackedScene" id=1] +[ext_resource path="res://Weapons/Crossbow.gd" type="Script" id=2] +[ext_resource path="res://Art/Crossbow.png" type="Texture" id=3] +[ext_resource path="res://Characters/Player/White.gdshader" type="Shader" id=4] +[ext_resource path="res://Art/19+ icons/iceB.png" type="Texture" id=5] + +[sub_resource type="ShaderMaterial" id=2] +resource_local_to_scene = true +shader = ExtResource( 4 ) +shader_param/active = false + +[sub_resource type="CapsuleShape2D" id=1] +radius = 7.0 +height = 2.0 + +[sub_resource type="Animation" id=7] +resource_name = "active_ability" +length = 0.6 +tracks/0/type = "value" +tracks/0/path = NodePath("Node2D/Sprite/ChargeParticles:emitting") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Node2D/Sprite:material:shader_param/active") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/2/type = "method" +tracks/2/path = NodePath(".") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0, 0.1 ), +"transitions": PoolRealArray( 1, 1 ), +"values": [ { +"args": [ ], +"method": "triple_shoot" +}, { +"args": [ ], +"method": "triple_shoot" +} ] +} + +[sub_resource type="Animation" id=3] +resource_local_to_scene = true +resource_name = "attack" +length = 0.5 +tracks/0/type = "value" +tracks/0/path = NodePath("Node2D/Sprite/ChargeParticles:emitting") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Node2D/Sprite:material:shader_param/active") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/2/type = "method" +tracks/2/path = NodePath(".") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"values": [ { +"args": [ 0 ], +"method": "shoot" +} ] +} + +[sub_resource type="Animation" id=4] +resource_local_to_scene = true +resource_name = "cancel_attack" +length = 0.3 +tracks/0/type = "value" +tracks/0/path = NodePath("Node2D/Sprite/ChargeParticles:emitting") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Node2D/Sprite:material:shader_param/active") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} + +[sub_resource type="Animation" id=5] +resource_local_to_scene = true +resource_name = "charge" +length = 1.2 +step = 0.2 +tracks/0/type = "value" +tracks/0/path = NodePath("Node2D/Sprite:material:shader_param/active") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0.2, 0.4, 0.6, 0.8, 1 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1 ), +"update": 1, +"values": [ true, false, true, false, true ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Node2D/Sprite/ChargeParticles:emitting") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 1.2 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} + +[sub_resource type="Animation" id=6] +resource_local_to_scene = true +resource_name = "strong_attack" +length = 0.7 +tracks/0/type = "value" +tracks/0/path = NodePath("Node2D/Sprite:material:shader_param/active") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Node2D/Sprite/ChargeParticles:emitting") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/2/type = "method" +tracks/2/path = NodePath(".") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"values": [ { +"args": [ ], +"method": "triple_shoot" +} ] +} + +[node name="Crossbow" instance=ExtResource( 1 )] +script = ExtResource( 2 ) +ranged_weapon = true +rotation_offset = 180 + +[node name="Sprite" parent="Node2D" index="0"] +material = SubResource( 2 ) +position = Vector2( 0, -3 ) +texture = ExtResource( 3 ) + +[node name="CollisionShape2D" parent="Node2D/Sprite/Hitbox" index="0"] +disabled = false + +[node name="CollisionShape2D" parent="PlayerDetector" index="0"] +position = Vector2( -9, -1 ) +rotation = 1.5708 +shape = SubResource( 1 ) + +[node name="AnimationPlayer" parent="." index="2"] +anims/active_ability = SubResource( 7 ) +anims/attack = SubResource( 3 ) +anims/cancel_attack = SubResource( 4 ) +anims/charge = SubResource( 5 ) +anims/strong_attack = SubResource( 6 ) + +[node name="AbilityIcon" parent="UI" index="0"] +texture_under = ExtResource( 5 ) diff --git a/Characters/Enemies/Goblin/ThrowableKnike.gd b/Weapons/Projectile.gd similarity index 91% rename from Characters/Enemies/Goblin/ThrowableKnike.gd rename to Weapons/Projectile.gd index 3d98750..1b7ccb8 100644 --- a/Characters/Enemies/Goblin/ThrowableKnike.gd +++ b/Weapons/Projectile.gd @@ -24,6 +24,8 @@ func _on_ThrowableKnike_body_exited(_body: KinematicBody) -> void: enemy_exited = true set_collision_mask_bit(0, true) set_collision_mask_bit(1, true) + set_collision_mask_bit(2, true) + set_collision_mask_bit(3, true) func _collide(body: KinematicBody2D) -> void: diff --git a/Characters/Enemies/Goblin/ThrowableKnike.tscn b/Weapons/Projectile.tscn similarity index 62% rename from Characters/Enemies/Goblin/ThrowableKnike.tscn rename to Weapons/Projectile.tscn index ade6195..17735dc 100644 --- a/Characters/Enemies/Goblin/ThrowableKnike.tscn +++ b/Weapons/Projectile.tscn @@ -1,22 +1,23 @@ [gd_scene load_steps=4 format=2] -[ext_resource path="res://Characters/Enemies/Goblin/ThrowableKnike.gd" type="Script" id=1] -[ext_resource path="res://Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_knife.png" type="Texture" id=2] +[ext_resource path="res://Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_knife.png" type="Texture" id=1] +[ext_resource path="res://Weapons/Projectile.gd" type="Script" id=2] [sub_resource type="CapsuleShape2D" id=1] +resource_local_to_scene = true radius = 1.41421 -height = 7.07107 +height = 15.5564 -[node name="ThrowableKnike" type="Area2D"] +[node name="Projectile" type="Area2D"] collision_layer = 8 collision_mask = 4 -script = ExtResource( 1 ) +script = ExtResource( 2 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] rotation = 0.785398 shape = SubResource( 1 ) [node name="Sprite" type="Sprite" parent="."] -texture = ExtResource( 2 ) +texture = ExtResource( 1 ) [connection signal="body_exited" from="." to="." method="_on_ThrowableKnike_body_exited"] diff --git a/Weapons/WarHammer.tscn b/Weapons/WarHammer.tscn index c8d35e9..2cbd370 100644 --- a/Weapons/WarHammer.tscn +++ b/Weapons/WarHammer.tscn @@ -259,6 +259,7 @@ damage = 2 [node name="CollisionShape2D" parent="Node2D/Sprite/Hitbox" index="0"] position = Vector2( 5, -4 ) shape = SubResource( 1 ) +disabled = false [node name="ChargeParticles" parent="Node2D/Sprite" index="1"] position = Vector2( 8, -7 ) diff --git a/Weapons/Weapon.gd b/Weapons/Weapon.gd index 106f94d..1d50a8b 100644 --- a/Weapons/Weapon.gd +++ b/Weapons/Weapon.gd @@ -3,6 +3,9 @@ class_name Weapon, "res://Art/v1.1 dungeon crawler 16x16 pixel pack/heroes/knigh export(bool) var on_floor: bool = false +export var ranged_weapon: bool = false +export var rotation_offset: int = 0 + var can_active_ability: bool = true onready var animation_player: AnimationPlayer = get_node("AnimationPlayer") @@ -37,13 +40,16 @@ func get_input() -> void: func move(mouse_direction: Vector2) -> void: - if not animation_player.is_playing() or animation_player.current_animation == "charge": - rotation = mouse_direction.angle() - hitbox.knockback_direction = mouse_direction - if scale.y == 1 and mouse_direction.x < 0: - scale.y = -1 - elif scale.y == -1 and mouse_direction.x > 0: - scale.y = 1 + if ranged_weapon: + rotation_degrees = rad2deg(mouse_direction.angle()) + rotation_offset + else: + if not animation_player.is_playing() or animation_player.current_animation == "charge": + rotation = mouse_direction.angle() + hitbox.knockback_direction = mouse_direction + if scale.y == 1 and mouse_direction.x < 0: + scale.y = -1 + elif scale.y == -1 and mouse_direction.x > 0: + scale.y = 1 func cancel_attack() -> void: diff --git a/Weapons/Weapon.tscn b/Weapons/Weapon.tscn index 3ff5bbb..c287819 100644 --- a/Weapons/Weapon.tscn +++ b/Weapons/Weapon.tscn @@ -251,11 +251,11 @@ tracks/4/keys = { script = ExtResource( 2 ) [node name="Node2D" type="Node2D" parent="."] -rotation = 6.63225 +rotation = -1.5708 [node name="Sprite" type="Sprite" parent="Node2D"] material = SubResource( 1 ) -rotation = 1.39626 +rotation = -0.785398 offset = Vector2( 5, -4 ) [node name="Hitbox" type="Area2D" parent="Node2D/Sprite"] diff --git a/export_presets.cfg b/export_presets.cfg index 5e412b3..861baa3 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -7,7 +7,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../../Downloads/Roguelike Tutorial.html" +export_path="../../../Downloads/Godot Roguelike Tutorial/Godot Roguelike.html" script_export_mode=1 script_encryption_key="" @@ -18,10 +18,20 @@ custom_template/release="" variant/export_type=0 vram_texture_compression/for_desktop=true vram_texture_compression/for_mobile=false +html/export_icon=true html/custom_html_shell="" html/head_include="" html/canvas_resize_policy=2 +html/focus_canvas_on_start=true html/experimental_virtual_keyboard=false +progressive_web_app/enabled=false +progressive_web_app/offline_page="" +progressive_web_app/display=1 +progressive_web_app/orientation=0 +progressive_web_app/icon_144x144="" +progressive_web_app/icon_180x180="" +progressive_web_app/icon_512x512="" +progressive_web_app/background_color=Color( 0, 0, 0, 1 ) [preset.1] @@ -32,7 +42,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../../Downloads/Roguelike Tutorial/Windows/Roguelike Tutorial.exe" +export_path="../../../Downloads/Godot Roguelike Tutorial/Roguelike Tutorial.exe" script_export_mode=1 script_encryption_key="" @@ -73,7 +83,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../../Downloads/Roguelike Tutorial/Linux/Roguelike Tutorial.x86_64" +export_path="../../../Downloads/Godot Roguelike Tutorial/Roguelike Tutorial Lin/Roguelike Tutorial.x86_64" script_export_mode=1 script_encryption_key=""