Merge branch 'main' of community.rokojori.com:eggnot/first_anniversary_godot_jam into main

This commit is contained in:
ruinthread-games 2024-04-20 17:59:09 +02:00
commit d71779ab5c
17 changed files with 700 additions and 533 deletions

View File

@ -1,284 +1,13 @@
[gd_scene load_steps=35 format=2]
[gd_scene load_steps=12 format=2]
[ext_resource path="res://scripts/OnMusicChangedSlowTrigger.gd" type="Script" id=1]
[ext_resource path="res://3d_platforma/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://3d_platforma/golden_bay_512.hdr" type="Texture" id=2]
[ext_resource path="res://3d_platforma/sqare_norm.png" type="Texture" id=4]
[ext_resource path="res://scripts/Library/Actions/Snare Admiral 2.wav" type="AudioStream" id=3]
[ext_resource path="res://3d_platforma/Level1_platforms_slow.tscn" type="PackedScene" id=4]
[ext_resource path="res://3d_platforma/texture_08.png" type="Texture" id=5]
[sub_resource type="CubeMesh" id=1]
[sub_resource type="MultiMesh" id=2]
mesh = SubResource( 1 )
[sub_resource type="GDScript" id=3]
resource_name = "Player"
script/source = "extends KinematicBody
export var move_speed := 12.0
export var jump_force := 30.0
export var gravity := 0.98
export var max_fall_speed := 30
export var look_sens_h := 0.2
var is_on_floor_prev := false
onready var anim = $Mesh/AnimationPlayer
var y_velo = 0
func _ready():
anim.get_animation(\"walk\").set_loop(true)
func _input(event):
if event is InputEventMouseMotion:
rotation_degrees.y -= event.relative.x * look_sens_h
if event.is_action_pressed(\"ui_end\"):
global_translation = Vector3.ZERO
func _physics_process(_delta):
var move_vec = Vector3()
if Input.is_action_pressed(\"move_forward\"):
move_vec.z -= 1
if Input.is_action_pressed(\"move_backwards\"):
move_vec.z += 1
if Input.is_action_pressed(\"move_right\"):
move_vec.x += 1
if Input.is_action_pressed(\"move_left\"):
move_vec.x -= 1
move_vec = move_vec.normalized()
move_vec = move_vec.rotated(Vector3(0, 1, 0), rotation.y)
move_vec *= move_speed
move_vec.y = y_velo
var _vel:Vector3 = move_and_slide(move_vec, Vector3(0, 1, 0))
# questionable???
if is_on_floor_prev and not is_on_floor():
$CoyoteJump.start()
is_on_floor_prev = is_on_floor()
var grounded :bool= is_on_floor() or not $CoyoteJump.is_stopped()
y_velo -= gravity
var just_jumped := false
if Input.is_action_just_pressed(\"jump\") and grounded:
just_jumped = true
y_velo = jump_force
if grounded and y_velo <= 0:
y_velo = -0.1
if y_velo < -max_fall_speed:
y_velo = -max_fall_speed
if just_jumped:
play_anim(\"jump\")
elif grounded:
if move_vec.x == 0 and move_vec.z == 0:
play_anim(\"idle\")
else:
play_anim(\"walk\")
func play_anim(name):
if anim.current_animation == name:
return
anim.play(name)
"
[sub_resource type="CapsuleShape" id=4]
radius = 0.202191
height = 1.09113
[sub_resource type="CylinderShape" id=32]
height = 0.224826
radius = 0.194837
[sub_resource type="GDScript" id=11]
resource_name = "Camera"
script/source = "extends Spatial
export var look_sens_v := 0.5
#this will not work
export(float) onready var not_working := 0.1
func _ready() -> void:
pass
func _input(event):
if event is InputEventMouseMotion:
rotation_degrees.x -= event.relative.y * look_sens_v
rotation_degrees.x = clamp(rotation_degrees.x, -90, 90)
if event is InputEventMouseButton:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
if event.is_action_pressed(\"ui_focus_next\"):
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
"
[sub_resource type="CylinderMesh" id=31]
radial_segments = 8
rings = 0
[sub_resource type="SpatialMaterial" id=33]
albedo_color = Color( 0.08, 0.08, 0.08, 1 )
roughness = 0.73
[sub_resource type="QuadMesh" id=34]
size = Vector2( 0.3, 0.5 )
[sub_resource type="SpatialMaterial" id=35]
emission_enabled = true
emission = Color( 0.95, 0.95, 0.95, 1 )
emission_energy = 10.0
emission_operator = 0
emission_on_uv2 = false
[sub_resource type="SpatialMaterial" id=19]
params_cull_mode = 2
albedo_color = Color( 0.752941, 0, 0, 1 )
[sub_resource type="Animation" id=6]
length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath("Body:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector3( 1, 1, 1 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Body:translation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector3( 0, 0.744519, 0 ) ]
}
[sub_resource type="Animation" id=7]
resource_name = "idle"
length = 2.0
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("Body:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1, 2 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Vector3( 1, 1, 1 ), Vector3( 1.1, 1.1, 1 ), Vector3( 1, 1, 1 ) ]
}
[sub_resource type="Animation" id=8]
resource_name = "jump"
length = 0.6
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("Body:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.3, 0.6 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Vector3( 1.07, 1.07, 1 ), Vector3( 1.07, 1.07, 1.07262 ), Vector3( 1.07, 1.07, 1 ) ]
}
[sub_resource type="Animation" id=9]
resource_name = "walk"
length = 0.4
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("Body:translation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
"update": 0,
"values": [ Vector3( 0, 0.744519, 0 ), Vector3( 0, 0.763796, 0 ), Vector3( 0, 0.744519, 0 ), Vector3( 0, 0.763796, 0 ), Vector3( 0, 0.744519, 0 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Body:rotation_degrees:z")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.1, 0.3, 0.4 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 0,
"values": [ 0.0, 10.0, -10.0, 0.0 ]
}
[sub_resource type="PlaneMesh" id=18]
material = SubResource( 19 )
size = Vector2( 0.16, 1.6 )
subdivide_depth = 8
[sub_resource type="GDScript" id=17]
resource_name = "Shadow"
script/source = "extends Spatial
export var offset := 0.25
func _process(_delta) -> void:
var collide :bool= $RayCast.is_colliding()
$Circle.visible = collide
if collide:
var py:float = $RayCast.get_collision_point().y
$Circle.global_translation.y = py + offset
"
[sub_resource type="Gradient" id=13]
offsets = PoolRealArray( 0.103704, 0.422222, 0.766667 )
colors = PoolColorArray( 0, 0, 0, 1, 0, 0, 0, 0.447059, 0, 0, 0, 0 )
[sub_resource type="GradientTexture2D" id=14]
gradient = SubResource( 13 )
width = 32
height = 32
fill = 1
fill_from = Vector2( 0.5, 0.5 )
fill_to = Vector2( 1, 0.5 )
[sub_resource type="SpatialMaterial" id=15]
flags_transparent = true
flags_unshaded = true
albedo_texture = SubResource( 14 )
[sub_resource type="QuadMesh" id=16]
material = SubResource( 15 )
size = Vector2( 0.75, 0.75 )
[ext_resource path="res://scripts/Library/Actions/TriggerOnReady.gd" type="Script" id=6]
[ext_resource path="res://scripts/Library/Actions/ActionList.gd" type="Script" id=7]
[ext_resource path="res://scripts/Library/Actions/SFX BlackTiger.wav" type="AudioStream" id=8]
[sub_resource type="SpatialMaterial" id=36]
resource_name = "CheckerGrid"
@ -287,47 +16,6 @@ albedo_texture = ExtResource( 5 )
roughness = 0.85
uv1_triplanar = true
[sub_resource type="Animation" id=37]
resource_name = "move"
length = 30.0
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath(".:translation:y")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 10, 30 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ 0.0, 10.0, 0.0 ]
}
[sub_resource type="BoxShape" id=20]
[sub_resource type="CubeMesh" id=21]
[sub_resource type="OpenSimplexNoise" id=28]
octaves = 2
period = 0.8
[sub_resource type="NoiseTexture" id=29]
flags = 3
width = 32
height = 32
noise = SubResource( 28 )
[sub_resource type="SpatialMaterial" id=22]
albedo_color = Color( 0.603922, 0.0235294, 0.619608, 1 )
roughness = 0.25
roughness_texture = SubResource( 29 )
normal_enabled = true
normal_scale = 1.0
normal_texture = ExtResource( 4 )
uv1_scale = Vector3( 3, 3, 3 )
uv1_triplanar = true
[sub_resource type="PanoramaSky" id=23]
panorama = ExtResource( 2 )
@ -356,207 +44,17 @@ glow_hdr_scale = 4.0
[node name="Game" type="Spatial"]
[node name="MultiMeshInstance" type="MultiMeshInstance" parent="."]
multimesh = SubResource( 2 )
[node name="Player" type="KinematicBody" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2 )
collision_layer = 2
script = SubResource( 3 )
move_speed = 3.2
jump_force = 20.0
gravity = 1.2
[node name="CollisionShape" type="CollisionShape" parent="Player"]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.724957, 0 )
shape = SubResource( 4 )
[node name="CollisionShape2" type="CollisionShape" parent="Player"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.884122, 0 )
shape = SubResource( 32 )
[node name="CamRoot" type="Spatial" parent="Player"]
script = SubResource( 11 )
[node name="Camera" type="ClippedCamera" parent="Player/CamRoot"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.2, 4 )
current = true
margin = 0.1
process_mode = 1
[node name="Mesh" type="Spatial" parent="Player"]
[node name="Body" type="Spatial" parent="Player/Mesh"]
transform = Transform( 0.976315, -0.216353, 9.45709e-09, 0, -4.37114e-08, -1, 0.216353, 0.976315, -4.26761e-08, 0, 0.744519, 0 )
[node name="Body" type="MeshInstance" parent="Player/Mesh/Body"]
transform = Transform( 0.195555, 0, 0, 0, -1.04907e-08, 0.135018, 0, -0.24, -5.90182e-09, 0, 0, 0 )
mesh = SubResource( 31 )
material/0 = SubResource( 33 )
[node name="Body2" type="MeshInstance" parent="Player/Mesh/Body"]
transform = Transform( 0.0876868, 0, 0, 0, -1.1745e-08, -0.0631662, 0, 0.268694, -2.76108e-09, -0.122125, 0.049392, 0.057337 )
mesh = SubResource( 31 )
material/0 = SubResource( 33 )
[node name="Body3" type="MeshInstance" parent="Player/Mesh/Body"]
transform = Transform( 0.0876868, 0, 0, 0, -1.1745e-08, -0.0631662, 0, 0.268694, -2.76108e-09, 0.123573, 0.0493927, 0.0573372 )
mesh = SubResource( 31 )
material/0 = SubResource( 33 )
[node name="head" type="MeshInstance" parent="Player/Mesh/Body"]
transform = Transform( 0.088, 0, 0, 0, -4.19629e-09, 0.08, 0, -0.096, -3.49691e-09, 0, 0, -0.339126 )
mesh = SubResource( 31 )
material/0 = SubResource( 33 )
[node name="eye_left" type="MeshInstance" parent="Player/Mesh/Body/head"]
transform = Transform( 1, 0, 0, 0, -1, 8.74228e-08, 0, -8.74228e-08, -1, 0.568194, 0.255432, -1.05656 )
mesh = SubResource( 34 )
material/0 = SubResource( 35 )
[node name="eye_right" type="MeshInstance" parent="Player/Mesh/Body/head"]
transform = Transform( 1, 0, 0, 0, -1, 8.74228e-08, 0, -8.74228e-08, -1, -0.365176, 0.255432, -1.05656 )
mesh = SubResource( 34 )
material/0 = SubResource( 35 )
[node name="OmniLight" type="SpotLight" parent="Player/Mesh/Body/head"]
transform = Transform( 11.3636, 0, 0, 0, 10.4167, -2.21659e-13, 0, 2.1684e-19, 12.5, 0, 0.257117, -0.572075 )
light_energy = 0.75
spot_range = 4.51976
spot_attenuation = 1.31951
spot_angle = 66.4019
[node name="hat_top" type="MeshInstance" parent="Player/Mesh/Body"]
transform = Transform( 0.1056, 0, 0, 0, -5.03555e-09, 0.096, 0, -0.1152, -4.19629e-09, 0, 0, -0.578262 )
mesh = SubResource( 31 )
material/0 = SubResource( 33 )
[node name="hat_bottom" type="MeshInstance" parent="Player/Mesh/Body"]
transform = Transform( 0.2024, 0, 0, 0, -1.25889e-09, 0.184, 0, -0.0288, -8.0429e-09, 0, 0, -0.464094 )
mesh = SubResource( 31 )
material/0 = SubResource( 33 )
[node name="scarf" type="MeshInstance" parent="Player/Mesh/Body"]
transform = Transform( 0.17204, 0, 0, 0, -1.39107e-09, 0.1564, 0, -0.031824, -6.83646e-09, 0, 0, -0.271663 )
mesh = SubResource( 31 )
material/0 = SubResource( 19 )
[node name="LegR" type="CSGCylinder" parent="Player/Mesh/Body"]
transform = Transform( 0.99863, -0.0659433, 1.81562e-09, 0, -5.50763e-08, -0.793651, 0.052336, 1.25827, -3.4644e-08, 0.0637822, 0, 0.548993 )
radius = 0.1
height = 0.5
cone = true
material = SubResource( 33 )
[node name="LegL" type="CSGCylinder" parent="Player/Mesh/Body"]
transform = Transform( 0.99863, 0.0659433, -1.81562e-09, 0, -5.50763e-08, -0.793651, -0.052336, 1.25827, -3.4644e-08, -0.0650757, 0, 0.548993 )
radius = 0.1
height = 0.5
cone = true
material = SubResource( 33 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="Player/Mesh"]
anims/RESET = SubResource( 6 )
anims/idle = SubResource( 7 )
anims/jump = SubResource( 8 )
anims/walk = SubResource( 9 )
[node name="SoftBody" type="SoftBody" parent="Player"]
transform = Transform( -1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1.04064, 0.928791 )
mesh = SubResource( 18 )
collision_layer = 2
collision_mask = 3
damping_coefficient = 0.1
drag_coefficient = 0.1
ray_pickable = false
pinned_points = [ 0, 1 ]
attachments/0/point_index = 0
attachments/0/spatial_attachment_path = NodePath("..")
attachments/0/offset = Vector3( -0.0800001, 1.04064, 0.128791 )
attachments/1/point_index = 1
attachments/1/spatial_attachment_path = NodePath("..")
attachments/1/offset = Vector3( 0.0799999, 1.04064, 0.128791 )
[node name="Shadow" type="Spatial" parent="Player"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.02, 0 )
script = SubResource( 17 )
offset = 0.02
[node name="Circle" type="MeshInstance" parent="Player/Shadow"]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0 )
mesh = SubResource( 16 )
skeleton = NodePath("../..")
[node name="RayCast" type="RayCast" parent="Player/Shadow"]
enabled = true
cast_to = Vector3( 0, -50, 0 )
[node name="CoyoteJump" type="Timer" parent="Player"]
wait_time = 0.16
one_shot = true
[node name="Platforms" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.1, 0 )
[node name="start" type="CSGBox" parent="Platforms"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 )
[node name="start" type="CSGBox" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.1, 0 )
use_collision = true
width = 10.0
width = 6.05148
height = 0.2
depth = 10.0
depth = 6.62613
material = SubResource( 36 )
[node name="thin" type="CSGBox" parent="Platforms"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, -12 )
use_collision = true
width = 4.0
height = 0.2
depth = 10.0
material = SubResource( 36 )
[node name="Player" parent="." instance=ExtResource( 1 )]
[node name="ramp" type="CSGBox" parent="Platforms"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.4, -22 )
use_collision = true
width = 4.0
height = 1.0
depth = 10.0
material = SubResource( 36 )
[node name="lift" type="Spatial" parent="Platforms"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.4, -30 )
[node name="platform" type="CSGBox" parent="Platforms/lift"]
use_collision = true
width = 4.0
height = 1.0
depth = 4.0
material = SubResource( 36 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="Platforms/lift/platform"]
autoplay = "move"
anims/move = SubResource( 37 )
[node name="lego" type="StaticBody" parent="Platforms"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5, -1.9, -8 )
__meta__ = {
"_edit_group_": true
}
[node name="CollisionShape" type="CollisionShape" parent="Platforms/lego"]
shape = SubResource( 20 )
[node name="MeshInstance" type="MeshInstance" parent="Platforms/lego"]
mesh = SubResource( 21 )
material/0 = SubResource( 22 )
[node name="CSGPolygon" type="CSGPolygon" parent="Platforms"]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 1, -12 )
use_collision = true
polygon = PoolVector2Array( 3, -4, 3, 1, 4, 1, 4, -4 )
mode = 1
spin_degrees = 360.0
spin_sides = 16
material = SubResource( 36 )
[node name="platforms_slow" parent="." instance=ExtResource( 4 )]
[node name="DirectionalLight" type="DirectionalLight" parent="."]
transform = Transform( 0.707107, -0.5, 0.5, 0, 0.707107, 0.707107, -0.707107, -0.5, 0.5, 0, 5, 0 )
@ -565,5 +63,21 @@ light_energy = 0.65
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource( 24 )
[node name="MusicChangedSlowAction" type="Node" parent="."]
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource( 3 )
[node name="AudioStreamPlayer3D2" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource( 8 )
[node name="TriggerOnReady" type="Node" parent="."]
script = ExtResource( 6 )
action = NodePath("../ActionList")
[node name="ActionList" type="Node" parent="."]
script = ExtResource( 7 )
[node name="PlaySound" type="Node" parent="ActionList"]
script = ExtResource( 1 )
[node name="PlaySound2" type="Node" parent="ActionList"]
script = ExtResource( 1 )

View File

@ -0,0 +1,107 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://3d_platforma/texture_08.png" type="Texture" id=1]
[ext_resource path="res://3d_platforma/sqare_norm.png" type="Texture" id=2]
[sub_resource type="SpatialMaterial" id=36]
resource_name = "CheckerGrid"
albedo_color = Color( 0.85, 0.85, 0.85, 1 )
albedo_texture = ExtResource( 1 )
roughness = 0.85
uv1_triplanar = true
[sub_resource type="Animation" id=37]
resource_name = "move"
length = 30.0
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath(".:translation:y")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 10, 30 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ 0.0, 10.0, 0.0 ]
}
[sub_resource type="BoxShape" id=20]
[sub_resource type="CubeMesh" id=21]
[sub_resource type="OpenSimplexNoise" id=28]
octaves = 2
period = 0.8
[sub_resource type="NoiseTexture" id=29]
flags = 3
width = 32
height = 32
noise = SubResource( 28 )
[sub_resource type="SpatialMaterial" id=22]
albedo_color = Color( 0.603922, 0.0235294, 0.619608, 1 )
roughness = 0.25
roughness_texture = SubResource( 29 )
normal_enabled = true
normal_scale = 1.0
normal_texture = ExtResource( 2 )
uv1_scale = Vector3( 3, 3, 3 )
uv1_triplanar = true
[node name="platforms_slow" type="Spatial"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.1, 0 )
[node name="thin" type="CSGBox" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, -12 )
use_collision = true
width = 4.0
height = 0.2
depth = 10.0
material = SubResource( 36 )
[node name="ramp" type="CSGBox" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.4, -22 )
use_collision = true
width = 4.0
height = 1.0
depth = 10.0
material = SubResource( 36 )
[node name="lift" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.4, -30 )
[node name="platform" type="CSGBox" parent="lift"]
use_collision = true
width = 4.0
height = 1.0
depth = 4.0
material = SubResource( 36 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="lift/platform"]
autoplay = "move"
anims/move = SubResource( 37 )
[node name="lego" type="StaticBody" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5, -1.9, -8 )
__meta__ = {
"_edit_group_": true
}
[node name="CollisionShape" type="CollisionShape" parent="lego"]
shape = SubResource( 20 )
[node name="MeshInstance" type="MeshInstance" parent="lego"]
mesh = SubResource( 21 )
material/0 = SubResource( 22 )
[node name="CSGPolygon" type="CSGPolygon" parent="."]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 1, -12 )
use_collision = true
polygon = PoolVector2Array( 3, -4, 3, 1, 4.15364, 1.29316, 4, -4 )
mode = 1
spin_degrees = 360.0
spin_sides = 16
material = SubResource( 36 )

407
3d_platforma/Player.tscn Normal file
View File

@ -0,0 +1,407 @@
[gd_scene load_steps=20 format=2]
[sub_resource type="GDScript" id=3]
resource_name = "Player"
script/source = "extends KinematicBody
export var move_speed := 12.0
export var jump_force := 30.0
export var gravity := 0.98
export var max_fall_speed := 30
export var look_sens_h := 0.2
var is_on_floor_prev := false
onready var anim = $Mesh/AnimationPlayer
var y_velo = 0
func _ready():
anim.get_animation(\"walk\").set_loop(true)
func _input(event):
if event is InputEventMouseMotion:
rotation_degrees.y -= event.relative.x * look_sens_h
if event.is_action_pressed(\"ui_end\"):
global_translation = Vector3.ZERO
func _physics_process(_delta):
var move_vec = Vector3()
if Input.is_action_pressed(\"move_forward\"):
move_vec.z -= 1
if Input.is_action_pressed(\"move_backwards\"):
move_vec.z += 1
if Input.is_action_pressed(\"move_right\"):
move_vec.x += 1
if Input.is_action_pressed(\"move_left\"):
move_vec.x -= 1
move_vec = move_vec.normalized()
move_vec = move_vec.rotated(Vector3(0, 1, 0), rotation.y)
move_vec *= move_speed
move_vec.y = y_velo
var _vel:Vector3 = move_and_slide(move_vec, Vector3(0, 1, 0))
# questionable???
if is_on_floor_prev and not is_on_floor():
$CoyoteJump.start()
is_on_floor_prev = is_on_floor()
var grounded :bool= is_on_floor() or not $CoyoteJump.is_stopped()
y_velo -= gravity
var just_jumped := false
if Input.is_action_just_pressed(\"jump\") and grounded:
just_jumped = true
y_velo = jump_force
if grounded and y_velo <= 0:
y_velo = -0.1
if y_velo < -max_fall_speed:
y_velo = -max_fall_speed
if just_jumped:
play_anim(\"jump\")
elif grounded:
if move_vec.x == 0 and move_vec.z == 0:
play_anim(\"idle\")
else:
play_anim(\"walk\")
func play_anim(name):
if anim.current_animation == name:
return
anim.play(name)
"
[sub_resource type="CapsuleShape" id=4]
radius = 0.202191
height = 1.09113
[sub_resource type="CylinderShape" id=32]
height = 0.224826
radius = 0.194837
[sub_resource type="GDScript" id=11]
resource_name = "Camera"
script/source = "extends Spatial
export var look_sens_v := 0.5
#this will not work
export(float) onready var not_working := 0.1
func _ready() -> void:
pass
func _input(event):
if event is InputEventMouseMotion:
rotation_degrees.x -= event.relative.y * look_sens_v
rotation_degrees.x = clamp(rotation_degrees.x, -90, 90)
if event is InputEventMouseButton:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
if event.is_action_pressed(\"ui_focus_next\"):
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
"
[sub_resource type="CylinderMesh" id=31]
radial_segments = 8
rings = 0
[sub_resource type="SpatialMaterial" id=33]
albedo_color = Color( 0.08, 0.08, 0.08, 1 )
roughness = 0.73
[sub_resource type="QuadMesh" id=34]
size = Vector2( 0.3, 0.5 )
[sub_resource type="SpatialMaterial" id=35]
emission_enabled = true
emission = Color( 0.95, 0.95, 0.95, 1 )
emission_energy = 10.0
emission_operator = 0
emission_on_uv2 = false
[sub_resource type="SpatialMaterial" id=19]
params_cull_mode = 2
albedo_color = Color( 0.752941, 0, 0, 1 )
[sub_resource type="Animation" id=6]
length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath("Body:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector3( 1, 1, 1 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Body:translation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector3( 0, 0.744519, 0 ) ]
}
[sub_resource type="Animation" id=7]
resource_name = "idle"
length = 2.0
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("Body:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1, 2 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Vector3( 1, 1, 1 ), Vector3( 1.1, 1.1, 1 ), Vector3( 1, 1, 1 ) ]
}
[sub_resource type="Animation" id=8]
resource_name = "jump"
length = 0.6
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("Body:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.3, 0.6 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Vector3( 1.07, 1.07, 1 ), Vector3( 1.07, 1.07, 1.07262 ), Vector3( 1.07, 1.07, 1 ) ]
}
[sub_resource type="Animation" id=9]
resource_name = "walk"
length = 0.4
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("Body:translation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
"update": 0,
"values": [ Vector3( 0, 0.744519, 0 ), Vector3( 0, 0.763796, 0 ), Vector3( 0, 0.744519, 0 ), Vector3( 0, 0.763796, 0 ), Vector3( 0, 0.744519, 0 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Body:rotation_degrees:z")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.1, 0.3, 0.4 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 0,
"values": [ 0.0, 10.0, -10.0, 0.0 ]
}
[sub_resource type="PlaneMesh" id=18]
material = SubResource( 19 )
size = Vector2( 0.16, 1.6 )
subdivide_depth = 8
[sub_resource type="GDScript" id=17]
resource_name = "Shadow"
script/source = "extends Spatial
export var offset := 0.25
func _process(_delta) -> void:
var collide :bool= $RayCast.is_colliding()
$Circle.visible = collide
if collide:
var py:float = $RayCast.get_collision_point().y
$Circle.global_translation.y = py + offset
"
[sub_resource type="Gradient" id=13]
offsets = PoolRealArray( 0.103704, 0.422222, 0.766667 )
colors = PoolColorArray( 0, 0, 0, 1, 0, 0, 0, 0.447059, 0, 0, 0, 0 )
[sub_resource type="GradientTexture2D" id=14]
gradient = SubResource( 13 )
width = 32
height = 32
fill = 1
fill_from = Vector2( 0.5, 0.5 )
fill_to = Vector2( 1, 0.5 )
[sub_resource type="SpatialMaterial" id=15]
flags_transparent = true
flags_unshaded = true
albedo_texture = SubResource( 14 )
[sub_resource type="QuadMesh" id=16]
material = SubResource( 15 )
size = Vector2( 0.75, 0.75 )
[node name="Player" type="KinematicBody"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2 )
collision_layer = 2
script = SubResource( 3 )
move_speed = 3.2
jump_force = 20.0
gravity = 1.2
[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.724957, 0 )
shape = SubResource( 4 )
[node name="CollisionShape2" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.884122, 0 )
shape = SubResource( 32 )
[node name="CamRoot" type="Spatial" parent="."]
script = SubResource( 11 )
[node name="Camera" type="ClippedCamera" parent="CamRoot"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.2, 4 )
current = true
margin = 0.1
process_mode = 1
[node name="Mesh" type="Spatial" parent="."]
[node name="Body" type="Spatial" parent="Mesh"]
transform = Transform( 0.976315, -0.216353, 9.45709e-09, 0, -4.37114e-08, -1, 0.216353, 0.976315, -4.26761e-08, 0, 0.744519, 0 )
[node name="Body" type="MeshInstance" parent="Mesh/Body"]
transform = Transform( 0.195555, 0, 0, 0, -1.04907e-08, 0.135018, 0, -0.24, -5.90182e-09, 0, 0, 0 )
mesh = SubResource( 31 )
material/0 = SubResource( 33 )
[node name="Body2" type="MeshInstance" parent="Mesh/Body"]
transform = Transform( 0.0876868, 0, 0, 0, -1.1745e-08, -0.0631662, 0, 0.268694, -2.76108e-09, -0.122125, 0.049392, 0.057337 )
mesh = SubResource( 31 )
material/0 = SubResource( 33 )
[node name="Body3" type="MeshInstance" parent="Mesh/Body"]
transform = Transform( 0.0876868, 0, 0, 0, -1.1745e-08, -0.0631662, 0, 0.268694, -2.76108e-09, 0.123573, 0.0493927, 0.0573372 )
mesh = SubResource( 31 )
material/0 = SubResource( 33 )
[node name="head" type="MeshInstance" parent="Mesh/Body"]
transform = Transform( 0.088, 0, 0, 0, -4.19629e-09, 0.08, 0, -0.096, -3.49691e-09, 0, 0, -0.339126 )
mesh = SubResource( 31 )
material/0 = SubResource( 33 )
[node name="eye_left" type="MeshInstance" parent="Mesh/Body/head"]
transform = Transform( 1, 0, 0, 0, -1, 8.74228e-08, 0, -8.74228e-08, -1, 0.568194, 0.255432, -1.05656 )
mesh = SubResource( 34 )
material/0 = SubResource( 35 )
[node name="eye_right" type="MeshInstance" parent="Mesh/Body/head"]
transform = Transform( 1, 0, 0, 0, -1, 8.74228e-08, 0, -8.74228e-08, -1, -0.365176, 0.255432, -1.05656 )
mesh = SubResource( 34 )
material/0 = SubResource( 35 )
[node name="OmniLight" type="SpotLight" parent="Mesh/Body/head"]
transform = Transform( 11.3636, 0, 0, 0, 10.4167, -2.21659e-13, 0, 2.1684e-19, 12.5, 0, 0.257117, -0.572075 )
light_energy = 0.75
spot_range = 4.51976
spot_attenuation = 1.31951
spot_angle = 66.4019
[node name="hat_top" type="MeshInstance" parent="Mesh/Body"]
transform = Transform( 0.1056, 0, 0, 0, -5.03555e-09, 0.096, 0, -0.1152, -4.19629e-09, 0, 0, -0.578262 )
mesh = SubResource( 31 )
material/0 = SubResource( 33 )
[node name="hat_bottom" type="MeshInstance" parent="Mesh/Body"]
transform = Transform( 0.2024, 0, 0, 0, -1.25889e-09, 0.184, 0, -0.0288, -8.0429e-09, 0, 0, -0.464094 )
mesh = SubResource( 31 )
material/0 = SubResource( 33 )
[node name="scarf" type="MeshInstance" parent="Mesh/Body"]
transform = Transform( 0.17204, 0, 0, 0, -1.39107e-09, 0.1564, 0, -0.031824, -6.83646e-09, 0, 0, -0.271663 )
mesh = SubResource( 31 )
material/0 = SubResource( 19 )
[node name="LegR" type="CSGCylinder" parent="Mesh/Body"]
transform = Transform( 0.99863, -0.0659433, 1.81562e-09, 0, -5.50763e-08, -0.793651, 0.052336, 1.25827, -3.4644e-08, 0.0637822, 0, 0.548993 )
radius = 0.1
height = 0.5
cone = true
material = SubResource( 33 )
[node name="LegL" type="CSGCylinder" parent="Mesh/Body"]
transform = Transform( 0.99863, 0.0659433, -1.81562e-09, 0, -5.50763e-08, -0.793651, -0.052336, 1.25827, -3.4644e-08, -0.0650757, 0, 0.548993 )
radius = 0.1
height = 0.5
cone = true
material = SubResource( 33 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="Mesh"]
anims/RESET = SubResource( 6 )
anims/idle = SubResource( 7 )
anims/jump = SubResource( 8 )
anims/walk = SubResource( 9 )
[node name="SoftBody" type="SoftBody" parent="."]
transform = Transform( -1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1.04064, 0.928791 )
mesh = SubResource( 18 )
collision_layer = 2
collision_mask = 3
damping_coefficient = 0.1
drag_coefficient = 0.1
ray_pickable = false
pinned_points = [ 0, 1 ]
attachments/0/point_index = 0
attachments/0/spatial_attachment_path = NodePath("..")
attachments/0/offset = Vector3( -0.0800001, 1.04064, 0.128791 )
attachments/1/point_index = 1
attachments/1/spatial_attachment_path = NodePath("..")
attachments/1/offset = Vector3( 0.0799999, 1.04064, 0.128791 )
[node name="Shadow" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.02, 0 )
script = SubResource( 17 )
offset = 0.02
[node name="Circle" type="MeshInstance" parent="Shadow"]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0 )
mesh = SubResource( 16 )
skeleton = NodePath("../..")
[node name="RayCast" type="RayCast" parent="Shadow"]
enabled = true
cast_to = Vector3( 0, -50, 0 )
[node name="CoyoteJump" type="Timer" parent="."]
wait_time = 0.16
one_shot = true

View File

@ -10,12 +10,48 @@ config_version=4
_global_script_classes=[ {
"base": "Node",
"class": "Action",
"language": "GDScript",
"path": "res://scripts/Library/Actions/Action.gd"
}, {
"base": "Action",
"class": "ActionList",
"language": "GDScript",
"path": "res://scripts/Library/Actions/ActionList.gd"
}, {
"base": "Node",
"class": "MusicChangedSlowAction",
"language": "GDScript",
"path": "res://scripts/OnMusicChangedSlowTrigger.gd"
"path": "res://scripts/TriggerOnMusicChangedSlow.gd"
}, {
"base": "Action",
"class": "PlaySound",
"language": "GDScript",
"path": "res://scripts/Library/Actions/PlaySound.gd"
}, {
"base": "Node",
"class": "TriggerBase",
"language": "GDScript",
"path": "res://scripts/Library/Actions/TriggerBase.gd"
}, {
"base": "TriggerBase",
"class": "TriggerOnCollision",
"language": "GDScript",
"path": "res://scripts/Library/Actions/TriggerOnCollision.gd"
}, {
"base": "TriggerBase",
"class": "TriggerOnReady",
"language": "GDScript",
"path": "res://scripts/Library/Actions/TriggerOnReady.gd"
} ]
_global_script_class_icons={
"MusicChangedSlowAction": ""
"Action": "",
"ActionList": "",
"MusicChangedSlowAction": "",
"PlaySound": "",
"TriggerBase": "",
"TriggerOnCollision": "",
"TriggerOnReady": ""
}
[application]
@ -24,10 +60,6 @@ config/name="first_anniversary_godot_jam"
run/main_scene="res://3d_platforma/Level.tscn"
config/icon="res://icon.png"
[autoload]
MusicSingleton="*res://scripts/MusicSingleton.gd"
[display]
window/size/width=480
@ -79,4 +111,5 @@ common/enable_pause_aware_picking=true
[rendering]
quality/driver/driver_name="GLES2"
environment/default_environment="res://default_env.tres"

View File

@ -0,0 +1,18 @@
class_name Action
extends Node
func triggerNodePath( nodePath:NodePath ):
var a:Action = get_node( nodePath );
triggerAction( a )
func triggerAction( a:Action ):
if a == null:
return
a.onTrigger()
func onTrigger():
pass

View File

@ -0,0 +1,12 @@
class_name ActionList
extends Action
func onTrigger():
var children = get_children()
for c in children:
triggerAction( c )

View File

@ -0,0 +1,12 @@
class_name PlaySound
extends Action
export(NodePath) var audioStreamPlayer
func _ready():
onTrigger()
func onTrigger():
get_node( audioStreamPlayer ).play()

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,18 @@
class_name TriggerBase
extends Node
func triggerNodePath( nodePath:NodePath ):
var a:Action = get_node( nodePath );
triggerAction( a )
func triggerAction( a:Action ):
if a == null:
return
a.onTrigger()

View File

@ -0,0 +1,9 @@
class_name TriggerOnCollision extends TriggerBase
export(NodePath) var collision_area
func _ready():
collision_area.connect("body_entered", self, "_on_body_entered")
func _on_body_entered(body: Node):
triggerAction(body)

View File

@ -0,0 +1,13 @@
class_name TriggerOnReady
extends TriggerBase
export(NodePath) var action
func _ready():
triggerNodePath( action )

View File

@ -4,6 +4,29 @@ func _ready() -> void:
print("Loaded Music singleton")
var change_slow_actions : Array = []
var gameSpeed : float = 1;
var musicType: int = 0;
func setSlowMusic():
setMusicType( -1 )
func setFastMusic():
setMusicType( 1 )
func setNormalMusic():
setMusicType( 0 )
func setMusicType( type:int ):
musicType = type;
gameSpeed = 0
if type == 1:
gameSpeed = 2
if type == -1:
gameSpeed = 0.5
func register_change_action(change_action : Node) -> void:
print("Registered change action")

View File

@ -1,11 +0,0 @@
class_name MusicChangedSlowAction extends Node
func _ready():
MusicSingleton.register_change_action(self)
MusicSingleton.change_music()
func _exit_tree():
MusicSingleton.unregister_change_action(self)
func execute() -> void:
print("Executed OnMusicChangedSlowAction")

4
scripts/SetFastMusic.gd Normal file
View File

@ -0,0 +1,4 @@
class_name SetFastMusic extends Action
func onTrigger():
MusicSingleton.setFastMusic()

View File

@ -0,0 +1,4 @@
class_name SetNormalMusic extends Action
func onTrigger():
MusicSingleton.setNormalMusic()

4
scripts/SetSlowMusic.gd Normal file
View File

@ -0,0 +1,4 @@
class_name SetSlowMusic extends Action
func onTrigger():
MusicSingleton.setSlowMusic()