Compare commits

..

6 Commits

23 changed files with 182 additions and 37 deletions

BIN
assets/sprites/particles/smudge.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -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

View File

@ -307,7 +307,6 @@ directional_shadow_pancake_size = 5.0
gravity_point_center = Vector3(0, 1, 0)
gravity_direction = Vector3(0, 1, 0)
script = ExtResource("9_jwlau")
terrain_angular_damping = 2.0
[node name="CollisionPolygon3D" type="CollisionPolygon3D" parent="Course/Fairway"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 209.788, 6.20358, 256.527)
@ -443,7 +442,6 @@ spawn_turns = 1
[node name="ExplosionEffect" parent="Course" instance=ExtResource("16_xufks")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 274.103, 5.01502, 286.299)
visible = false
[node name="CityBuildings" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 129.404, -9.53674e-07, 309.4)

View File

@ -6,4 +6,4 @@
[resource]
script = ExtResource("2_wmp72")
scene = ExtResource("1_2cp8o")
level_name = "Forbidden Mall"
level_name = "Mall"

View File

@ -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

View File

@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="Level" load_steps=3 format=3 uid="uid://dexm07r8wvu83"]
[ext_resource type="PackedScene" uid="uid://cvs546kk7t7aw" path="res://levels/terrain_test/terrain_test.tscn" id="1_iggnc"]
[ext_resource type="Script" path="res://src/world/level/level.gd" id="2_uc833"]
[resource]
script = ExtResource("2_uc833")
scene = ExtResource("1_iggnc")
level_name = "Terrain Debug"

View File

@ -12,12 +12,13 @@ config_version=5
config/name="GFOLF"
config/description="GFOLF: Combat Golf Action"
config/version="0.0.1"
config/version="0.0.2"
run/main_scene="res://src/game/game.tscn"
config/use_custom_user_dir=true
config/project_settings_override="user://settings.godot"
config/features=PackedStringArray("4.3", "Forward Plus")
run/max_fps=60
run/main_scene.editor="res://src/game/debug_game.tscn"
[autoload]
@ -255,7 +256,7 @@ locale/translations=PackedStringArray("res://assets/text/text.en.translation")
3d/sleep_threshold_angular=2.0
jolt_3d/sleep/velocity_threshold=0.1
jolt_3d/sleep/time_threshold=1.0
jolt_3d/limits/max_angular_velocity=270000.0
jolt_3d/limits/max_angular_velocity=5700.0
jolt_3d/limits/max_temporary_memory=64
[rendering]
@ -266,5 +267,6 @@ lights_and_shadows/directional_shadow/size=16384
lights_and_shadows/directional_shadow/soft_shadow_filter_quality=0
textures/decals/filter=2
anti_aliasing/quality/msaa_3d=3
viewport/hdr_2d=true
anti_aliasing/quality/screen_space_aa=1
anti_aliasing/quality/use_debanding=true

View File

@ -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

View File

@ -6,6 +6,7 @@ signal entered_water
## Types of game balls
enum Type {
DEBUG = -1,
NONE,
BASIC,
PLASMA,
@ -130,6 +131,7 @@ func get_surface_snap_point() -> Vector3:
)
var collisions := get_world_3d().direct_space_state.intersect_ray(params)
if collisions:
@warning_ignore("unsafe_cast")
return collisions["position"] as Vector3
return global_position
@ -220,12 +222,14 @@ func _on_sleeping_state_changed() -> void:
if sleeping:
# Trigger to reassign on wake
_awake = false
linear_velocity = Vector3.ZERO
angular_velocity = Vector3.ZERO
linear_damp = 0.0
angular_damp = 0.0
func _manual_sleep() -> void:
freeze = true
linear_velocity = Vector3.ZERO
angular_velocity = Vector3.ZERO
manual_sleep_timer.start()

View File

@ -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
@ -35,10 +35,13 @@ script/source = "extends Control
const COLOR_X := Color(1, 0, 0)
const COLOR_Y := Color(0, 1, 0)
const COLOR_Z := Color(0, 0, 1)
const COLOR_VELOCITY := Color.ORANGE
const COLOR_MAGNUS := Color.CYAN
const VELOCITY_SCALE := 0.5
const MAGNUS_SCALE := 3
const WIDTH := 4
@export var draw_velocity := true
@export var draw_reoriented_basis := true
@export var draw_magnus_effect := true
@export var draw_gravity_basis := true
@ -54,6 +57,11 @@ func _process(_delta: float) -> void:
func _draw() -> void:
var camera := get_viewport().get_camera_3d()
var start := camera.unproject_position(physics_ball.global_position)
if draw_velocity:
var end := camera.unproject_position(physics_ball.global_position + physics_ball.linear_velocity * VELOCITY_SCALE)
draw_line(start, end, COLOR_VELOCITY, WIDTH)
if draw_reoriented_basis and physics_ball._last_contact_normal != null:
var basis := physics_ball.get_reoriented_basis()
var end_x := camera.unproject_position(physics_ball.global_position + basis.x)
@ -105,6 +113,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 +156,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
@ -161,8 +198,8 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_p4v7o")
draw_reoriented_basis = false
draw_magnus_effect = false
draw_gravity_basis = false
[node name="SFX" type="Node3D" parent="."]
unique_name_in_owner = true
@ -206,6 +243,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

6
src/game/debug_game.tscn Normal file
View File

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://ces65grpayngu"]
[ext_resource type="PackedScene" uid="uid://cefit4bc8akbb" path="res://src/game/game.tscn" id="1_qa7ks"]
[node name="Game" instance=ExtResource("1_qa7ks")]
start_scene = "res://src/world/world.tscn"

View File

@ -89,6 +89,12 @@ func _finish_scene_load(instance: Node) -> void:
func _process(_delta: float) -> void:
# REMOVEME
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
if _loading_resources and not loading_screen.visible:
loader_transition.play("fade_in")

View File

@ -119,7 +119,6 @@ _data = {
[node name="Game" type="Node" groups=["GameGroup"]]
process_mode = 3
script = ExtResource("1_4qa87")
start_scene = "res://src/world/world.tscn"
[node name="RootControl" type="Control" parent="."]
unique_name_in_owner = true

View File

@ -16,6 +16,7 @@ iron = ExtResource("2_piku2")
wedge = ExtResource("5_wm4ae")
putter = ExtResource("3_tytwr")
_balls = {
-1: -1,
1: -1,
2: 5,
3: -1,

View File

@ -6,6 +6,7 @@ signal ball_changed(ball: GameBall)
## Scenes for each type of ball.
const SCENE_MAP: Dictionary = {
GameBall.Type.DEBUG: preload("res://src/equipment/balls/debug_ball/debug_ball.tscn"),
GameBall.Type.BASIC: preload("res://src/equipment/balls/physics_ball/physics_ball.tscn"),
GameBall.Type.PLASMA: preload("res://src/equipment/balls/plasma_ball/plasma_ball.tscn"),
GameBall.Type.BRICK: preload("res://src/equipment/balls/brick/brick.tscn"),

View File

@ -38,7 +38,7 @@ const BIG_POWER_THRESHOLD := 0.7
const WATER_DAMAGE := 10.0
## Angle of influence that shot curve has, in radians
const CURVE_INFLUENCE := PI / 3
const CURVE_INFLUENCE := PI / 4
## Just enough to make things interesting!
const SHOT_OFFSET_X_FACTOR := 20.0
@ -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()

View File

@ -329,7 +329,7 @@ _data = {
}
[sub_resource type="SphereShape3D" id="SphereShape3D_xvvdi"]
radius = 1.5
radius = 2.0
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4n2rd"]
transparency = 1

View File

@ -4,6 +4,7 @@ class_name BallSelector extends Control
const TWEEN_TIME := 0.2
const Y_OFFSET := {
GameBall.Type.DEBUG: 0,
GameBall.Type.NONE: 50,
GameBall.Type.BASIC: 18,
GameBall.Type.PLASMA: -14,

View File

@ -1,8 +1,6 @@
class_name BallZone extends Area3D
## A spatial area that has an effect on balls inside it.
@export var terrain_angular_damping := 1.0
@export var water_hazard := false

View File

@ -1,38 +1,46 @@
[gd_scene load_steps=8 format=3 uid="uid://c6k44l0mnq3o1"]
[gd_scene load_steps=10 format=3 uid="uid://c6k44l0mnq3o1"]
[ext_resource type="Curve" uid="uid://b5vptoxuq3dwb" path="res://src/world/effects/explosion/intensity_curve.tres" id="1_rxjwh"]
[sub_resource type="Gradient" id="Gradient_tuj3x"]
offsets = PackedFloat32Array(0, 0.0850112, 0.693512, 0.760626)
colors = PackedColorArray(3, 3, 3, 1, 2, 2, 0.6, 1, 1, 0.0623333, 0.03, 1, 0, 0, 0, 1)
offsets = PackedFloat32Array(0, 0.148459, 0.29972, 0.840336)
colors = PackedColorArray(1, 0.0623333, 0.03, 1, 1, 1, 1, 1, 1, 1, 0.3, 1, 0.08736, 0.09, 0.0702, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_d6li3"]
gradient = SubResource("Gradient_tuj3x")
[sub_resource type="Curve" id="Curve_oo5uu"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.0842105, 1), 0.0, 0.0, 0, 0, Vector2(0.246316, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
[sub_resource type="Curve" id="Curve_kl03u"]
max_value = 3.0
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.145, 3), 0.0, 0.0, 0, 0, Vector2(0.566, 3), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 4
[sub_resource type="CurveTexture" id="CurveTexture_auv7e"]
curve = SubResource("Curve_kl03u")
[sub_resource type="CurveTexture" id="CurveTexture_quj8c"]
curve = SubResource("Curve_oo5uu")
curve = ExtResource("1_rxjwh")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_hjkte"]
lifetime_randomness = 0.52
emission_shape = 3
emission_box_extents = Vector3(1, 1, 1)
lifetime_randomness = 0.6
direction = Vector3(0, 0, 0)
spread = 180.0
initial_velocity_min = 4.0
initial_velocity_min = -4.0
initial_velocity_max = 4.0
gravity = Vector3(0, 0, 0)
scale_min = 0.3
scale_min = 0.75
scale_max = 1.5
scale_curve = SubResource("CurveTexture_quj8c")
color_ramp = SubResource("GradientTexture1D_d6li3")
emission_curve = SubResource("CurveTexture_auv7e")
turbulence_enabled = true
turbulence_noise_strength = 0.2
turbulence_noise_scale = 4.0
turbulence_noise_speed = Vector3(1, 1, 1)
turbulence_noise_speed_random = 1.41
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_fliyi"]
shading_mode = 0
vertex_color_use_as_albedo = true
emission_enabled = true
disable_receive_shadows = true
billboard_mode = 3
billboard_keep_scale = true
particles_anim_h_frames = 1
@ -45,7 +53,9 @@ radius = 1.0
height = 2.0
[node name="ExplosionEffect" type="GPUParticles3D"]
lifetime = 0.7
emitting = false
amount = 48
one_shot = true
explosiveness = 0.92
fixed_fps = 60
interpolate = false

View File

@ -0,0 +1,5 @@
[gd_resource type="Curve" format=3 uid="uid://b5vptoxuq3dwb"]
[resource]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.145455, 1), 0.0, 0.0, 0, 0, Vector2(0.566234, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 4

View File

@ -1,11 +1,12 @@
[gd_scene load_steps=6 format=3 uid="uid://cdtdvka0bssgy"]
[gd_scene load_steps=7 format=3 uid="uid://cdtdvka0bssgy"]
[ext_resource type="Script" path="res://src/world/level/level_catalog.gd" id="1_wjjeu"]
[ext_resource type="Resource" uid="uid://chewry1b1a28j" path="res://levels/debug_level/debug_island.tres" id="3_3eqbc"]
[ext_resource type="Script" path="res://src/world/level/level.gd" id="3_8lfqu"]
[ext_resource type="Resource" uid="uid://cfsy1nlfo4inx" path="res://levels/oneill/oneill.tres" id="4_8547s"]
[ext_resource type="Resource" uid="uid://3odongr8qm8e" path="res://levels/mall/mall.tres" id="5_htd21"]
[ext_resource type="Resource" uid="uid://dexm07r8wvu83" path="res://levels/terrain_test/terrain_test.tres" id="6_uwkvl"]
[node name="LevelCatalog" type="Node"]
script = ExtResource("1_wjjeu")
levels = Array[ExtResource("3_8lfqu")]([ExtResource("3_3eqbc"), ExtResource("4_8547s"), ExtResource("5_htd21")])
levels = Array[ExtResource("3_8lfqu")]([ExtResource("3_3eqbc"), ExtResource("4_8547s"), ExtResource("5_htd21"), ExtResource("6_uwkvl")])

View File

@ -2,8 +2,8 @@
[ext_resource type="Script" path="res://src/world/world.gd" id="1_ybjyx"]
[ext_resource type="Script" path="res://src/player/world_player.gd" id="2_e743i"]
[ext_resource type="PackedScene" uid="uid://cvs546kk7t7aw" path="res://levels/terrain_test/terrain_test.tscn" id="2_hbpi4"]
[ext_resource type="Script" path="res://src/ui/world_ui.gd" id="2_imewa"]
[ext_resource type="PackedScene" uid="uid://bm2o3mex10v11" path="res://levels/debug_level/debug_level.tscn" id="2_qsk3q"]
[ext_resource type="Resource" uid="uid://crock3revdn73" path="res://src/player/debug_player.tres" id="3_pyw81"]
[ext_resource type="Script" path="res://src/world/play_manager/practice_manager.gd" id="5_yk526"]
[ext_resource type="PackedScene" uid="uid://byvjsvavbg5xe" path="res://src/ui/menus/pause_menu/pause_menu.tscn" id="7_0gd42"]
@ -155,7 +155,7 @@ _data = {
[node name="World" type="Node" groups=["WorldGroup"]]
script = ExtResource("1_ybjyx")
initial_level = ExtResource("2_hbpi4")
initial_level = ExtResource("2_qsk3q")
manager = SubResource("Resource_hpydy")
[node name="Level" type="Node3D" parent="."]