diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2022-07-23 17:17:29 -0400 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2022-07-23 17:17:29 -0400 |
commit | 2e7b525d907f740367324a485eaeed2fe1fa5d6d (patch) | |
tree | 14b180d220f55397d77196dc4599a478889c90b9 | |
parent | 6c3e080ad94dcbd3a3db678dd55da51cde869335 (diff) | |
download | chicken-chaser-gd-2e7b525d907f740367324a485eaeed2fe1fa5d6d.tar.gz chicken-chaser-gd-2e7b525d907f740367324a485eaeed2fe1fa5d6d.zip |
Add Chicken Chasing
-rw-r--r-- | Chicken.gd | 54 | ||||
-rw-r--r-- | Chicken.tscn | 129 | ||||
-rw-r--r-- | ChickenAnimation.gd | 4 | ||||
-rw-r--r-- | Detection.gd | 9 | ||||
-rw-r--r-- | Main.tscn | 4 | ||||
-rw-r--r-- | Player.tscn | 1 | ||||
-rw-r--r-- | SmoothRotation.gd | 2 | ||||
-rw-r--r-- | project.godot | 6 |
8 files changed, 142 insertions, 67 deletions
@@ -10,20 +10,27 @@ export var mov_length_max = 5.0 export var flap_chance = 5.0 export var squack_chance = 5.0 export var peck_chance = 5.0 +export var detection_range = 20.0 onready var anim = $AnimationTree +var wings = "parameters/wings/playback" +var state = "parameters/state/playback" +var flap_speed = "parameters/wings/FLAP/TimeScale/scale" func roll_die(chance): return (randf() * 100) <= chance func _physics_process(delta): - match anim.wings.get_current_node(): + if chasing: + state_chasing(delta) + return + match anim[wings].get_current_node(): "IDLE": if roll_die(flap_chance): - anim.wings.travel("FLAP") + anim[wings].travel("FLAP") "FLAP": pass - match anim.state.get_current_node(): + match anim[state].get_current_node(): "IDLE": state_idle(delta) "MOVING": @@ -39,31 +46,56 @@ func state_idle(delta): var ang = (randf() - 0.5) * rot_range $SmoothRotation.rotate_y(ang, rot_speed) elif roll_die(mov_chance): - anim.state.travel("MOVING") + anim[state].travel("MOVING") var local_forward = -transform.basis.z.normalized() var dist = lerp(mov_length_min, mov_length_max, randf()) - var mov = local_forward * dist - mov_velocity = mov.normalized() * mov_speed - mov_target = transform.origin + mov + mov_velocity = local_forward * mov_speed + mov_target = transform.origin + (local_forward * dist) mov_steps = (dist / mov_speed) / delta elif roll_die(squack_chance): - anim.state.travel("SQUACK") + anim[state].travel("SQUACK") elif roll_die(peck_chance): - anim.state.travel("PECK") + anim[state].travel("PECK") var mov_velocity = Vector3.ZERO var mov_target = Vector3.ZERO var mov_steps = 0.0 func state_moving(_delta): if mov_steps <= 0.0: - anim.state.travel("IDLE") + anim[state].travel("IDLE") return var _vmp = move_and_slide(mov_velocity, Vector3.UP) for index in range(get_slide_count()): var collision = get_slide_collision(index) if collision.collider.name == "Fence": mov_steps = 0.0 - $SmoothRotation.rotate_y((-transform.basis.z.normalized()).signed_angle_to(collision.normal,Vector3.UP),rot_speed) + var local_forward = -transform.basis.z.normalized() + $SmoothRotation.rotate_y(local_forward.signed_angle_to(collision.normal,Vector3.UP),rot_speed) mov_steps -= 1.0 if mov_steps < 1.0: mov_velocity *= mov_steps + +var chasing +func _on_Detection_body_entered(body): + chasing = true + anim[state].travel("MOVING") + anim[flap_speed] = 8.0 + $SmoothRotation.stop_all() + +func _on_Detection_body_exited(body): + chasing = false + anim[state].travel("IDLE") + anim[flap_speed] = 2.0 + mov_steps = 0.0 + +func state_chasing(delta): + anim[wings].travel("FLAP") + var local_forward = -transform.basis.z.normalized() + var chaser = $Detection.get_overlapping_bodies()[0].transform.origin + chaser.y = transform.origin.y + var chase_dir = (transform.origin-chaser).normalized() + var ang = local_forward.signed_angle_to(chase_dir,Vector3.UP) + ((randf()-0.5)*(PI/2)) + if !$SmoothRotation.is_active(): + $SmoothRotation.rotate_y(ang,rot_speed*2) + var velocity = local_forward * mov_speed + velocity = move_and_slide(velocity, Vector3.UP) diff --git a/Chicken.tscn b/Chicken.tscn index 835d872..a099de4 100644 --- a/Chicken.tscn +++ b/Chicken.tscn @@ -1,10 +1,12 @@ -[gd_scene load_steps=50 format=2] +[gd_scene load_steps=53 format=2] [ext_resource path="res://chicken.tres" type="Material" id=1] [ext_resource path="res://beak.tres" type="Material" id=2] [ext_resource path="res://Chicken.gd" type="Script" id=3] -[ext_resource path="res://ChickenAnimation.gd" type="Script" id=4] [ext_resource path="res://SmoothRotation.gd" type="Script" id=5] +[ext_resource path="res://Detection.gd" type="Script" id=6] + +[sub_resource type="CapsuleShape" id=71] [sub_resource type="SphereMesh" id=1] @@ -18,7 +20,7 @@ length = 0.001 loop = true tracks/0/type = "value" -tracks/0/path = NodePath("Belly/LeftWingPivot:translation") +tracks/0/path = NodePath("Model/Belly/LeftWingPivot:translation") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false @@ -30,7 +32,7 @@ tracks/0/keys = { "values": [ Vector3( -0.995677, 0, 0 ) ] } tracks/1/type = "value" -tracks/1/path = NodePath("Belly/LeftWingPivot:rotation_degrees") +tracks/1/path = NodePath("Model/Belly/LeftWingPivot:rotation_degrees") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/imported = false @@ -42,7 +44,7 @@ tracks/1/keys = { "values": [ Vector3( 0, 0, 0 ) ] } tracks/2/type = "value" -tracks/2/path = NodePath("Belly/RightWingPivot:translation") +tracks/2/path = NodePath("Model/Belly/RightWingPivot:translation") tracks/2/interp = 1 tracks/2/loop_wrap = true tracks/2/imported = false @@ -54,7 +56,7 @@ tracks/2/keys = { "values": [ Vector3( 0.996, 0, 0 ) ] } tracks/3/type = "value" -tracks/3/path = NodePath("Belly/RightWingPivot:rotation_degrees") +tracks/3/path = NodePath("Model/Belly/RightWingPivot:rotation_degrees") tracks/3/interp = 1 tracks/3/loop_wrap = true tracks/3/imported = false @@ -66,7 +68,7 @@ tracks/3/keys = { "values": [ Vector3( 0, 0, 0 ) ] } tracks/4/type = "value" -tracks/4/path = NodePath("Belly/HeadPivot:rotation_degrees") +tracks/4/path = NodePath("Model/Belly/HeadPivot:rotation_degrees") tracks/4/interp = 1 tracks/4/loop_wrap = true tracks/4/imported = false @@ -78,7 +80,7 @@ tracks/4/keys = { "values": [ Vector3( 0, 0, 0 ) ] } tracks/5/type = "value" -tracks/5/path = NodePath("Belly/HeadPivot/Head/BeakTopPivot:rotation_degrees") +tracks/5/path = NodePath("Model/Belly/HeadPivot/Head/BeakTopPivot:rotation_degrees") tracks/5/interp = 1 tracks/5/loop_wrap = true tracks/5/imported = false @@ -90,7 +92,7 @@ tracks/5/keys = { "values": [ Vector3( 0, 0, 0 ) ] } tracks/6/type = "value" -tracks/6/path = NodePath("Belly/HeadPivot/Head/BeakBottomPivot:rotation_degrees") +tracks/6/path = NodePath("Model/Belly/HeadPivot/Head/BeakBottomPivot:rotation_degrees") tracks/6/interp = 1 tracks/6/loop_wrap = true tracks/6/imported = false @@ -102,7 +104,7 @@ tracks/6/keys = { "values": [ Vector3( 0, 0, 0 ) ] } tracks/7/type = "value" -tracks/7/path = NodePath("Belly:rotation_degrees") +tracks/7/path = NodePath("Model/Belly:rotation_degrees") tracks/7/interp = 1 tracks/7/loop_wrap = true tracks/7/imported = false @@ -114,7 +116,7 @@ tracks/7/keys = { "values": [ Vector3( 0, 0, 0 ) ] } tracks/8/type = "value" -tracks/8/path = NodePath("Belly:translation") +tracks/8/path = NodePath("Model/Belly:translation") tracks/8/interp = 1 tracks/8/loop_wrap = true tracks/8/imported = false @@ -131,7 +133,7 @@ resource_name = "flappybird" length = 2.0 loop = true tracks/0/type = "value" -tracks/0/path = NodePath("Belly/LeftWingPivot:translation") +tracks/0/path = NodePath("Model/Belly/LeftWingPivot:translation") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false @@ -143,7 +145,7 @@ tracks/0/keys = { "values": [ Vector3( -0.995677, 0, 0 ), Vector3( -0.995677, 0.0845447, 0 ), Vector3( -0.995677, -0.127906, 0 ), Vector3( -0.995677, 0, 0 ) ] } tracks/1/type = "value" -tracks/1/path = NodePath("Belly/LeftWingPivot:rotation_degrees") +tracks/1/path = NodePath("Model/Belly/LeftWingPivot:rotation_degrees") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/imported = false @@ -155,7 +157,7 @@ tracks/1/keys = { "values": [ Vector3( 0, 0, 0 ), Vector3( 0, 0, -23.821 ), Vector3( 0, 0, 21.829 ), Vector3( 0, 0, 0 ) ] } tracks/2/type = "value" -tracks/2/path = NodePath("Belly/RightWingPivot:translation") +tracks/2/path = NodePath("Model/Belly/RightWingPivot:translation") tracks/2/interp = 1 tracks/2/loop_wrap = true tracks/2/imported = false @@ -167,7 +169,7 @@ tracks/2/keys = { "values": [ Vector3( 0.996, 0, 0 ), Vector3( 0.996, 0.085, 0 ), Vector3( 0.996, -0.128, 0 ), Vector3( 0.996, 0, 0 ) ] } tracks/3/type = "value" -tracks/3/path = NodePath("Belly/RightWingPivot:rotation_degrees") +tracks/3/path = NodePath("Model/Belly/RightWingPivot:rotation_degrees") tracks/3/interp = 1 tracks/3/loop_wrap = true tracks/3/imported = false @@ -183,7 +185,7 @@ tracks/3/keys = { resource_name = "hop" loop = true tracks/0/type = "value" -tracks/0/path = NodePath("Belly:translation") +tracks/0/path = NodePath("Model/Belly:translation") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false @@ -200,7 +202,7 @@ resource_name = "idle_bottom" length = 0.001 loop = true tracks/0/type = "value" -tracks/0/path = NodePath("Belly/LeftWingPivot:translation") +tracks/0/path = NodePath("Model/Belly/LeftWingPivot:translation") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false @@ -212,7 +214,7 @@ tracks/0/keys = { "values": [ Vector3( -0.995677, 0, 0 ) ] } tracks/1/type = "value" -tracks/1/path = NodePath("Belly/LeftWingPivot:rotation_degrees") +tracks/1/path = NodePath("Model/Belly/LeftWingPivot:rotation_degrees") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/imported = false @@ -224,7 +226,7 @@ tracks/1/keys = { "values": [ Vector3( 0, 0, 0 ) ] } tracks/2/type = "value" -tracks/2/path = NodePath("Belly/RightWingPivot:translation") +tracks/2/path = NodePath("Model/Belly/RightWingPivot:translation") tracks/2/interp = 1 tracks/2/loop_wrap = true tracks/2/imported = false @@ -236,7 +238,7 @@ tracks/2/keys = { "values": [ Vector3( 0.996, 0, 0 ) ] } tracks/3/type = "value" -tracks/3/path = NodePath("Belly/RightWingPivot:rotation_degrees") +tracks/3/path = NodePath("Model/Belly/RightWingPivot:rotation_degrees") tracks/3/interp = 1 tracks/3/loop_wrap = true tracks/3/imported = false @@ -253,7 +255,7 @@ resource_name = "idle_hop" length = 0.001 loop = true tracks/0/type = "value" -tracks/0/path = NodePath("Belly:translation") +tracks/0/path = NodePath("Model/Belly:translation") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false @@ -270,7 +272,7 @@ resource_name = "idle_top" length = 0.001 loop = true tracks/0/type = "value" -tracks/0/path = NodePath("Belly/HeadPivot:rotation_degrees") +tracks/0/path = NodePath("Model/Belly/HeadPivot:rotation_degrees") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false @@ -282,7 +284,7 @@ tracks/0/keys = { "values": [ Vector3( 0, 0, 0 ) ] } tracks/1/type = "value" -tracks/1/path = NodePath("Belly/HeadPivot/Head/BeakTopPivot:rotation_degrees") +tracks/1/path = NodePath("Model/Belly/HeadPivot/Head/BeakTopPivot:rotation_degrees") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/imported = false @@ -294,7 +296,7 @@ tracks/1/keys = { "values": [ Vector3( 0, 0, 0 ) ] } tracks/2/type = "value" -tracks/2/path = NodePath("Belly/HeadPivot/Head/BeakBottomPivot:rotation_degrees") +tracks/2/path = NodePath("Model/Belly/HeadPivot/Head/BeakBottomPivot:rotation_degrees") tracks/2/interp = 1 tracks/2/loop_wrap = true tracks/2/imported = false @@ -306,7 +308,7 @@ tracks/2/keys = { "values": [ Vector3( 0, 0, 0 ) ] } tracks/3/type = "value" -tracks/3/path = NodePath("Belly:rotation_degrees") +tracks/3/path = NodePath("Model/Belly:rotation_degrees") tracks/3/interp = 1 tracks/3/loop_wrap = true tracks/3/imported = false @@ -323,7 +325,7 @@ resource_name = "peck" length = 3.0 loop = true tracks/0/type = "value" -tracks/0/path = NodePath("Belly/HeadPivot:rotation_degrees") +tracks/0/path = NodePath("Model/Belly/HeadPivot:rotation_degrees") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false @@ -335,7 +337,7 @@ tracks/0/keys = { "values": [ Vector3( 0, 0, 0 ), Vector3( -18.871, 0, 0 ), Vector3( 3.071, 0, 0 ), Vector3( -18.871, 0, 0 ), Vector3( 3.071, 0, 0 ), Vector3( -18.871, 0, 0 ), Vector3( 0, 0, 0 ) ] } tracks/1/type = "value" -tracks/1/path = NodePath("Belly:rotation_degrees") +tracks/1/path = NodePath("Model/Belly:rotation_degrees") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/imported = false @@ -352,7 +354,7 @@ resource_name = "squack" length = 2.0 loop = true tracks/0/type = "value" -tracks/0/path = NodePath("Belly/HeadPivot:rotation_degrees") +tracks/0/path = NodePath("Model/Belly/HeadPivot:rotation_degrees") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false @@ -364,7 +366,7 @@ tracks/0/keys = { "values": [ Vector3( 0, 0, 0 ), Vector3( 30.215, 0, 0 ), Vector3( 0, 0, 0 ) ] } tracks/1/type = "value" -tracks/1/path = NodePath("Belly/HeadPivot/Head/BeakTopPivot:rotation_degrees") +tracks/1/path = NodePath("Model/Belly/HeadPivot/Head/BeakTopPivot:rotation_degrees") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/imported = false @@ -376,7 +378,7 @@ tracks/1/keys = { "values": [ Vector3( 0, 0, 0 ), Vector3( 26.24, 0, 0 ), Vector3( 0, 0, 0 ) ] } tracks/2/type = "value" -tracks/2/path = NodePath("Belly/HeadPivot/Head/BeakBottomPivot:rotation_degrees") +tracks/2/path = NodePath("Model/Belly/HeadPivot/Head/BeakBottomPivot:rotation_degrees") tracks/2/interp = 1 tracks/2/loop_wrap = true tracks/2/imported = false @@ -521,60 +523,75 @@ node_connections = [ "output", 0, "Add2", "Add2", 0, "wings", "Add2", 1, "state" [sub_resource type="AnimationNodeStateMachinePlayback" id=38] -[sub_resource type="SphereShape" id=67] +[sub_resource type="CylinderShape" id=72] +height = 10.0 + +[sub_resource type="CylinderMesh" id=73] +height = 10.0 + +[sub_resource type="SpatialMaterial" id=70] +flags_transparent = true +albedo_color = Color( 0.894118, 0.027451, 0.027451, 0.156863 ) [node name="Chicken" type="KinematicBody"] collision_layer = 4 collision_mask = 5 script = ExtResource( 3 ) -[node name="Belly" type="MeshInstance" parent="."] +[node name="CollisionShape" type="CollisionShape" parent="."] +transform = Transform( 1, 0, 0, 0, 0.866025, -0.5, 0, 0.5, 0.866025, 0, 0.3, -0.5 ) +shape = SubResource( 71 ) + +[node name="Model" type="Spatial" parent="."] + +[node name="Belly" type="MeshInstance" parent="Model"] mesh = SubResource( 1 ) +skeleton = NodePath("../..") material/0 = ExtResource( 1 ) -[node name="HeadPivot" type="Spatial" parent="Belly"] +[node name="HeadPivot" type="Spatial" parent="Model/Belly"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.657827, -0.749514 ) -[node name="Head" type="MeshInstance" parent="Belly/HeadPivot"] +[node name="Head" type="MeshInstance" parent="Model/Belly/HeadPivot"] transform = Transform( 0.6, 0, 0, 0, 0.55438, 0.229484, 0, -0.229484, 0.55438, 0, 0.388057, -0.339644 ) mesh = SubResource( 2 ) -skeleton = NodePath("../../..") +skeleton = NodePath("../../../..") material/0 = ExtResource( 1 ) -[node name="BeakTopPivot" type="Spatial" parent="Belly/HeadPivot/Head"] +[node name="BeakTopPivot" type="Spatial" parent="Model/Belly/HeadPivot/Head"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.19209e-07, -0.965512 ) -[node name="BeakTop" type="MeshInstance" parent="Belly/HeadPivot/Head/BeakTopPivot"] +[node name="BeakTop" type="MeshInstance" parent="Model/Belly/HeadPivot/Head/BeakTopPivot"] transform = Transform( 0.3, 0, 0, 0, 0.1, 0, 0, 0, 0.5, 0, 0, -0.452 ) mesh = SubResource( 3 ) skeleton = NodePath("../..") material/0 = ExtResource( 2 ) -[node name="BeakBottomPivot" type="Spatial" parent="Belly/HeadPivot/Head"] +[node name="BeakBottomPivot" type="Spatial" parent="Model/Belly/HeadPivot/Head"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.189294, -0.965511 ) -[node name="BeakBottom" type="MeshInstance" parent="Belly/HeadPivot/Head/BeakBottomPivot"] +[node name="BeakBottom" type="MeshInstance" parent="Model/Belly/HeadPivot/Head/BeakBottomPivot"] transform = Transform( 0.3, 0, 0, 0, 0.1, 0, 0, 0, 0.5, 0, 0, -0.452 ) mesh = SubResource( 3 ) skeleton = NodePath("../..") material/0 = ExtResource( 2 ) -[node name="LeftWingPivot" type="Spatial" parent="Belly"] +[node name="LeftWingPivot" type="Spatial" parent="Model/Belly"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.995677, 0, 0 ) -[node name="LeftWing" type="MeshInstance" parent="Belly/LeftWingPivot"] +[node name="LeftWing" type="MeshInstance" parent="Model/Belly/LeftWingPivot"] transform = Transform( 0.5, 0, 0, 0, 0.1, 0, 0, 0, 0.3, -0.377, 0, 0 ) mesh = SubResource( 4 ) -skeleton = NodePath("../../..") +skeleton = NodePath("../../../..") material/0 = ExtResource( 1 ) -[node name="RightWingPivot" type="Spatial" parent="Belly"] +[node name="RightWingPivot" type="Spatial" parent="Model/Belly"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.996, 0, 0 ) -[node name="RightWing" type="MeshInstance" parent="Belly/RightWingPivot"] +[node name="RightWing" type="MeshInstance" parent="Model/Belly/RightWingPivot"] transform = Transform( 0.5, 0, 0, 0, 0.1, 0, 0, 0, 0.3, 0.352, 0, 0 ) mesh = SubResource( 4 ) -skeleton = NodePath("../../..") +skeleton = NodePath("../../../..") material/0 = ExtResource( 1 ) [node name="AnimationPlayer" type="AnimationPlayer" parent="."] @@ -599,11 +616,23 @@ parameters/state/PECK/TimeScale/scale = 2.0 parameters/state/SQUACK/TimeScale/scale = 1.0 parameters/wings/playback = SubResource( 38 ) parameters/wings/FLAP/TimeScale/scale = 2.0 -script = ExtResource( 4 ) - -[node name="CollisionShape" type="CollisionShape" parent="."] -transform = Transform( 1, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 0.5, -0.5 ) -shape = SubResource( 67 ) [node name="SmoothRotation" type="Tween" parent="."] script = ExtResource( 5 ) + +[node name="Detection" type="Area" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4, 0 ) +visible = false +collision_layer = 0 +collision_mask = 2 +script = ExtResource( 6 ) + +[node name="CollisionShape" type="CollisionShape" parent="Detection"] +shape = SubResource( 72 ) + +[node name="Radar" type="MeshInstance" parent="Detection"] +mesh = SubResource( 73 ) +material/0 = SubResource( 70 ) + +[connection signal="body_entered" from="Detection" to="." method="_on_Detection_body_entered"] +[connection signal="body_exited" from="Detection" to="." method="_on_Detection_body_exited"] diff --git a/ChickenAnimation.gd b/ChickenAnimation.gd deleted file mode 100644 index a1298a0..0000000 --- a/ChickenAnimation.gd +++ /dev/null @@ -1,4 +0,0 @@ -extends AnimationTree - -var wings = self["parameters/wings/playback"] -var state = self["parameters/state/playback"] diff --git a/Detection.gd b/Detection.gd new file mode 100644 index 0000000..cde309b --- /dev/null +++ b/Detection.gd @@ -0,0 +1,9 @@ +extends Area + +func _ready(): + var radius = get_parent().detection_range + scale = Vector3(radius,1.0,radius) + +func _unhandled_key_input(_event): + if Input.is_action_just_pressed("toggle_radar"): + visible = !visible @@ -47,6 +47,7 @@ mesh = SubResource( 3 ) material/0 = SubResource( 4 ) [node name="Fence" type="StaticBody" parent="."] +transform = Transform( 3, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0 ) collision_mask = 0 [node name="MeshInstance" type="MeshInstance" parent="Fence"] @@ -100,7 +101,8 @@ text = "move: WASD or Left Stick look: Arrows or Right Stick up: Space or Right Trigger down: Ctrl or Left Trigger -Release Cursor: Esc" +toggle chicken radar: Q or xbox Y +release cursor: Esc" [node name="FPS Counter" type="Label" parent="UI"] anchor_left = 1.0 diff --git a/Player.tscn b/Player.tscn index 098799c..c6d92d3 100644 --- a/Player.tscn +++ b/Player.tscn @@ -3,6 +3,7 @@ [ext_resource path="res://Player.gd" type="Script" id=2] [sub_resource type="SphereShape" id=1] +radius = 0.5 [node name="Player" type="KinematicBody"] collision_layer = 2 diff --git a/SmoothRotation.gd b/SmoothRotation.gd index 91d1f70..7789641 100644 --- a/SmoothRotation.gd +++ b/SmoothRotation.gd @@ -3,5 +3,5 @@ extends Tween func rotate_y(ang, speed): var parent = get_parent() var _ret = remove_all() - _ret = interpolate_property(parent, "rotation:y", parent.rotation.y, parent.rotation.y+ang,abs(ang/speed),Tween.TRANS_EXPO,Tween.EASE_OUT) + _ret = interpolate_property(parent, "rotation:y", parent.rotation.y, parent.rotation.y+ang,abs(ang/speed),Tween.TRANS_SINE,Tween.EASE_OUT) _ret = start() diff --git a/project.godot b/project.godot index f1f5591..67d3430 100644 --- a/project.godot +++ b/project.godot @@ -85,6 +85,12 @@ click={ "events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null) ] } +toggle_radar={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":81,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null) + ] +} [layer_names] |