diff --git a/assets/sprites/particles/smudge.png b/assets/sprites/particles/smudge.png new file mode 100644 index 0000000..7fa6628 --- /dev/null +++ b/assets/sprites/particles/smudge.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a56068f5f251db438c39d1af7aa7e867c37a5f5755d7e4f5f74f9f33b3f4524 +size 4426 diff --git a/assets/sprites/particles/smudge.png.import b/assets/sprites/particles/smudge.png.import new file mode 100644 index 0000000..125fec5 --- /dev/null +++ b/assets/sprites/particles/smudge.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dy310v1j5vexd" +path="res://.godot/imported/smudge.png-6be29afb408991155df57310104cb1f8.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/sprites/particles/smudge.png" +dest_files=["res://.godot/imported/smudge.png-6be29afb408991155df57310104cb1f8.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +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 diff --git a/levels/terrain_test/terrain_test.gd b/levels/terrain_test/terrain_test.gd index ce10691..30c3994 100644 --- a/levels/terrain_test/terrain_test.gd +++ b/levels/terrain_test/terrain_test.gd @@ -39,3 +39,8 @@ func _process(_delta: float) -> void: spawn_balls(DROP_SPAWN_GROUP) if Input.is_action_just_pressed("debug_3"): spawn_balls(PUTT_SPAWN_GROUP, PUTT_VEC) + + if Input.is_action_just_pressed("ui_page_up"): + Engine.time_scale *= 2.0 + if Input.is_action_just_pressed("ui_page_down"): + Engine.time_scale *= 0.5 diff --git a/src/equipment/balls/physics_ball/ball_particle_effects.gd b/src/equipment/balls/physics_ball/ball_particle_effects.gd index 86f6ac5..d4565a4 100644 --- a/src/equipment/balls/physics_ball/ball_particle_effects.gd +++ b/src/equipment/balls/physics_ball/ball_particle_effects.gd @@ -3,6 +3,7 @@ class_name BallParticleEffects extends Node3D @export var splash_effect_scene: PackedScene +@onready var chunk_particles: GPUParticles3D = %ChunkParticles @onready var sand_particles: GPUParticles3D = %SandParticles @onready var ball: GameBall = $".." @@ -14,11 +15,23 @@ func play_splash() -> void: effect.global_position = ball.global_position +func _physics_process(_delta: float) -> void: + global_rotation = Vector3.ZERO + + func play_effect(terrain: Terrain.Type) -> void: global_rotation = Vector3.ZERO match terrain: Terrain.Type.SAND: # Adjust sand particle direction var material: ParticleProcessMaterial = sand_particles.process_material - material.direction = -ball.linear_velocity.normalized() + material.direction = -ball.current_gravity.normalized() sand_particles.emitting = true + + +func play_chunk(chunk_scale: float) -> void: + print_debug("Playing chunk effect, scale: ", chunk_scale) + chunk_particles.amount_ratio = chunk_scale + var material: ParticleProcessMaterial = chunk_particles.process_material + material.direction = -ball.current_gravity.normalized() + chunk_particles.emitting = true diff --git a/src/equipment/balls/physics_ball/physics_ball.tscn b/src/equipment/balls/physics_ball/physics_ball.tscn index 2bf07b2..9dfb13e 100644 --- a/src/equipment/balls/physics_ball/physics_ball.tscn +++ b/src/equipment/balls/physics_ball/physics_ball.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=26 format=3 uid="uid://dfttci386ohip"] +[gd_scene load_steps=30 format=3 uid="uid://dfttci386ohip"] [ext_resource type="Script" path="res://src/equipment/balls/physics_ball/game_ball.gd" id="1_iwh2u"] [ext_resource type="Resource" uid="uid://c6tt1hto75ex4" path="res://src/equipment/balls/physics_ball/normal_terrain_physics.tres" id="3_3gnie"] @@ -12,8 +12,8 @@ [ext_resource type="AudioStream" uid="uid://b5xx5t050i4p" path="res://assets/sound/sfx/ball/sand2.wav" id="11_ed8je"] [ext_resource type="AudioStream" uid="uid://dutumw1vj854w" path="res://assets/sound/sfx/ball/splash1.wav" id="11_xmj6n"] [ext_resource type="Script" path="res://src/equipment/balls/physics_ball/ball_particle_effects.gd" id="12_7krl6"] -[ext_resource type="Texture2D" uid="uid://c47bkx508biqr" path="res://assets/sprites/particles/plasma.png" id="12_guipt"] [ext_resource type="PackedScene" uid="uid://cm4bb3lg4mfd2" path="res://src/world/effects/splash/splash_effect.tscn" id="12_qlrvx"] +[ext_resource type="Texture2D" uid="uid://dy310v1j5vexd" path="res://assets/sprites/particles/smudge.png" id="14_el0o3"] [sub_resource type="PhysicsMaterial" id="PhysicsMaterial_u134x"] bounce = 0.8 @@ -105,6 +105,35 @@ playback_mode = 1 streams_count = 1 stream_0/stream = ExtResource("11_xmj6n") +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_706cj"] +angle_min = -720.0 +angle_max = 720.0 +spread = 20.0 +initial_velocity_min = 1.0 +initial_velocity_max = 5.0 +scale_min = 0.0 +hue_variation_min = -0.02 +hue_variation_max = -2.23517e-08 + +[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_5u1jh"] +load_path = "res://.godot/imported/smudge.png-6be29afb408991155df57310104cb1f8.ctex" + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_fbolh"] +transparency = 1 +vertex_color_use_as_albedo = true +albedo_color = Color(0.17, 0.12954, 0.0272, 1) +albedo_texture = SubResource("CompressedTexture2D_5u1jh") +texture_filter = 2 +billboard_mode = 3 +billboard_keep_scale = true +particles_anim_h_frames = 1 +particles_anim_v_frames = 1 +particles_anim_loop = false + +[sub_resource type="QuadMesh" id="QuadMesh_npp3t"] +material = SubResource("StandardMaterial3D_fbolh") +size = Vector2(0.15, 0.15) + [sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_mwiw1"] angle_min = -720.0 angle_max = 720.0 @@ -119,9 +148,9 @@ hue_variation_max = -2.23517e-08 [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_v1i8b"] transparency = 1 vertex_color_use_as_albedo = true -albedo_color = Color(0.78, 0.70928, 0.5304, 1) -albedo_texture = ExtResource("12_guipt") -texture_filter = 4 +albedo_color = Color(0.45, 0.4092, 0.306, 1) +albedo_texture = ExtResource("14_el0o3") +texture_filter = 2 billboard_mode = 3 billboard_keep_scale = true particles_anim_h_frames = 1 @@ -206,6 +235,15 @@ unique_name_in_owner = true script = ExtResource("12_7krl6") splash_effect_scene = ExtResource("12_qlrvx") +[node name="ChunkParticles" type="GPUParticles3D" parent="ParticleEffects"] +unique_name_in_owner = true +emitting = false +amount = 12 +one_shot = true +explosiveness = 1.0 +process_material = SubResource("ParticleProcessMaterial_706cj") +draw_pass_1 = SubResource("QuadMesh_npp3t") + [node name="SandParticles" type="GPUParticles3D" parent="ParticleEffects"] unique_name_in_owner = true emitting = false diff --git a/src/player/shot_setup/shot_setup.gd b/src/player/shot_setup/shot_setup.gd index ced4071..071fee7 100644 --- a/src/player/shot_setup/shot_setup.gd +++ b/src/player/shot_setup/shot_setup.gd @@ -311,6 +311,9 @@ func take_shot() -> void: game_ball.magnetic = club_type == Club.Type.IRON game_ball.freeze = false game_ball.apply_impulse(impulse, offset) + if not is_shot_good(): + # Play chunk particle effect + game_ball.effects.play_chunk(absf(shot_curve) / (1.0 - NICE_THRESHOLD)) reset_prompt_timer.start()