It's Cow Game! Version 2.04!
This commit is contained in:
commit
a9e1ed9ddd
3148 changed files with 95332 additions and 0 deletions
91
Objects/Beach/Ball/Ball.gd
Normal file
91
Objects/Beach/Ball/Ball.gd
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
extends RigidBody2D
|
||||
|
||||
class_name Ball
|
||||
|
||||
var kickedPower = 70
|
||||
var velocity = Vector2(2500, -1000)
|
||||
|
||||
var swimmingZones = []
|
||||
var skimSpeed = 70
|
||||
|
||||
var kickSoundPlayer
|
||||
var lastSoundIndex = -1
|
||||
var kickSounds = []
|
||||
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
func _ready():
|
||||
initialize_kick_sounds()
|
||||
|
||||
func initialize_kick_sounds():
|
||||
kickSoundPlayer = $KickSound
|
||||
kickSounds.append(preload("res://Sounds/SFX/Kick/kick1.mp3"))
|
||||
kickSounds.append(preload("res://Sounds/SFX/Kick/kick2.mp3"))
|
||||
kickSounds.append(preload("res://Sounds/SFX/Kick/kick3.mp3"))
|
||||
kickSounds.append(preload("res://Sounds/SFX/Kick/kick4.mp3"))
|
||||
kickSounds.append(preload("res://Sounds/SFX/Kick/kick5.mp3"))
|
||||
|
||||
func _process(delta):
|
||||
$SubViewport/Spatial/CharacterBody3D/MeshInstance3D.rotation.z += linear_velocity.x / 5999
|
||||
$SubViewport/Spatial/CharacterBody3D/MeshInstance3D.rotation.x += linear_velocity.y / 5999
|
||||
|
||||
var texture = $SubViewport.get_texture()
|
||||
$Sprite2D.texture = texture
|
||||
|
||||
handle_water()
|
||||
|
||||
func play_kick_sound():
|
||||
var newIndex = rng.randi_range(0, kickSounds.size() - 1)
|
||||
|
||||
if newIndex == lastSoundIndex:
|
||||
newIndex = rng.randi_range(0, kickSounds.size() - 1)
|
||||
|
||||
kickSoundPlayer.stream = kickSounds[newIndex]
|
||||
kickSoundPlayer.play()
|
||||
lastSoundIndex = newIndex
|
||||
|
||||
func handle_water():
|
||||
if swimmingZones.size() > 0:
|
||||
if !%Waves.visible:
|
||||
%Waves.visible = true
|
||||
|
||||
var mainSwimmingZone = swimmingZones[0]
|
||||
for zone in swimmingZones:
|
||||
if zone.swimmingSpeed <= mainSwimmingZone.swimmingSpeed:
|
||||
mainSwimmingZone = zone
|
||||
|
||||
%Waves.self_modulate = mainSwimmingZone.liquidColor
|
||||
else:
|
||||
%Waves.visible = false
|
||||
|
||||
if swimmingZones.size() > 0 and abs(linear_velocity.length()) > skimSpeed:
|
||||
linear_damp = 1
|
||||
$WaterSpray.emitting = true
|
||||
else:
|
||||
linear_damp = 0.6
|
||||
$WaterSpray.emitting = false
|
||||
|
||||
func add_swimming_area(swimmingArea):
|
||||
swimmingZones.append(swimmingArea)
|
||||
|
||||
func remove_swimming_area(swimmingArea):
|
||||
swimmingZones.erase(swimmingArea)
|
||||
|
||||
func _on_kick_zone_body_entered(body):
|
||||
if visible:
|
||||
if (body is Cow) or (body is Pigeon) or (body is Seagull):
|
||||
var kickDirection:Vector2 = global_position - body.global_position
|
||||
kickDirection = kickDirection.normalized()
|
||||
|
||||
var kickForce = kickDirection * kickedPower
|
||||
apply_central_impulse(kickForce)
|
||||
play_kick_sound()
|
||||
elif body is NPC and body.characterName == "Kid":
|
||||
var kickDirection:Vector2 = global_position - body.global_position
|
||||
kickDirection = kickDirection.normalized()
|
||||
|
||||
var kickForce = kickDirection * kickedPower * 3
|
||||
apply_central_impulse(kickForce)
|
||||
play_kick_sound()
|
||||
|
||||
AchievementManager.complete_achievement("Sports")
|
||||
99
Objects/Beach/Ball/Ball.tscn
Normal file
99
Objects/Beach/Ball/Ball.tscn
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
[gd_scene load_steps=12 format=3 uid="uid://8jef5kumlrl1"]
|
||||
|
||||
[ext_resource type="Script" path="res://Objects/Beach/Ball/Ball.gd" id="1_mmm50"]
|
||||
[ext_resource type="PackedScene" uid="uid://bge2o2ibggnr2" path="res://Objects/Beach/Ball/Spatial.tscn" id="2_pkbtd"]
|
||||
[ext_resource type="Texture2D" uid="uid://x8knv88cjk5n" path="res://Objects/Beach/Ball/Waves1.png" id="4_vqs18"]
|
||||
[ext_resource type="Texture2D" uid="uid://dvjr4e2vm8so0" path="res://Objects/Beach/Ball/Waves2.png" id="5_w64jh"]
|
||||
[ext_resource type="Script" path="res://Utils/PlayOnReady.gd" id="6_5dfrg"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_t8pqq"]
|
||||
friction = 0.8
|
||||
bounce = 0.9
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_23c5e"]
|
||||
radius = 28.0
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_p8h04"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("4_vqs18")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("5_w64jh")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 1.5
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_j5o7d"]
|
||||
radius = 45.1774
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_w7c4l"]
|
||||
offsets = PackedFloat32Array(0, 0.673387, 1)
|
||||
colors = PackedColorArray(0.756863, 1, 1, 1, 0.756863, 1, 1, 1, 0.756863, 1, 1, 0)
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_0uknw"]
|
||||
radius = 13.0384
|
||||
|
||||
[node name="Ball" type="RigidBody2D"]
|
||||
mass = 0.1
|
||||
physics_material_override = SubResource("PhysicsMaterial_t8pqq")
|
||||
gravity_scale = 0.0
|
||||
can_sleep = false
|
||||
lock_rotation = true
|
||||
linear_damp = 0.6
|
||||
angular_damp = 30.0
|
||||
script = ExtResource("1_mmm50")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_23c5e")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
|
||||
[node name="Waves" type="AnimatedSprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
scale = Vector2(0.4, 0.4)
|
||||
sprite_frames = SubResource("SpriteFrames_p8h04")
|
||||
frame_progress = 0.0419452
|
||||
script = ExtResource("6_5dfrg")
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="."]
|
||||
own_world_3d = true
|
||||
transparent_bg = true
|
||||
size = Vector2i(80, 80)
|
||||
|
||||
[node name="Spatial" parent="SubViewport" instance=ExtResource("2_pkbtd")]
|
||||
|
||||
[node name="KickZone" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KickZone"]
|
||||
shape = SubResource("CircleShape2D_j5o7d")
|
||||
|
||||
[node name="WaterSpray" type="CPUParticles2D" parent="."]
|
||||
z_as_relative = false
|
||||
y_sort_enabled = true
|
||||
position = Vector2(0, 20)
|
||||
emitting = false
|
||||
amount = 160
|
||||
emission_shape = 1
|
||||
emission_sphere_radius = 15.7
|
||||
direction = Vector2(0, -10)
|
||||
gravity = Vector2(0, 200)
|
||||
initial_velocity_min = 108.11
|
||||
initial_velocity_max = 148.65
|
||||
color = Color(0.756863, 1, 1, 1)
|
||||
color_ramp = SubResource("Gradient_w7c4l")
|
||||
|
||||
[node name="KickSound" type="AudioStreamPlayer2D" parent="."]
|
||||
bus = &"SFX"
|
||||
|
||||
[node name="WaterZone" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="WaterZone"]
|
||||
position = Vector2(0, 8)
|
||||
shape = SubResource("CircleShape2D_0uknw")
|
||||
|
||||
[connection signal="body_entered" from="KickZone" to="." method="_on_kick_zone_body_entered"]
|
||||
22
Objects/Beach/Ball/QuestBall.gd
Normal file
22
Objects/Beach/Ball/QuestBall.gd
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
extends Ball
|
||||
|
||||
var stateCheckTimer = 0.3
|
||||
|
||||
func _ready():
|
||||
state_check()
|
||||
super._ready()
|
||||
|
||||
func _process(delta):
|
||||
super._process(delta)
|
||||
stateCheckTimer -= delta
|
||||
if stateCheckTimer <= 0:
|
||||
stateCheckTimer = 0.3
|
||||
state_check()
|
||||
|
||||
func state_check():
|
||||
if SaveManager.get_save_value("ambiQuestStarted", false):
|
||||
visible = true
|
||||
$CollisionShape2D.disabled = false
|
||||
else:
|
||||
visible = false
|
||||
$CollisionShape2D.disabled = true
|
||||
9
Objects/Beach/Ball/SealBall.gd
Normal file
9
Objects/Beach/Ball/SealBall.gd
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
extends Ball
|
||||
|
||||
var spinSpeed = 3
|
||||
|
||||
func _process(delta):
|
||||
$SubViewport/Spatial/CharacterBody3D/MeshInstance3D.rotation.z += spinSpeed * delta
|
||||
|
||||
var texture = $SubViewport.get_texture()
|
||||
$Sprite2D.texture = texture
|
||||
16
Objects/Beach/Ball/SealBall.tscn
Normal file
16
Objects/Beach/Ball/SealBall.tscn
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bwbddg5e5xi54"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://8jef5kumlrl1" path="res://Objects/Beach/Ball/Ball.tscn" id="1_rdapw"]
|
||||
[ext_resource type="Script" path="res://Objects/Beach/Ball/SealBall.gd" id="2_eyx3o"]
|
||||
|
||||
[node name="SealBall" instance=ExtResource("1_rdapw")]
|
||||
script = ExtResource("2_eyx3o")
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="0"]
|
||||
disabled = true
|
||||
|
||||
[node name="KickZone" parent="." index="3"]
|
||||
monitoring = false
|
||||
monitorable = false
|
||||
|
||||
[editable path="SubViewport/Spatial"]
|
||||
29
Objects/Beach/Ball/Spatial.tscn
Normal file
29
Objects/Beach/Ball/Spatial.tscn
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://bge2o2ibggnr2"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://difacm7aegyk3" path="res://Objects/Beach/Ball/ball-export.png" id="1_86fkq"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_hm2uv"]
|
||||
albedo_texture = ExtResource("1_86fkq")
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_y1tl5"]
|
||||
material = SubResource("StandardMaterial3D_hm2uv")
|
||||
radius = 1.0
|
||||
height = 2.0
|
||||
|
||||
[node name="Spatial" type="Node3D"]
|
||||
|
||||
[node name="CharacterBody3D" type="CharacterBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.0889638, -0.996035, 0, 0.996035, 0.0889638, 0, 0, 0)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="CharacterBody3D"]
|
||||
mesh = SubResource("SphereMesh_y1tl5")
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.581355, 4.93055, 0)
|
||||
light_energy = 6.0
|
||||
light_indirect_energy = 5.0
|
||||
shadow_enabled = true
|
||||
omni_range = 5.315
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 1.961, 0)
|
||||
BIN
Objects/Beach/Ball/Waves1.png
Normal file
BIN
Objects/Beach/Ball/Waves1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 667 B |
34
Objects/Beach/Ball/Waves1.png.import
Normal file
34
Objects/Beach/Ball/Waves1.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://x8knv88cjk5n"
|
||||
path="res://.godot/imported/Waves1.png-be8a385ab172eadef5f060e12971458e.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Objects/Beach/Ball/Waves1.png"
|
||||
dest_files=["res://.godot/imported/Waves1.png-be8a385ab172eadef5f060e12971458e.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=false
|
||||
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=1
|
||||
BIN
Objects/Beach/Ball/Waves2.png
Normal file
BIN
Objects/Beach/Ball/Waves2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 701 B |
34
Objects/Beach/Ball/Waves2.png.import
Normal file
34
Objects/Beach/Ball/Waves2.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dvjr4e2vm8so0"
|
||||
path="res://.godot/imported/Waves2.png-87399cba2a15ca2e67e3b229be27f32d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Objects/Beach/Ball/Waves2.png"
|
||||
dest_files=["res://.godot/imported/Waves2.png-87399cba2a15ca2e67e3b229be27f32d.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=false
|
||||
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=1
|
||||
BIN
Objects/Beach/Ball/ball-export.png
Normal file
BIN
Objects/Beach/Ball/ball-export.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
35
Objects/Beach/Ball/ball-export.png.import
Normal file
35
Objects/Beach/Ball/ball-export.png.import
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://difacm7aegyk3"
|
||||
path.s3tc="res://.godot/imported/ball-export.png-f37b375c01520369018cde0a8be57756.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Objects/Beach/Ball/ball-export.png"
|
||||
dest_files=["res://.godot/imported/ball-export.png-f37b375c01520369018cde0a8be57756.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue