Skip to content

Commit f1599a9

Browse files
committed
Changes in mouse control
1 parent 291e960 commit f1599a9

19 files changed

+89
-95
lines changed

Assets/shaders/Fire.gdshader

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ uniform float fire_aperture : hint_range( 0.0, 3.0 ) = 0.22;
1919
noise_texを使わないパターン
2020
2121
float random( vec2 pos )
22-
{
22+
{
2323
return fract(sin(dot(pos, vec2(12.9898,78.233))) * 43758.5453);
2424
}
2525

Assets/shaders/Glass.gdshader

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ void vertex() {
4242
void fragment() {
4343
NORMAL_MAP = texture(normal_map, UV).xyz;
4444
NORMAL_MAP_DEPTH = normal_strength;
45-
45+
4646
float VdotN = dot(VIEW, NORMAL);
4747
float fresnel = clamp(SchlickFresnel(VdotN), 0.0, 1.0);
48-
48+
4949
vec4 albedo_mix = texture(albedo_texture, UV) * albedo;
5050
float roughness_mix = texture(roughness_texture, UV).r * roughness;
51-
51+
5252
float a = mix(0.001, 1.0, albedo_mix.a);
5353
float a_factor_0 = mix(fresnel * edge_color.a, 1.0, a);
5454
float a_factor_1 = 0.5 * sqrt(a);
5555
float a_factor_2 = a_factor_0 + a_factor_1;
56-
56+
5757
ALBEDO = mix(edge_color.rgb * edge_color.a, albedo_mix.rgb * surface_contribution, a);
5858
ROUGHNESS = roughness_mix;
5959
SPECULAR = 0.5 * inversesqrt(specular_contribution);
60-
60+
6161
vec3 unpacked_normal = NORMAL_MAP;
6262
unpacked_normal.xy = unpacked_normal.xy * 2.0 - 1.0;
6363
unpacked_normal.z = sqrt(max(0.0, 1.0 - dot(unpacked_normal.xy, unpacked_normal.xy)));

DotCrossTesting.tscn

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[gd_scene load_steps=2 format=3 uid="uid://vv2d7cmpsbp2"]
2+
3+
[ext_resource type="Script" uid="uid://pv3xir7ljyi2" path="res://src/testing/dot_cross_testing.gd" id="1_2grvy"]
4+
5+
[node name="Node3D" type="Node3D"]
6+
script = ExtResource("1_2grvy")
7+
8+
[node name="RayCast3D" type="RayCast3D" parent="."]
9+
target_position = Vector3(0.985, 1.715, 0)
10+
debug_shape_custom_color = Color(0, 1, 0, 1)
11+
debug_shape_thickness = 5
12+
13+
[node name="RayCast3D2" type="RayCast3D" parent="."]
14+
target_position = Vector3(0.985, -0.13, 0)
15+
debug_shape_custom_color = Color(1, 0, 0, 1)
16+
debug_shape_thickness = 5

Global.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
extends Node
22

33
var saw_comix : bool = false
4-
var did_tutorial : bool = false
4+
var did_tutorial : bool = true
55
var score : int = 0

Scenes/Game.tscn

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ spot_range = 51.5012
121121
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 22.8314, 4, -5.33556)
122122

123123
[node name="Camera3D" type="Camera3D" parent="Game/CamPivot"]
124-
transform = Transform3D(0.852677, -0.169995, 0.494008, 0, 0.945581, 0.325387, -0.522439, -0.27745, 0.806275, 7.14477, 8.9441, 11.9304)
124+
transform = Transform3D(1, 0, 0, 0, 0.893348, 0.449366, 0, -0.449366, 0.893348, 0, 8.944, 11.93)
125125
current = true
126126
fov = 58.5
127127
script = ExtResource("2_kldst")
@@ -180,34 +180,21 @@ anchor_left = 0.5
180180
anchor_top = 1.0
181181
anchor_right = 0.5
182182
anchor_bottom = 1.0
183-
offset_left = -251.0
184-
offset_top = -95.0
185-
offset_right = 251.0
183+
offset_left = -283.0
184+
offset_top = -46.0
185+
offset_right = 284.0
186186
grow_horizontal = 2
187187
grow_vertical = 0
188-
text = "Use W/S to move
189-
Use A/D to turn"
188+
text = "Use WASD to move around"
190189

191-
[node name="WS progress" type="ProgressBar" parent="Game/CamPivot/Camera3D/Tutorial/Label"]
190+
[node name="WASD progress" type="ProgressBar" parent="Game/CamPivot/Camera3D/Tutorial/Label"]
192191
z_index = -1
193192
layout_mode = 1
194-
anchors_preset = 10
195-
anchor_right = 1.0
196-
offset_bottom = 50.0
197-
grow_horizontal = 2
198-
theme = ExtResource("10_acvyw")
199-
show_percentage = false
200-
201-
[node name="AD progress" type="ProgressBar" parent="Game/CamPivot/Camera3D/Tutorial/Label"]
202-
z_index = -1
203-
layout_mode = 1
204-
anchors_preset = -1
205-
anchor_top = 0.516
193+
anchors_preset = 15
206194
anchor_right = 1.0
207195
anchor_bottom = 1.0
208-
offset_top = -0.0200043
209196
grow_horizontal = 2
210-
grow_vertical = 0
197+
grow_vertical = 2
211198
theme = ExtResource("10_acvyw")
212199
show_percentage = false
213200

@@ -265,7 +252,7 @@ show_percentage = false
265252

266253
[node name="Mouse" parent="Game" instance=ExtResource("3_b2bpf")]
267254
unique_name_in_owner = true
268-
transform = Transform3D(0.997917, 0, -0.064515, 0, 1, 0, 0.064515, 0, 0.997917, 23.9156, 18.3147, -5.46594)
255+
transform = Transform3D(0.997917, 0, -0.064515, 0, 1, 0, 0.064515, 0, 0.997917, 24.2401, 9.40695, -2.85862)
269256

270257
[node name="KillArea" type="Area3D" parent="Game"]
271258
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.015552, 0)

Scenes/Player/mouse/mouse.gd

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ func hit(other):
3636
if other is Powerup:
3737
return
3838

39-
if other is Item:
40-
health -= 5
41-
mouse_model.take_damage()
42-
hit_cooldown = 1
43-
if other is HeavyItem:
44-
health = 0
45-
elif other is Shard:
46-
health -= 1
47-
mouse_model.take_damage()
48-
hit_cooldown = 1
49-
50-
39+
if other is Item or other is Shard:
40+
41+
var k = -other.linear_velocity.normalized().dot(velocity.normalized())
42+
43+
var res_damage : float = other.max_damage + other.max_damage * k
44+
45+
if res_damage>0:
46+
hit_cooldown = 1
47+
health -= res_damage
48+
mouse_model.take_damage()
49+
50+
5151
#await get_tree().create_timer(0.5).timeout
5252
#get_tree().change_scene_to_file('res://ui/died_menu.tscn')
5353

@@ -70,18 +70,21 @@ func _physics_process(delta: float) -> void:
7070

7171
# Get the input direction and handle the movement/deceleration.
7272
# As good practice, you should replace UI actions with custom gameplay actions.
73-
var input_dir := Input.get_vector("w", "s", "d", "a")
73+
var input_dir := Input.get_vector("d", "a", "s", "w")
7474
mouse_model.direction = input_dir
7575

76-
rotation.y += input_dir.y * delta * 4
76+
#rotation.y += input_dir.y * delta * 4
77+
var direction := -(cam.global_transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
7778

78-
var direction := -(transform.basis * Vector3(input_dir.x, 0, 0)).normalized()
7979

8080

8181
#var direction := Vector3(input_dir.x, 0, input_dir.y).normalized()
8282
if direction:
8383
velocity.x = direction.x * SPEED
8484
velocity.z = direction.z * SPEED
85+
var ang := Vector2(direction.x,-direction.z).angle()
86+
rotation.y = lerp_angle(rotation.y,ang,0.1)
87+
8588
else:
8689
velocity.x = move_toward(velocity.x, 0, SPEED)
8790
velocity.z = move_toward(velocity.z, 0, SPEED)

Scenes/Player/mouse/mouse.tscn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ transform = Transform3D(1, 0, -2.98023e-08, 0, 1, 0, 2.98023e-08, 0, 1, -0.37121
2222
shape = SubResource("BoxShape3D_tpibb")
2323

2424
[node name="RigidBody3D" type="RigidBody3D" parent="."]
25-
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
2625
top_level = true
2726
mass = 25.0
2827
script = ExtResource("2_3xyak")

Scenes/Player/mouse/mouse_model.gd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ var direction : Vector2
1111
func reset_position():
1212
head_target.position = def_position
1313
'''
14+
'''
1415
var turn_speed : float = 5
1516
func _process(delta: float) -> void:
1617
if direction:
17-
head_target.position.z = move_toward(head_target.position.z,-3*direction.y,delta*turn_speed)
18+
head_target.position.z = move_toward(head_target.position.z,-3*direction.x,delta*turn_speed)
1819
else:
1920
head_target.position.z = move_toward(head_target.position.z,def_position.z,delta*turn_speed)
20-
21+
'''
2122
@onready var ap: AnimationPlayer = $AnimationPlayer2
2223
func jump():
2324
ap.play("Jump")

default_bus_layout.tres

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[gd_resource type="AudioBusLayout" format=3 uid="uid://dof2uoju1igv4"]
22

33
[resource]
4-
bus/0/volume_db = 0.0694828

project.godot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ destroy_all={
7777
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
7878
]
7979
}
80-
p={
80+
esc={
8181
"deadzone": 0.2,
82-
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":80,"key_label":0,"unicode":112,"location":0,"echo":false,"script":null)
82+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
8383
]
8484
}
8585

0 commit comments

Comments
 (0)