mirror of
https://github.com/Steffo99/nanogolf.git
synced 2024-11-24 00:54:19 +00:00
Tweak golf ball physics
This commit is contained in:
parent
6a8ada8163
commit
2f1ef9a4d6
4 changed files with 10 additions and 7 deletions
|
@ -5,6 +5,8 @@ class_name PuttController
|
||||||
@export var putt_max_impulse: float
|
@export var putt_max_impulse: float
|
||||||
## How many game units a pixel of screen mouse movement corresponds to.
|
## How many game units a pixel of screen mouse movement corresponds to.
|
||||||
@export var putt_drag_scale: float
|
@export var putt_drag_scale: float
|
||||||
|
## Length multiplier of the putt ghost
|
||||||
|
@export var putt_ghost_scale: float
|
||||||
## Curve mapping relative putt impulse to putt sound volume.
|
## Curve mapping relative putt impulse to putt sound volume.
|
||||||
@export var putt_volume: Curve
|
@export var putt_volume: Curve
|
||||||
## Emitted when a putt has happened.
|
## Emitted when a putt has happened.
|
||||||
|
@ -48,8 +50,8 @@ func _input(event: InputEvent):
|
||||||
|
|
||||||
func update_putt_ghost(putt_vector: Vector2):
|
func update_putt_ghost(putt_vector: Vector2):
|
||||||
sprite.rotation = putt_vector.angle()
|
sprite.rotation = putt_vector.angle()
|
||||||
sprite.scale.x = putt_vector.length() / sprite_texture_width
|
sprite.scale.x = putt_vector.length() * putt_ghost_scale / sprite_texture_width
|
||||||
sprite.position = position - putt_vector * 0.5
|
sprite.position = position - putt_vector * putt_ghost_scale * 0.5
|
||||||
|
|
||||||
|
|
||||||
func compute_putt(start_position: Vector2, end_position: Vector2) -> Vector2:
|
func compute_putt(start_position: Vector2, end_position: Vector2) -> Vector2:
|
||||||
|
|
|
@ -21,7 +21,7 @@ wall_min_slide_angle = 0.0
|
||||||
script = ExtResource("1_cnerg")
|
script = ExtResource("1_cnerg")
|
||||||
physics_friction = 1.0
|
physics_friction = 1.0
|
||||||
physics_max_bounces = 4.0
|
physics_max_bounces = 4.0
|
||||||
physics_bounce_coefficient = 0.4
|
physics_bounce_coefficient = 0.65
|
||||||
collision_sound = ExtResource("4_6m2yp")
|
collision_sound = ExtResource("4_6m2yp")
|
||||||
collision_volume_db = SubResource("Curve_v81ms")
|
collision_volume_db = SubResource("Curve_v81ms")
|
||||||
collision_volume_max_velocity = 150.0
|
collision_volume_max_velocity = 150.0
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
[node name="TileMap" type="TileMap" parent="."]
|
[node name="TileMap" type="TileMap" parent="."]
|
||||||
tile_set = ExtResource("1_rm16w")
|
tile_set = ExtResource("1_rm16w")
|
||||||
format = 2
|
format = 2
|
||||||
layer_0/tile_data = PackedInt32Array(131074, 2, 0, 196610, 2, 0, 262146, 2, 0, 327682, 2, 0, 393218, 2, 0, 458754, 2, 0, 524290, 2, 0, 589826, 2, 0, 655362, 2, 0, 720898, 2, 0, 786434, 2, 0, 851970, 2, 0, 917506, 2, 0, 983042, 2, 0, 1048578, 2, 0, 1114114, 2, 0, 1179650, 2, 0, 1245186, 2, 0, 1310722, 2, 0, 1376258, 2, 0, 1441794, 2, 0, 1507330, 2, 0, 1572866, 2, 0, 1638402, 2, 0, 1703938, 2, 0, 1769474, 2, 0, 1769475, 2, 0, 1769476, 2, 0, 1769477, 2, 0, 1769478, 2, 0, 1769479, 2, 0, 1769480, 2, 0, 1769481, 2, 0, 1769482, 2, 0, 1769483, 2, 0, 1769484, 2, 0, 1769485, 2, 0, 1769486, 2, 0, 1769487, 2, 0, 1703951, 2, 0, 1638415, 2, 0, 1572879, 2, 0, 1507343, 2, 0, 1441807, 2, 0, 1376271, 2, 0, 1310735, 2, 0, 1245199, 2, 0, 1179663, 2, 0, 1114127, 2, 0, 1048591, 2, 0, 983055, 2, 0, 917519, 2, 0, 851983, 2, 0, 786447, 2, 0, 720911, 2, 0, 655375, 2, 0, 589839, 2, 0, 524303, 2, 0, 131081, 2, 0, 131080, 2, 0, 131079, 2, 0, 131078, 2, 0, 131077, 2, 0, 131076, 2, 0, 131075, 2, 0, 196618, 1, 1342177280, 262155, 1, 1342177280, 327692, 1, 1342177280, 393229, 1, 1342177280, 458766, 1, 1342177280, 458767, 1, 1610612736, 393230, 1, 1610612736, 327693, 1, 1610612736, 262156, 1, 1610612736, 196619, 1, 1610612736, 131082, 1, 1610612736)
|
layer_0/tile_data = PackedInt32Array(720914, 2, 0, 786450, 2, 0, 851986, 2, 0, 917522, 2, 0, 983058, 2, 0, 1048594, 2, 0, 1114130, 2, 0, 1114131, 2, 0, 1114132, 2, 0, 1114133, 2, 0, 1114134, 2, 0, 1114135, 2, 0, 1114136, 2, 0, 720915, 2, 0, 720916, 2, 0, 720917, 2, 0, 720918, 2, 0, 720919, 2, 0, 720920, 2, 0, 720921, 2, 0, 720922, 2, 0, 720923, 2, 0, 720924, 2, 0, 720925, 2, 0, 720926, 2, 0, 786462, 2, 0, 851998, 2, 0, 917534, 2, 0, 983070, 2, 0, 1048606, 2, 0, 1114142, 2, 0, 1179672, 2, 0, 1245208, 2, 0, 1310744, 2, 0, 1376280, 2, 0, 1441816, 2, 0, 1507352, 2, 0, 1507353, 2, 0, 1507354, 2, 0, 1507355, 2, 0, 1507356, 2, 0, 1507357, 2, 0, 1507358, 2, 0, 1507359, 2, 0, 1114143, 2, 0, 1114144, 2, 0, 1114145, 2, 0, 1114146, 2, 0, 1114147, 2, 0, 1114148, 2, 0, 1179684, 2, 0, 1245220, 2, 0, 1310756, 2, 0, 1376292, 2, 0, 1441828, 2, 0, 1507364, 2, 0, 1507363, 2, 0, 1507362, 2, 0, 1507361, 2, 0, 1507360, 2, 0, 983069, 1, 268435456, 917532, 1, 268435456, 851995, 1, 268435456, 786458, 1, 268435456, 1245209, 1, 536870912, 1310746, 1, 536870912, 1376283, 1, 536870912, 1441820, 1, 536870912, 1441819, 2, 0, 1441818, 2, 0, 1376282, 2, 0, 1376281, 2, 0, 1441817, 2, 0, 1310745, 2, 0, 917533, 2, 0, 851997, 2, 0, 786461, 2, 0, 786460, 2, 0, 851996, 2, 0, 786459, 2, 0)
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="GolfBall" parent="." instance=ExtResource("1_5j6ud")]
|
[node name="GolfBall" parent="." instance=ExtResource("1_5j6ud")]
|
||||||
position = Vector2(69, 81)
|
position = Vector2(340, 229)
|
||||||
physics_bounce_coefficient = 0.6
|
|
||||||
|
|
|
@ -14,8 +14,9 @@ point_count = 2
|
||||||
visible = false
|
visible = false
|
||||||
modulate = Color(1, 1, 1, 0.25098)
|
modulate = Color(1, 1, 1, 0.25098)
|
||||||
script = ExtResource("1_ldg2x")
|
script = ExtResource("1_ldg2x")
|
||||||
putt_max_impulse = 300.0
|
putt_max_impulse = 333.0
|
||||||
putt_drag_scale = 1.0
|
putt_drag_scale = 1.0
|
||||||
|
putt_ghost_scale = 0.3
|
||||||
putt_volume = SubResource("Curve_pq63d")
|
putt_volume = SubResource("Curve_pq63d")
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite2D" parent="."]
|
[node name="Sprite" type="Sprite2D" parent="."]
|
||||||
|
|
Loading…
Reference in a new issue