started work on arrows
This commit is contained in:
@@ -5,7 +5,6 @@
|
|||||||
[ext_resource type="Theme" uid="uid://bey4nvrdo2vy" path="res://Prefabs/DefaultTheme.tres" id="3_8uhk6"]
|
[ext_resource type="Theme" uid="uid://bey4nvrdo2vy" path="res://Prefabs/DefaultTheme.tres" id="3_8uhk6"]
|
||||||
|
|
||||||
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_ocbkm"]
|
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_ocbkm"]
|
||||||
dof_blur_far_enabled = true
|
|
||||||
dof_blur_far_distance = 15.0
|
dof_blur_far_distance = 15.0
|
||||||
dof_blur_near_enabled = true
|
dof_blur_near_enabled = true
|
||||||
dof_blur_near_distance = 6.0
|
dof_blur_near_distance = 6.0
|
||||||
|
|||||||
99
Prefabs/arrow.tscn
Normal file
99
Prefabs/arrow.tscn
Normal file
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=17 format=3 uid="uid://bacgd5lmvaxea"]
|
[gd_scene load_steps=19 format=3 uid="uid://bacgd5lmvaxea"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bcgt64gerg8pv" path="res://Scripts/player.gd" id="1_5wxv7"]
|
[ext_resource type="Script" uid="uid://bcgt64gerg8pv" path="res://Scripts/player.gd" id="1_5wxv7"]
|
||||||
[ext_resource type="Material" uid="uid://b4rpp31c0dx2m" path="res://Assets/Materials/BasicMat.tres" id="1_y6xdh"]
|
[ext_resource type="Material" uid="uid://b4rpp31c0dx2m" path="res://Assets/Materials/BasicMat.tres" id="1_y6xdh"]
|
||||||
@@ -6,7 +6,9 @@
|
|||||||
[ext_resource type="Script" uid="uid://c2xwiexy5b3b3" path="res://Scripts/player_attack.gd" id="3_knrd4"]
|
[ext_resource type="Script" uid="uid://c2xwiexy5b3b3" path="res://Scripts/player_attack.gd" id="3_knrd4"]
|
||||||
[ext_resource type="Script" uid="uid://wnisqyoyai2h" path="res://Scripts/player_on_floor.gd" id="4_hck1p"]
|
[ext_resource type="Script" uid="uid://wnisqyoyai2h" path="res://Scripts/player_on_floor.gd" id="4_hck1p"]
|
||||||
[ext_resource type="Script" uid="uid://dhnl0penaqfkx" path="res://Scripts/player_dodge_roll.gd" id="5_hck1p"]
|
[ext_resource type="Script" uid="uid://dhnl0penaqfkx" path="res://Scripts/player_dodge_roll.gd" id="5_hck1p"]
|
||||||
|
[ext_resource type="Script" uid="uid://255h63wdkwpv" path="res://Scripts/ranged_attack.gd" id="6_08u7w"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b12w4ut17srje" path="res://Assets/Models/Character1.blend" id="7_juxdh"]
|
[ext_resource type="PackedScene" uid="uid://b12w4ut17srje" path="res://Assets/Models/Character1.blend" id="7_juxdh"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bxye0cuxw1mbr" path="res://Prefabs/arrow.tscn" id="7_kgmex"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b4c4cu400yrgt" path="res://Assets/Models/SwordCursor.blend" id="8_4qbli"]
|
[ext_resource type="PackedScene" uid="uid://b4c4cu400yrgt" path="res://Assets/Models/SwordCursor.blend" id="8_4qbli"]
|
||||||
|
|
||||||
[sub_resource type="BoxMesh" id="BoxMesh_5wxv7"]
|
[sub_resource type="BoxMesh" id="BoxMesh_5wxv7"]
|
||||||
@@ -87,6 +89,8 @@ _data = {
|
|||||||
radius = 2.5
|
radius = 2.5
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody3D"]
|
[node name="Player" type="CharacterBody3D"]
|
||||||
|
collision_layer = 4
|
||||||
|
collision_mask = 5
|
||||||
script = ExtResource("1_5wxv7")
|
script = ExtResource("1_5wxv7")
|
||||||
|
|
||||||
[node name="OmniLight3D" type="OmniLight3D" parent="."]
|
[node name="OmniLight3D" type="OmniLight3D" parent="."]
|
||||||
@@ -108,6 +112,10 @@ move_speed = 7.0
|
|||||||
[node name="Dodge Roll" type="Node" parent="State Machine"]
|
[node name="Dodge Roll" type="Node" parent="State Machine"]
|
||||||
script = ExtResource("5_hck1p")
|
script = ExtResource("5_hck1p")
|
||||||
|
|
||||||
|
[node name="Ranged Attack" type="Node" parent="State Machine"]
|
||||||
|
script = ExtResource("6_08u7w")
|
||||||
|
fired_object = ExtResource("7_kgmex")
|
||||||
|
|
||||||
[node name="Body" type="MeshInstance3D" parent="."]
|
[node name="Body" type="MeshInstance3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0.0537765)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0.0537765)
|
||||||
material_override = ExtResource("1_y6xdh")
|
material_override = ExtResource("1_y6xdh")
|
||||||
|
|||||||
1
Scripts/arrow.gd
Normal file
1
Scripts/arrow.gd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
extends Projectile
|
||||||
1
Scripts/arrow.gd.uid
Normal file
1
Scripts/arrow.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://b0crflswpal5l
|
||||||
@@ -16,7 +16,6 @@ func _process(delta: float) -> void:
|
|||||||
|
|
||||||
func camera_fov():
|
func camera_fov():
|
||||||
var distance_to_target = global_position.distance_to(target.global_position)
|
var distance_to_target = global_position.distance_to(target.global_position)
|
||||||
attributes.dof_blur_far_distance = distance_to_target + 15.0
|
|
||||||
attributes.dof_blur_near_distance = distance_to_target - 3
|
attributes.dof_blur_near_distance = distance_to_target - 3
|
||||||
|
|
||||||
func camera_height_change(delta):
|
func camera_height_change(delta):
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ extends Node3D
|
|||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
follow_mouse()
|
follow_mouse()
|
||||||
swap_models()
|
swap_models()
|
||||||
look_at(player.global_position, Vector3.UP)
|
point_from_player()
|
||||||
|
|
||||||
func follow_mouse():
|
func follow_mouse():
|
||||||
var mouse_pos = MousePos.get_mouse_world_position(00001000)
|
var mouse_pos = MousePos.get_mouse_world_position(00001000)
|
||||||
@@ -22,3 +22,7 @@ func swap_models():
|
|||||||
else:
|
else:
|
||||||
sword_cursor.visible = true
|
sword_cursor.visible = true
|
||||||
bow_cursor.visible = false
|
bow_cursor.visible = false
|
||||||
|
|
||||||
|
func point_from_player():
|
||||||
|
var player_pos_xz_only = Vector3(player.global_position.x,global_position.y,player.global_position.z)
|
||||||
|
look_at(player_pos_xz_only, Vector3.UP)
|
||||||
|
|||||||
@@ -8,3 +8,6 @@ func Physics_Update(delta):
|
|||||||
apply_gravity(delta)
|
apply_gravity(delta)
|
||||||
respawn_on_fall(delta)
|
respawn_on_fall(delta)
|
||||||
attack()
|
attack()
|
||||||
|
|
||||||
|
if Input.is_action_just_pressed("ranged_attack"):
|
||||||
|
Transitioned.emit(self,"ranged attack")
|
||||||
|
|||||||
5
Scripts/projectile.gd
Normal file
5
Scripts/projectile.gd
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
extends RigidBody3D
|
||||||
|
class_name Projectile
|
||||||
|
|
||||||
|
var damage
|
||||||
|
var speed
|
||||||
1
Scripts/projectile.gd.uid
Normal file
1
Scripts/projectile.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://de4r7j0yuar0s
|
||||||
24
Scripts/ranged_attack.gd
Normal file
24
Scripts/ranged_attack.gd
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
extends PlayerState
|
||||||
|
class_name PlayerRangedAttack
|
||||||
|
|
||||||
|
@export var fired_object : PackedScene
|
||||||
|
@export var object_speed : float = 20.0
|
||||||
|
|
||||||
|
func Enter():
|
||||||
|
character.velocity = Vector3.ZERO
|
||||||
|
|
||||||
|
func Physics_Update(delta):
|
||||||
|
body_look_at_mouse()
|
||||||
|
|
||||||
|
if Input.is_action_just_released("ranged_attack"):
|
||||||
|
fire_projectile()
|
||||||
|
Transitioned.emit(self,"on floor")
|
||||||
|
|
||||||
|
|
||||||
|
func fire_projectile():
|
||||||
|
var arrow_spawn = fired_object.instantiate()
|
||||||
|
arrow_spawn.speed = object_speed
|
||||||
|
get_tree().current_scene.add_child(arrow_spawn)
|
||||||
|
arrow_spawn.transform.basis = character.body.global_transform.basis
|
||||||
|
arrow_spawn.global_position = character.body.global_position
|
||||||
|
arrow_spawn.linear_velocity += character.body.global_transform.basis * Vector3(0,0,-object_speed)
|
||||||
1
Scripts/ranged_attack.gd.uid
Normal file
1
Scripts/ranged_attack.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://255h63wdkwpv
|
||||||
@@ -78,6 +78,7 @@ ranged_attack={
|
|||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
|
3d_physics/layer_3="Player"
|
||||||
3d_physics/layer_5="Objects"
|
3d_physics/layer_5="Objects"
|
||||||
3d_physics/layer_6="conflicts with MouseTable for some reason, leaving open for now"
|
3d_physics/layer_6="conflicts with MouseTable for some reason, leaving open for now"
|
||||||
3d_physics/layer_8="MouseTable"
|
3d_physics/layer_8="MouseTable"
|
||||||
|
|||||||
Reference in New Issue
Block a user