diff --git a/ouch-x86_64-linux-musl b/ouch-x86_64-linux-musl new file mode 100755 index 0000000..fa39006 Binary files /dev/null and b/ouch-x86_64-linux-musl differ diff --git a/scenes/effects/attack_swooshy/pierce.tscn b/scenes/effects/attack_swooshy/pierce.tscn new file mode 100644 index 0000000..f17343e --- /dev/null +++ b/scenes/effects/attack_swooshy/pierce.tscn @@ -0,0 +1,63 @@ +[gd_scene format=3 uid="uid://cll52paotcjr7"] + +[ext_resource type="Texture2D" uid="uid://n3qlhp2lbgfd" path="res://textures/pierce.png" id="1_ye47h"] +[ext_resource type="Script" uid="uid://d26yt0riuggb4" path="res://scripts/effects/slash.gd" id="2_sysig"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_sysig"] +atlas = ExtResource("1_ye47h") +region = Rect2(0, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ln4oc"] +atlas = ExtResource("1_ye47h") +region = Rect2(48, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_77j1u"] +atlas = ExtResource("1_ye47h") +region = Rect2(96, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_d0p3v"] +atlas = ExtResource("1_ye47h") +region = Rect2(144, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8ses3"] +atlas = ExtResource("1_ye47h") +region = Rect2(192, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8tm8q"] +atlas = ExtResource("1_ye47h") +region = Rect2(240, 0, 48, 48) + +[sub_resource type="SpriteFrames" id="SpriteFrames_jqp4x"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_sysig") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ln4oc") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_77j1u") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_d0p3v") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_8ses3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_8tm8q") +}], +"loop": false, +"name": &"default", +"speed": 24.0 +}] + +[node name="Pierce" type="AnimatedSprite3D" unique_id=1787289120] +transform = Transform3D(-1.5, -8.742278e-08, -3.821371e-15, 0, -4.371139e-08, 1, -1.3113416e-07, 1, 4.371139e-08, 0, 0, 0) +pixel_size = 0.04 +texture_filter = 0 +sprite_frames = SubResource("SpriteFrames_jqp4x") +frame = 5 +frame_progress = 1.0 +script = ExtResource("2_sysig") diff --git a/scenes/effects/slash.tscn b/scenes/effects/attack_swooshy/slash.tscn similarity index 100% rename from scenes/effects/slash.tscn rename to scenes/effects/attack_swooshy/slash.tscn diff --git a/scenes/game.tscn b/scenes/game.tscn index 7992309..fd542e7 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -25,6 +25,7 @@ cell_size = 0.05 cell_height = 0.05 [sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_yqjtg"] +auto_exposure_scale = 0.3 [sub_resource type="SphereShape3D" id="SphereShape3D_kvuet"] radius = 0.001 @@ -41,7 +42,7 @@ size = Vector3(0.65, 1, 0.65) [sub_resource type="Environment" id="Environment_uwrxv"] background_mode = 1 -background_color = Color(1, 1, 1, 1) +background_color = Color(0.15027824, 1.627421e-05, 0.15027693, 1) tonemap_mode = 2 volumetric_fog_enabled = true adjustment_enabled = true @@ -332,7 +333,7 @@ collision_layer = 0 collision_mask = 2 [node name="Shape" type="CollisionShape3D" parent="Player/HitCollision" unique_id=653786925] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 0, 0) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.6, 0, 0) shape = SubResource("BoxShape3D_0tnpc") [node name="DreamerBody" parent="Player" unique_id=723408850 instance=ExtResource("4_p57ef")] diff --git a/scenes/inhands/basic_spear.tscn b/scenes/inhands/basic_spear.tscn new file mode 100644 index 0000000..8c32754 --- /dev/null +++ b/scenes/inhands/basic_spear.tscn @@ -0,0 +1,11 @@ +[gd_scene format=3 uid="uid://cq8a8t5g3nko3"] + +[ext_resource type="Texture2D" uid="uid://b5g7bhk0kj16" path="res://textures/weapons/inhands/basic_spear.png" id="1_titaa"] + +[node name="Sword" type="Sprite3D" unique_id=1724644759] +offset = Vector2(0, 9.5) +pixel_size = 0.03 +shaded = true +alpha_cut = 2 +texture_filter = 0 +texture = ExtResource("1_titaa") diff --git a/scripts/enemies/dreamer.gd b/scripts/enemies/dreamer.gd index 22f2653..b02515f 100644 --- a/scripts/enemies/dreamer.gd +++ b/scripts/enemies/dreamer.gd @@ -135,7 +135,7 @@ func _physics_process(delta: float) -> void: state = STATE_ATTACK $DreamerBody/Animator.set("parameters/swing_weapon/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE) - var slash = load("res://scenes/effects/slash.tscn").instantiate() + var slash = Global.effects.attack_swooshy.slash.instantiate() game.add_child(slash) slash.global_position = global_position slash.global_rotation.y = $HitCollision.global_rotation.y + deg_to_rad(90) @@ -155,10 +155,10 @@ func _physics_process(delta: float) -> void: $DreamerBody/Animator.set("parameters/hit/blend_amount", 1.0) $DreamerBody/Animator.set("parameters/dead/blend_amount", 0.0) - if (health <= 0) and ((state_timer <= 0) or is_on_floor()): - state = STATE_DEAD - - if state_timer <= 0: + if health <= 0: + if (state_timer <= 0) or is_on_floor(): + state = STATE_DEAD + elif state_timer <= 0: $DreamerBody/Animator.set("parameters/hit/blend_amount", 0.0) state = STATE_APPROACH_ENEMY diff --git a/scripts/global.gd b/scripts/global.gd index 317d082..40a5b32 100644 --- a/scripts/global.gd +++ b/scripts/global.gd @@ -13,6 +13,11 @@ const weapons = { "knockback": 3.5, "knockback_mid_combo": 0.75, "stun_time": 0.4, + + "range": 1.2, + "width": 1.3, + + "attack_swooshy": "slash", }, "basic_knife": { "combo_weapon": true, @@ -26,6 +31,12 @@ const weapons = { "knockback": 2.5, "knockback_mid_combo": 0.3, "stun_time": 0.4, + + "range": 1, + "width": 1, + + "attack_swooshy": "slash", + "attack_swooshy_scale": Vector3(0.8, 0.6, 1), }, "basic_hammer": { "combo_weapon": true, @@ -39,11 +50,44 @@ const weapons = { "knockback": 5.5, "knockback_mid_combo": 1.5, "stun_time": 0.6, - } + + "range": 1.2, + "width": 1.3, + + "attack_swooshy": "pierce", + }, + + "basic_spear": { + "combo_weapon": true, + "hits_to_finish": 3, + "swing_time": 0.16, + "combo_timeout": 0.35, + "swing_time_combo_finish": 0.55, + "damage": 10, + "damage_mid_combo": 7, + + "knockback": 3.5, + "knockback_mid_combo": 0.75, + "stun_time": 0.4, + + "range": 1.75, + "width": 0.7, + + "attack_swooshy": "pierce", + "attack_swooshy_scale": Vector3(1.5, 1, 1), + }, } const inhands = { "basic_sword": preload("res://scenes/inhands/basic_sword.tscn"), "basic_hammer": preload("res://scenes/inhands/basic_hammer.tscn"), - "basic_knife": preload("res://scenes/inhands/basic_knife.tscn") + "basic_knife": preload("res://scenes/inhands/basic_knife.tscn"), + "basic_spear": preload("res://scenes/inhands/basic_spear.tscn") +} + +const effects = { + "attack_swooshy": { + "slash": preload("res://scenes/effects/attack_swooshy/slash.tscn"), + "pierce": preload("res://scenes/effects/attack_swooshy/pierce.tscn") + } } diff --git a/scripts/player.gd b/scripts/player.gd index 418612f..99eebda 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -43,10 +43,22 @@ func on_hit(hitter: Node3D = null) -> void: knockback_time = 0.25 velocity += hitter.global_position.direction_to(global_position) * 8 velocity.y = 0 + +func set_weapon(weapon_name: String = "basic_sword") -> void: + current_weapon = weapon_name + $DreamerBody.set_inhand(current_weapon) + + var range = get_weapon_info(current_weapon, "range") + var width = get_weapon_info(current_weapon, "width") + + $HitCollision/Shape.shape.size = Vector3(range, 1.0, width) + + $HitCollision/Shape.position.x = range * -0.5 func _ready() -> void: LimboConsole.register_command(hit_me) - $DreamerBody.set_inhand(current_weapon) + LimboConsole.register_command(set_weapon) + set_weapon(current_weapon) func _process(delta: float) -> void: @@ -84,24 +96,25 @@ func _physics_process(delta: float) -> void: var mouse_point_angle = player_position.angle_to_point(get_viewport().get_mouse_position()) if combatable: - $HitCollision.rotation.y = -mouse_point_angle + face_rotation + if ((swing_timer <= 0) or (combo_hits < 0)): + $HitCollision.rotation.y = -mouse_point_angle + face_rotation - if abs(rad_to_deg(mouse_point_angle) - (-90)) < 50: - $HitCollision/Shape.shape.size.x = 1.5 - else: - $HitCollision/Shape.shape.size.x = 1.2 - - if (rad_to_deg(mouse_point_angle) < -90) or (rad_to_deg(mouse_point_angle) > 90): - face_left = true + if abs(rad_to_deg(mouse_point_angle) - (-90)) < 50: + $HitCollision/Shape.shape.size.x = 1.5 + else: + $HitCollision/Shape.shape.size.x = 1.2 - var mouse_pos = get_viewport().get_mouse_position() - mouse_pos.y = (viewport_half.y) + ((viewport_half.y) - mouse_pos.y) - - #$DreamerBody/Body/ArmPivot.rotation.z = viewport_half.angle_to_point(mouse_pos) - else: - face_left = false - $DreamerBody/Body/ArmPivot.scale.y = 1 - $DreamerBody/Body/ArmPivot.scale.x = 1 + if (rad_to_deg(mouse_point_angle) < -90) or (rad_to_deg(mouse_point_angle) > 90): + face_left = true + + var mouse_pos = get_viewport().get_mouse_position() + mouse_pos.y = (viewport_half.y) + ((viewport_half.y) - mouse_pos.y) + + #$DreamerBody/Body/ArmPivot.rotation.z = viewport_half.angle_to_point(mouse_pos) + else: + face_left = false + $DreamerBody/Body/ArmPivot.scale.y = 1 + $DreamerBody/Body/ArmPivot.scale.x = 1 $DreamerBody/Animator.set("parameters/hold_weapon/blend_amount", 1.0) else: @@ -141,13 +154,19 @@ func _physics_process(delta: float) -> void: if swing_timer == null: swing_timer = 0.0 if combo_timer == null: combo_timer = 0.0 - combo_hits += 1 + var swooshy_id = get_my_weapon_info("attack_swooshy") + if not swooshy_id: swooshy_id = "slash" - var slash = load("res://scenes/effects/slash.tscn").instantiate() - game.add_child(slash) - slash.global_position = global_position - slash.global_rotation.y = $HitCollision.global_rotation.y + deg_to_rad(180) - slash.play_effect() + + var attack_swooshy = Global.effects.attack_swooshy[swooshy_id].instantiate() + game.add_child(attack_swooshy) + + var attack_swooshy_scale = get_my_weapon_info("attack_swooshy_scale") + if attack_swooshy_scale: attack_swooshy.scale = attack_swooshy_scale + + attack_swooshy.global_position = global_position + attack_swooshy.global_rotation.y = $HitCollision.global_rotation.y + deg_to_rad(180) + attack_swooshy.play_effect() $DreamerBody/Animator.set("parameters/swing_weapon/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE) @@ -156,7 +175,21 @@ func _physics_process(delta: float) -> void: var knockback = 0 var damage = 0 + velocity = global_position.direction_to($HitCollision/Shape.global_position) * 4 + velocity.y = 0 + if get_my_weapon_info("combo_weapon"): + var earned_combo_hit = false + + for body in hits: + if body == self: continue + + if ("health" in body) and (body.health > 0): + earned_combo_hit = true + + if earned_combo_hit: combo_hits += 1 + else: combo_hits = 0 + if combo_hits < get_my_weapon_info("hits_to_finish"): damage = get_my_weapon_info("damage_mid_combo") knockback = get_my_weapon_info("knockback_mid_combo") @@ -204,7 +237,7 @@ func _physics_process(delta: float) -> void: damage_text.get_node("Label").text = str(floor(damage)) var direction = (camera.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() - if direction and (knockback_time <= 0): + if direction and (knockback_time <= 0) and (swing_timer <= 0): velocity.x = direction.x * SPEED velocity.z = direction.z * SPEED diff --git a/textures/pierce.ase b/textures/pierce.ase new file mode 100644 index 0000000..215bdd7 Binary files /dev/null and b/textures/pierce.ase differ diff --git a/textures/pierce.png b/textures/pierce.png new file mode 100644 index 0000000..3db9768 Binary files /dev/null and b/textures/pierce.png differ diff --git a/textures/pierce.png.import b/textures/pierce.png.import new file mode 100644 index 0000000..81bf989 --- /dev/null +++ b/textures/pierce.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://n3qlhp2lbgfd" +path="res://.godot/imported/pierce.png-c457f33d8ab80ac399d54cda9022be2d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://textures/pierce.png" +dest_files=["res://.godot/imported/pierce.png-c457f33d8ab80ac399d54cda9022be2d.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=0