Compare commits

...

2 Commits

Author SHA1 Message Date
ruinthread-games 05a4b84df6 Merge branch 'main' of community.rokojori.com:eggnot/first_anniversary_godot_jam into main
# Conflicts:
#	3d_platforma/Level1_platforms_slow.tscn
2024-06-15 16:23:13 +02:00
ruinthread-games 74d2376485 Worked on test for moving platforms 2024-06-15 16:17:55 +02:00
4 changed files with 127 additions and 6 deletions

View File

@ -0,0 +1,91 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://3d_platforma/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://Obstacles/SwingingAxe.tscn" type="PackedScene" id=2]
[sub_resource type="Animation" id=1]
length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath("KinematicBody:translation")
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( 0, 0, 0 ) ]
}
[sub_resource type="Animation" id=2]
resource_name = "platform"
length = 6.0
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("KinematicBody:translation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 3.1, 6 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Vector3( 0, 0, 0 ), Vector3( 7.22974, 0, 0 ), Vector3( 0, 0, 0 ) ]
}
[sub_resource type="CubeMesh" id=3]
size = Vector3( 4, 1, 10 )
[sub_resource type="ConcavePolygonShape" id=4]
data = PoolVector3Array( -2, 0.5, 5, 2, 0.5, 5, -2, -0.5, 5, 2, 0.5, 5, 2, -0.5, 5, -2, -0.5, 5, 2, 0.5, -5, -2, 0.5, -5, 2, -0.5, -5, -2, 0.5, -5, -2, -0.5, -5, 2, -0.5, -5, 2, 0.5, 5, 2, 0.5, -5, 2, -0.5, 5, 2, 0.5, -5, 2, -0.5, -5, 2, -0.5, 5, -2, 0.5, -5, -2, 0.5, 5, -2, -0.5, -5, -2, 0.5, 5, -2, -0.5, 5, -2, -0.5, -5, 2, 0.5, 5, -2, 0.5, 5, 2, 0.5, -5, -2, 0.5, 5, -2, 0.5, -5, 2, 0.5, -5, -2, -0.5, 5, 2, -0.5, 5, -2, -0.5, -5, 2, -0.5, 5, 2, -0.5, -5, -2, -0.5, -5 )
[node name="Spatial" type="Spatial"]
[node name="CSGBox" type="CSGBox" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.739994, 1.55076 )
use_collision = true
width = 3.33378
height = 0.276134
depth = 7.4378
[node name="CSGBox2" type="CSGBox" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.63172, -13.8239 )
use_collision = true
width = 3.33378
height = 0.276134
depth = 4.96652
[node name="CSGBox3" type="CSGBox" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2.65108, 3.45298, -9.43625 )
use_collision = true
width = 0.261805
height = 4.06841
depth = 9.32074
[node name="MovingPlatforms" type="Spatial" parent="."]
[node name="Player" parent="MovingPlatforms" instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.15484, 2 )
[node name="SwingingAxe" parent="MovingPlatforms" instance=ExtResource( 2 )]
transform = Transform( 0.50747, -0.861669, 0, 0.861669, 0.50747, 0, 0, 0, 1, 6.52953, 7.68018, -9.53236 )
[node name="Spatial" type="Spatial" parent="MovingPlatforms"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.89305, 0.826549 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="MovingPlatforms"]
autoplay = "platform"
anims/RESET = SubResource( 1 )
anims/platform = SubResource( 2 )
[node name="KinematicBody" type="KinematicBody" parent="MovingPlatforms"]
[node name="MeshInstance" type="MeshInstance" parent="MovingPlatforms/KinematicBody"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -7.21818 )
mesh = SubResource( 3 )
[node name="CollisionShape" type="CollisionShape" parent="MovingPlatforms/KinematicBody"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -7.21818 )
shape = SubResource( 4 )

View File

@ -25,10 +25,12 @@ func _input(event):
if event is InputEventMouseMotion:
rotation_degrees.y -= event.relative.x * look_sens_h
if event.is_action_released(\"ui_cancel\"):
get_tree().quit()
if event.is_action_pressed(\"ui_end\"):
global_translation = Vector3.ZERO
func _physics_process(_delta):
func _physics_process(delta):
var move_vec = Vector3()
if Input.is_action_pressed(\"move_forward\"):
move_vec.z -= 1
@ -39,12 +41,33 @@ func _physics_process(_delta):
if Input.is_action_pressed(\"move_left\"):
move_vec.x -= 1
$Label.text = 'floor contact: ' + str(is_on_floor()) + str(get_floor_velocity())
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))
# var friction = 0.5
# move_vec = lerp(Vector3.ZERO, move_vec, friction)
# var _vel:Vector3 = move_and_slide(move_vec, Vector3(0, 1, 0))
# var _vel:Vector3 = move_and_slide_with_snap(move_vec, Vector3(0, 1, 0))
# var is_on_platform = platform_detector.is_colliding()
var snap_length = 0.2
var floor_normal = Vector3.UP
var snap = Vector3.ZERO
if is_on_floor():
floor_normal = get_floor_normal()
snap = -floor_normal * snap_length
# move_vec -= gravity * floor_normal * delta
# var _vel = move_and_slide_with_snap(
# move_vec, snap, Vector3.UP)#, not is_on_floor(), 4, 0.9, false)
# if move_vec.y > 0:
move_vec = move_and_slide(move_vec,Vector3.UP)
# questionable???
if is_on_floor_prev and not is_on_floor():
@ -75,6 +98,8 @@ func _physics_process(_delta):
else:
play_anim(\"walk\")
func play_anim(name):
if anim.current_animation == name:
return
@ -405,3 +430,10 @@ cast_to = Vector3( 0, -50, 0 )
[node name="CoyoteJump" type="Timer" parent="."]
wait_time = 0.16
one_shot = true
[node name="Label" type="Label" parent="."]
margin_left = 178.0
margin_top = 109.0
margin_right = 218.0
margin_bottom = 123.0
text = "floor contact"

View File

@ -1,6 +1,5 @@
[gd_scene load_steps=38 format=2]
[gd_scene load_steps=37 format=2]
[ext_resource path="res://scripts/OnMusicChangedSlowTrigger.gd" type="Script" id=1]
[ext_resource path="res://3d_platforma/golden_bay_512.hdr" type="Texture" id=2]
[ext_resource path="res://Obstacles/SwingingAxe.tscn" type="PackedScene" id=3]
[ext_resource path="res://3d_platforma/sqare_norm.png" type="Texture" id=4]
@ -612,7 +611,6 @@ light_energy = 0.65
environment = SubResource( 24 )
[node name="MusicChangedSlowAction" type="Node" parent="."]
script = ExtResource( 1 )
[node name="Obstacles" type="Spatial" parent="."]

View File

@ -26,7 +26,7 @@ tracks/0/keys = {
}
[node name="SwingingAxe" type="Spatial"]
transform = Transform( 0.50747, -0.861669, 0, 0.861669, 0.50747, 0, 0, 0, 1, 0, 0, 0 )
transform = Transform( 0.173648, -0.984807, 0, 0.984807, 0.173648, 0, 0, 0, 1, 0, 0, 0 )
[node name="MeshInstance" type="MeshInstance" parent="."]
mesh = ExtResource( 1 )