generated from krampus/template-godot4
Added beach ball which floats on water
This commit is contained in:
parent
967db4a303
commit
8bacd197c2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
asset_dev/soda/soda.blend (Stored with Git LFS)
BIN
asset_dev/soda/soda.blend (Stored with Git LFS)
Binary file not shown.
Binary file not shown.
|
@ -104,3 +104,4 @@ CLUB_PUTTER,Putter
|
|||
BALL_BASIC,Basic
|
||||
BALL_PLASMA,Plasma
|
||||
BALL_BRICK,Brick
|
||||
BALL_BEACH,"Beach Ball"
|
||||
|
|
|
Binary file not shown.
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://daipuukf6e6bc"
|
||||
path="res://.godot/imported/beach_ball.png-103709b22c99e920077c858fb92c2e27.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/textures/beach_ball/beach_ball.png"
|
||||
dest_files=["res://.godot/imported/beach_ball.png-103709b22c99e920077c858fb92c2e27.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
|
Binary file not shown.
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://3oatrxh60ed7"
|
||||
path.s3tc="res://.godot/imported/beach_ball_normal_map.png-06c8d20483d619e155834bb8abd74c2f.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/textures/beach_ball/beach_ball_normal_map.png"
|
||||
dest_files=["res://.godot/imported/beach_ball_normal_map.png-06c8d20483d619e155834bb8abd74c2f.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=1
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=1
|
||||
roughness/src_normal="res://assets/models/balls/beach_ball/beach_ball_normal_map.png"
|
||||
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
|
|
@ -351,6 +351,14 @@ water_hazard = true
|
|||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.2, 0)
|
||||
shape = SubResource("BoxShape3D_x3wvm")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="Course/WaterTable"]
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Course/WaterTable/StaticBody3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.2, 0)
|
||||
shape = SubResource("BoxShape3D_x3wvm")
|
||||
|
||||
[node name="Sailboat" parent="Course/WaterTable" instance=ExtResource("14_6reiy")]
|
||||
transform = Transform3D(-0.74629, 0, -0.665621, 0, 1, 0, 0.665621, 0, -0.74629, 381.024, -0.5, 224.968)
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
extends GameBall
|
||||
|
||||
|
||||
func enter_zone(zone: BallZone) -> void:
|
||||
_zones.push_back(zone)
|
|
@ -0,0 +1,38 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://bptiryfbnautm"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dfttci386ohip" path="res://src/equipment/balls/physics_ball/physics_ball.tscn" id="1_pl6e6"]
|
||||
[ext_resource type="Texture2D" uid="uid://daipuukf6e6bc" path="res://assets/textures/beach_ball/beach_ball.png" id="2_6dwmi"]
|
||||
[ext_resource type="Script" path="res://src/equipment/balls/beach_ball/beach_ball.gd" id="2_ay78j"]
|
||||
[ext_resource type="Texture2D" uid="uid://3oatrxh60ed7" path="res://assets/textures/beach_ball/beach_ball_normal_map.png" id="3_rdlj8"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_867vn"]
|
||||
friction = 0.7
|
||||
bounce = 0.67
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_xh2u0"]
|
||||
albedo_texture = ExtResource("2_6dwmi")
|
||||
normal_enabled = true
|
||||
normal_scale = 0.5
|
||||
normal_texture = ExtResource("3_rdlj8")
|
||||
texture_filter = 4
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_iqcc5"]
|
||||
material = SubResource("StandardMaterial3D_xh2u0")
|
||||
radial_segments = 6
|
||||
rings = 6
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_cvsx2"]
|
||||
|
||||
[node name="BeachBall" instance=ExtResource("1_pl6e6")]
|
||||
collision_mask = 3
|
||||
mass = 0.1
|
||||
physics_material_override = SubResource("PhysicsMaterial_867vn")
|
||||
linear_damp = 0.1
|
||||
script = ExtResource("2_ay78j")
|
||||
radius = 0.1
|
||||
|
||||
[node name="BallMesh" parent="." index="0"]
|
||||
mesh = SubResource("SphereMesh_iqcc5")
|
||||
|
||||
[node name="CollisionShape3D" parent="." index="1"]
|
||||
shape = SubResource("SphereShape3D_cvsx2")
|
|
@ -10,6 +10,7 @@ enum Type {
|
|||
BASIC,
|
||||
PLASMA,
|
||||
BRICK,
|
||||
BEACH,
|
||||
}
|
||||
|
||||
const TERRAIN_DAMPING_EPSILON := 1e-6
|
||||
|
|
|
@ -18,5 +18,6 @@ putter = ExtResource("3_tytwr")
|
|||
_balls = {
|
||||
1: -1,
|
||||
2: 5,
|
||||
3: -1
|
||||
3: -1,
|
||||
4: -1
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ const SCENE_MAP: Dictionary = {
|
|||
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"),
|
||||
GameBall.Type.BEACH: preload("res://src/equipment/balls/beach_ball/beach_ball.tscn"),
|
||||
}
|
||||
|
||||
@export var ball: GameBall:
|
||||
|
|
|
@ -319,6 +319,7 @@ func _show_shot_projection() -> void:
|
|||
tween.tween_property(shot_projection, "initial_speed", shot_speed, CAMERA_SNAP_TIME).set_trans(
|
||||
Tween.TRANS_QUAD
|
||||
)
|
||||
shot_projection.linear_damp = game_ball.linear_damp
|
||||
shot_projection.show()
|
||||
|
||||
|
||||
|
|
|
@ -426,6 +426,13 @@ stream_0/stream = ExtResource("15_fn6g1")
|
|||
|
||||
[node name="ShotSetup" type="Node3D"]
|
||||
script = ExtResource("1_r6ei4")
|
||||
driving_range = null
|
||||
initial_club_type = null
|
||||
initial_ball = null
|
||||
base_power = null
|
||||
base_curve = null
|
||||
perfect_aim = null
|
||||
keep_projection = null
|
||||
|
||||
[node name="BallPoint" type="Node3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
|
|
@ -40,6 +40,9 @@ const PUTT_ATTRITION := 0.8325 # green?
|
|||
## This can cause problems if there is a moving gravity field.
|
||||
@export var cache_gravity := true
|
||||
|
||||
## Linear damping factor of the shot.
|
||||
@export var linear_damp := 0.0
|
||||
|
||||
var _tick_counter := 0
|
||||
|
||||
var _debug_points: Array[Vector3] = []
|
||||
|
@ -103,6 +106,7 @@ func _process(_delta: float) -> void:
|
|||
# Integrate projectile path
|
||||
var next_pos := pos + vel * time_step + 0.5 * local_gravity * time_step * time_step
|
||||
vel += local_gravity * time_step
|
||||
vel *= maxf(1 - linear_damp * time_step, 0)
|
||||
|
||||
# Collision
|
||||
if check_collision and Game.settings.projection_collisions:
|
||||
|
|
|
@ -8,6 +8,7 @@ const Y_OFFSET := {
|
|||
GameBall.Type.BASIC: 18,
|
||||
GameBall.Type.PLASMA: -14,
|
||||
GameBall.Type.BRICK: -46,
|
||||
GameBall.Type.BEACH: -78,
|
||||
}
|
||||
|
||||
@export var value: GameBall.Type:
|
||||
|
@ -17,6 +18,7 @@ const Y_OFFSET := {
|
|||
@onready var basic_icon: BallIcon = %BasicIcon
|
||||
@onready var plasma_icon: BallIcon = %PlasmaIcon
|
||||
@onready var brick_icon: BallIcon = %BrickIcon
|
||||
@onready var beach_icon: BallIcon = %BeachIcon
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -28,6 +30,7 @@ func set_state_for_player(player: WorldPlayer) -> void:
|
|||
basic_icon.quantity = player.get_balls(GameBall.Type.BASIC)
|
||||
plasma_icon.quantity = player.get_balls(GameBall.Type.PLASMA)
|
||||
brick_icon.quantity = player.get_balls(GameBall.Type.BRICK)
|
||||
beach_icon.quantity = player.get_balls(GameBall.Type.BEACH)
|
||||
if player.shot_setup:
|
||||
value = player.shot_setup.ball_type
|
||||
player.on_balls_changed.connect(_set_quantity)
|
||||
|
@ -41,6 +44,8 @@ func _get_icon(type: GameBall.Type) -> BallIcon:
|
|||
return plasma_icon
|
||||
GameBall.Type.BRICK:
|
||||
return brick_icon
|
||||
GameBall.Type.BEACH:
|
||||
return beach_icon
|
||||
return null
|
||||
|
||||
|
||||
|
|
|
@ -68,3 +68,11 @@ layout_mode = 2
|
|||
text = "BALL_BRICK"
|
||||
quantity = 0
|
||||
empty = true
|
||||
|
||||
[node name="BeachIcon" parent="GradientMask/BallList" instance=ExtResource("1_1v8xg")]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(120, 27)
|
||||
layout_mode = 2
|
||||
text = "BALL_BEACH"
|
||||
quantity = 0
|
||||
empty = true
|
||||
|
|
Loading…
Reference in New Issue