It's Cow Game! Version 2.04!
This commit is contained in:
commit
a9e1ed9ddd
3148 changed files with 95332 additions and 0 deletions
84
Objects/SkillSpecific/Trampoline/Trampoline.gd
Normal file
84
Objects/SkillSpecific/Trampoline/Trampoline.gd
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
extends Node2D
|
||||
|
||||
var cameraLimitTop
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
var riding = false
|
||||
|
||||
var cow
|
||||
|
||||
var velocity = 0
|
||||
var bounceVelocity = -110
|
||||
|
||||
var gravity = 80
|
||||
|
||||
var boingSoundPlayer:AudioStreamPlayer2D
|
||||
var boingSounds = []
|
||||
|
||||
var lastBoingIndex = -1
|
||||
|
||||
func _ready():
|
||||
cow = GameVariables.player
|
||||
cow.moved.connect(move_request)
|
||||
initialize_boing_sounds()
|
||||
|
||||
func initialize_boing_sounds():
|
||||
boingSoundPlayer = $BoingSounds
|
||||
boingSounds.append(load("res://Sounds/SFX/Boings/boing1.mp3"))
|
||||
boingSounds.append(load("res://Sounds/SFX/Boings/boing2.mp3"))
|
||||
boingSounds.append(load("res://Sounds/SFX/Boings/boing3.mp3"))
|
||||
boingSounds.append(load("res://Sounds/SFX/Boings/boing4.mp3"))
|
||||
boingSounds.append(load("res://Sounds/SFX/Boings/boing5.mp3"))
|
||||
|
||||
func play_boing():
|
||||
var newIndex = rng.randi_range(0, boingSounds.size() - 1)
|
||||
|
||||
if newIndex == lastBoingIndex:
|
||||
newIndex = rng.randi_range(0, boingSounds.size() - 1)
|
||||
|
||||
boingSoundPlayer.stream = boingSounds[newIndex]
|
||||
boingSoundPlayer.play()
|
||||
lastBoingIndex = newIndex
|
||||
|
||||
func _process(delta):
|
||||
if riding:
|
||||
cow.global_position = global_position + Vector2(0, 0.02)
|
||||
cow.movementTarget = cow.global_position
|
||||
|
||||
velocity += gravity * 1/2 * delta
|
||||
cow.get_node("Visuals").position.y += velocity * delta
|
||||
velocity += gravity * 1/2 * delta
|
||||
|
||||
if cow.get_node("Visuals").position.y > 0:
|
||||
bounce()
|
||||
|
||||
func move_request():
|
||||
if riding:
|
||||
get_off()
|
||||
|
||||
func bounce():
|
||||
cow.get_node("Visuals").position.y = 0
|
||||
velocity = bounceVelocity
|
||||
|
||||
LevelManager.add_XP("trampolining", 2)
|
||||
play_boing()
|
||||
|
||||
func get_off():
|
||||
riding = false
|
||||
cow.reset_visuals_pos()
|
||||
|
||||
velocity = 0
|
||||
GameVariables.camera.limit_top = cameraLimitTop
|
||||
|
||||
cow.global_position = global_position + Vector2(0, 110)
|
||||
GameVariables.player.change_state("Idle")
|
||||
|
||||
func ride():
|
||||
cameraLimitTop = GameVariables.camera.limit_top
|
||||
GameVariables.camera.limit_top = -10000
|
||||
|
||||
cow.clear_swimming_areas()
|
||||
cow.get_node("Visuals").position.y = 0
|
||||
velocity = bounceVelocity
|
||||
|
||||
riding = true
|
||||
BIN
Objects/SkillSpecific/Trampoline/Trampoline.png
Normal file
BIN
Objects/SkillSpecific/Trampoline/Trampoline.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
34
Objects/SkillSpecific/Trampoline/Trampoline.png.import
Normal file
34
Objects/SkillSpecific/Trampoline/Trampoline.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://tq7d2c37tlv3"
|
||||
path="res://.godot/imported/Trampoline.png-accc2e8b02c10e5015da2a4496bcc2fa.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Objects/SkillSpecific/Trampoline/Trampoline.png"
|
||||
dest_files=["res://.godot/imported/Trampoline.png-accc2e8b02c10e5015da2a4496bcc2fa.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
|
||||
51
Objects/SkillSpecific/Trampoline/trampoline.tscn
Normal file
51
Objects/SkillSpecific/Trampoline/trampoline.tscn
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://bkpxiwddsj0h7"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cujx1a8vwxsj8" path="res://Objects/world_object.tscn" id="1_1jysw"]
|
||||
[ext_resource type="Texture2D" uid="uid://tq7d2c37tlv3" path="res://Objects/SkillSpecific/Trampoline/Trampoline.png" id="2_sxxi5"]
|
||||
[ext_resource type="Script" path="res://Objects/SkillSpecific/Trampoline/Trampoline.gd" id="2_wtqje"]
|
||||
[ext_resource type="PackedScene" uid="uid://b5bu1x4r3cyy6" path="res://Interactions/Trampoline/Trampolinable.tscn" id="3_h3f42"]
|
||||
[ext_resource type="PackedScene" uid="uid://bqibe7ha6r5ls" path="res://Interactions/Interactable/interactable.tscn" id="4_hcos5"]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_2eb14"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("2_sxxi5")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_6d3e4"]
|
||||
radius = 111.018
|
||||
|
||||
[node name="Trampoline" instance=ExtResource("1_1jysw")]
|
||||
script = ExtResource("2_wtqje")
|
||||
|
||||
[node name="AnimatedSprite2D" parent="." index="0"]
|
||||
position = Vector2(0, 3)
|
||||
sprite_frames = SubResource("SpriteFrames_2eb14")
|
||||
|
||||
[node name="CollisionPolygon2D" parent="StaticBody2D" index="0"]
|
||||
polygon = PackedVector2Array(-117, 5, 115, 4, 106, 44, 67, 77, -72, 76, -114, 44)
|
||||
|
||||
[node name="Trampolinable" parent="." index="2" instance=ExtResource("3_h3f42")]
|
||||
|
||||
[node name="CollisionShape2D" parent="Trampolinable/InteractionArea" index="0"]
|
||||
shape = SubResource("CircleShape2D_6d3e4")
|
||||
|
||||
[node name="Interactable" parent="." index="3" instance=ExtResource("4_hcos5")]
|
||||
|
||||
[node name="Panel" parent="Interactable" index="1"]
|
||||
offset_left = -118.0
|
||||
offset_top = -70.0
|
||||
offset_right = 117.0
|
||||
offset_bottom = 53.0
|
||||
|
||||
[node name="BoingSounds" type="AudioStreamPlayer2D" parent="." index="4"]
|
||||
bus = &"SFX"
|
||||
|
||||
[editable path="Trampolinable"]
|
||||
[editable path="Interactable"]
|
||||
[editable path="Interactable/ActionMenu"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue