Skip to content

Commit

Permalink
Merge pull request #14 from devlup-fsu/astroid-minigame
Browse files Browse the repository at this point in the history
[Astroid] Merge 2024-10-18
  • Loading branch information
Trikzon authored Oct 18, 2024
2 parents 33a6b66 + 1d9d6a2 commit 5b33bc3
Show file tree
Hide file tree
Showing 18 changed files with 507 additions and 0 deletions.
67 changes: 67 additions & 0 deletions AsteroidDodge/Player2.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[gd_scene load_steps=6 format=3 uid="uid://c56hskqtwl6we"]

[sub_resource type="GDScript" id="GDScript_p6hgv"]
script/source = "extends CharacterBody3D

signal hit
const SPEED = 5.0
const JUMP_VELOCITY = 4.5

func owned():
hit.emit()
queue_free()

func _physics_process(delta: float) -> void:
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var collision_info = move_and_collide(velocity * delta)
var input_dir := Input.get_vector(\"A\", \"D\", \"W\", \"S\")
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.z = move_toward(velocity.z, 0, SPEED)
if collision_info:
velocity = velocity.bounce(collision_info.get_normal())


move_and_slide()

func _on_detect_asteroid_body_entered(body: Node3D) -> void:
owned()
"
[sub_resource type="SphereShape3D" id="SphereShape3D_5ae5p"]
[sub_resource type="SphereMesh" id="SphereMesh_gsfbk"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_itx15"]
albedo_color = Color(0, 0, 1, 1)
[sub_resource type="SphereShape3D" id="SphereShape3D_n0lnm"]
radius = 0.439705
[node name="Player2" type="CharacterBody3D"]
collision_layer = 3
collision_mask = 3
script = SubResource("GDScript_p6hgv")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_5ae5p")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("SphereMesh_gsfbk")
skeleton = NodePath("../CollisionShape3D")
surface_material_override/0 = SubResource("StandardMaterial3D_itx15")
[node name="detectAsteroid" type="Area3D" parent="."]
collision_layer = 4
collision_mask = 4
monitorable = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="detectAsteroid"]
shape = SubResource("SphereShape3D_n0lnm")
[connection signal="body_entered" from="detectAsteroid" to="." method="_on_detect_asteroid_body_entered"]
19 changes: 19 additions & 0 deletions AsteroidDodge/asteroid.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=3 uid="uid://d0cn33u0jbrf7"]

[ext_resource type="Script" path="res://AsteroidDodge/rigid_body_3d.gd" id="1_ptmij"]

[sub_resource type="SphereShape3D" id="SphereShape3D_v23ts"]

[sub_resource type="SphereMesh" id="SphereMesh_744lj"]

[node name="RigidBody3D" type="RigidBody3D"]
collision_layer = 4
collision_mask = 4
gravity_scale = 0.0
script = ExtResource("1_ptmij")

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_v23ts")

[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("SphereMesh_744lj")
21 changes: 21 additions & 0 deletions AsteroidDodge/bottomWall.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[gd_scene load_steps=4 format=3 uid="uid://dqxtqd6mqfwqv"]

[sub_resource type="BoxShape3D" id="BoxShape3D_xkn1y"]
size = Vector3(35.0068, 0.047821, 1.95338)

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_f6wyj"]
albedo_color = Color(0, 0, 0, 1)

[sub_resource type="BoxMesh" id="BoxMesh_v0xln"]
material = SubResource("StandardMaterial3D_f6wyj")
size = Vector3(35, 0.05, 1.95)

[node name="RigidBody3D" type="StaticBody3D"]

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.24385e-05, 0.000167847, -0.00299454)
shape = SubResource("BoxShape3D_xkn1y")

[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
visible = false
mesh = SubResource("BoxMesh_v0xln")
4 changes: 4 additions & 0 deletions AsteroidDodge/camera.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[gd_scene format=3 uid="uid://dfqu28jk70f3i"]

[node name="Camera3D" type="Camera3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1.23939)
28 changes: 28 additions & 0 deletions AsteroidDodge/character_body_3d.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
extends CharacterBody3D


const SPEED = 5.0
const JUMP_VELOCITY = 4.5


func _physics_process(delta: float) -> void:
# Add the gravity.
#if not is_on_floor():
#velocity += get_gravity() * delta

# Handle jump.
#if Input.is_action_just_pressed("ui_accept") and is_on_floor():
#velocity.y = JUMP_VELOCITY

# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var input_dir := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.z = move_toward(velocity.z, 0, SPEED)

move_and_slide()
11 changes: 11 additions & 0 deletions AsteroidDodge/environment.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extends RigidBody3D


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
24 changes: 24 additions & 0 deletions AsteroidDodge/environment.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[gd_scene load_steps=4 format=3 uid="uid://bhnipyhxmxsbh"]

[sub_resource type="BoxShape3D" id="BoxShape3D_fg4sf"]
size = Vector3(28.0055, 0.0505371, 1.94861)

[sub_resource type="BoxMesh" id="BoxMesh_vq0m6"]
size = Vector3(28, 0.05, 1.95)

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_bx1i3"]
albedo_color = Color(0, 0, 0, 1)

[node name="RigidBody3D" type="RigidBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.83887, 0.018876, 0)
gravity_scale = 0.0
freeze = true

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.9739, -0.474731, -0.471497)
shape = SubResource("BoxShape3D_fg4sf")

[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.97321, -0.47582, -0.471292)
mesh = SubResource("BoxMesh_vq0m6")
surface_material_override/0 = SubResource("StandardMaterial3D_bx1i3")
23 changes: 23 additions & 0 deletions AsteroidDodge/floor.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[gd_scene load_steps=4 format=3 uid="uid://dqkxawtm5hf32"]

[sub_resource type="BoxShape3D" id="BoxShape3D_u8au8"]
size = Vector3(25.1097, 0.0590363, 34.997)

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_bqsf0"]
albedo_color = Color(0, 0, 0, 1)

[sub_resource type="BoxMesh" id="BoxMesh_bdrax"]
material = SubResource("StandardMaterial3D_bqsf0")
size = Vector3(25, 0.05, 35)

[node name="floor" type="StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00436211, 1.07674, 0.0949044)

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0512996, -1.06674, -3.52859e-05)
shape = SubResource("BoxShape3D_u8au8")

[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.07155, 0)
visible = false
mesh = SubResource("BoxMesh_bdrax")
23 changes: 23 additions & 0 deletions AsteroidDodge/leftWall.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[gd_scene load_steps=4 format=3 uid="uid://bxss6hsco6yxa"]

[sub_resource type="BoxShape3D" id="BoxShape3D_u8au8"]
size = Vector3(24.9972, 0.0536194, 1.94144)

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_eeu1d"]
albedo_color = Color(0, 0, 0, 1)

[sub_resource type="BoxMesh" id="BoxMesh_r3qtk"]
material = SubResource("StandardMaterial3D_eeu1d")
size = Vector3(25, 0.05, 1.95)

[node name="leftWall" type="StaticBody3D"]

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.180984, 0.433487, -0.004776)
shape = SubResource("BoxShape3D_u8au8")

[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.179688, 0.434998, 0)
visible = false
mesh = SubResource("BoxMesh_r3qtk")
skeleton = NodePath("../CollisionShape3D")
63 changes: 63 additions & 0 deletions AsteroidDodge/main.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[gd_scene load_steps=14 format=3 uid="uid://vvw1kiuugmv8"]

[ext_resource type="PackedScene" uid="uid://diiuqn2uet6kd" path="res://AsteroidDodge/player.tscn" id="1_jwg6j"]
[ext_resource type="PackedScene" uid="uid://bnxvaff83bjk4" path="res://AsteroidDodge/topWall.tscn" id="2_i4n6c"]
[ext_resource type="PackedScene" uid="uid://dfqu28jk70f3i" path="res://AsteroidDodge/camera.tscn" id="3_lqgec"]
[ext_resource type="PackedScene" uid="uid://dqxtqd6mqfwqv" path="res://AsteroidDodge/bottomWall.tscn" id="3_vvdis"]
[ext_resource type="PackedScene" uid="uid://bxss6hsco6yxa" path="res://AsteroidDodge/leftWall.tscn" id="4_wddu8"]
[ext_resource type="PackedScene" uid="uid://dgb4ykuvs11e2" path="res://AsteroidDodge/rightWall.tscn" id="5_1m3hc"]
[ext_resource type="PackedScene" uid="uid://d0cn33u0jbrf7" path="res://AsteroidDodge/asteroid.tscn" id="7_kpcte"]
[ext_resource type="PackedScene" uid="uid://dqkxawtm5hf32" path="res://AsteroidDodge/floor.tscn" id="8_b5al4"]
[ext_resource type="PackedScene" uid="uid://c56hskqtwl6we" path="res://AsteroidDodge/Player2.tscn" id="9_of70t"]

[sub_resource type="GDScript" id="GDScript_4mudm"]
script/source = "extends Node3D
"

[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_qmb18"]

[sub_resource type="Sky" id="Sky_xbfw2"]
sky_material = SubResource("ProceduralSkyMaterial_qmb18")

[sub_resource type="Environment" id="Environment_xpoei"]
background_mode = 2
sky = SubResource("Sky_xbfw2")

[node name="Node" type="Node3D"]
script = SubResource("GDScript_4mudm")

[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0)
shadow_enabled = true

[node name="Player" parent="." instance=ExtResource("1_jwg6j")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)

[node name="topWall" parent="." instance=ExtResource("2_i4n6c")]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 1.839, 1, -8.73504)

[node name="bottomWall" parent="." instance=ExtResource("3_vvdis")]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 1, 9.23704)

[node name="leftWall" parent="." instance=ExtResource("4_wddu8")]
transform = Transform3D(-4.37114e-08, -1, 0, -4.37114e-08, 1.91069e-15, -1, 1, -4.37114e-08, -4.37114e-08, -15.887, 1, -1.29185)

[node name="rightWall" parent="." instance=ExtResource("5_1m3hc")]
transform = Transform3D(-4.37114e-08, -1, 0, -4.37114e-08, 1.91069e-15, -1, 1, -4.37114e-08, -4.37114e-08, 16.6065, 1, -1.29185)

[node name="Camera3D" parent="." instance=ExtResource("3_lqgec")]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 13, 0)
current = true
fov = 76.4523

[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_xpoei")

[node name="Asteroid" parent="." instance=ExtResource("7_kpcte")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -19.8209, 1, -13.5123)

[node name="floor" parent="." instance=ExtResource("8_b5al4")]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0.545496, 1.07674, 0.0949044)

[node name="Player2" parent="." instance=ExtResource("9_of70t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 3)
11 changes: 11 additions & 0 deletions AsteroidDodge/new_script.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extends Node


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
79 changes: 79 additions & 0 deletions AsteroidDodge/node_3d.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[gd_scene load_steps=11 format=3 uid="uid://d3ltf63bf4lue"]

[ext_resource type="Script" path="res://AsteroidDodge/character_body_3d.gd" id="1_6at67"]

[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_67fuo"]

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_d1rch"]

[sub_resource type="CapsuleMesh" id="CapsuleMesh_7i2c2"]
material = SubResource("StandardMaterial3D_d1rch")

[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_3o4wi"]
sky_top_color = Color(0, 0, 0, 1)
sky_horizon_color = Color(0.277077, 8.42288e-05, 0.297463, 1)
sky_cover_modulate = Color(1, 0.37149, 0.508827, 1)
ground_bottom_color = Color(0.153604, 1.02639e-05, 0.141441, 1)
ground_horizon_color = Color(0.283365, 8.27849e-05, 0.301415, 1)

[sub_resource type="Sky" id="Sky_po51p"]
sky_material = SubResource("ProceduralSkyMaterial_3o4wi")

[sub_resource type="Environment" id="Environment_2nn00"]
background_mode = 2
sky = SubResource("Sky_po51p")
ambient_light_source = 3

[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_0qguu"]

[sub_resource type="BoxShape3D" id="BoxShape3D_xj43u"]
size = Vector3(10.896, 2.06738, 9.31262)

[sub_resource type="BoxMesh" id="BoxMesh_squ00"]
size = Vector3(10, 1.8, 10)

[node name="Node3D" type="Node3D"]

[node name="Node3D" type="Node3D" parent="."]

[node name="CharacterBody3D" type="CharacterBody3D" parent="Node3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.47023, 0.0826565, 0.0408769)
script = ExtResource("1_6at67")

[node name="CollisionShape3D" type="CollisionShape3D" parent="Node3D/CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.08056, 1.81968, -0.812865)
shape = SubResource("CapsuleShape3D_67fuo")

[node name="MeshInstance3D" type="MeshInstance3D" parent="Node3D/CharacterBody3D/CollisionShape3D"]
transform = Transform3D(1, 0, 0, 0, 0.998877, -0.0473854, 0, 0.0473854, 0.998877, -0.00352669, 0, 0)
mesh = SubResource("CapsuleMesh_7i2c2")

[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_2nn00")
camera_attributes = SubResource("CameraAttributesPractical_0qguu")

[node name="StaticBody3D" type="StaticBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12.6361, 4.59662, -0.756583)

[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.455629, -2.80535, 3.44596)
shape = SubResource("BoxShape3D_xj43u")

[node name="MeshInstance3D" type="MeshInstance3D" parent="StaticBody3D/CollisionShape3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.553468, 0.127552, 0.466851)
mesh = SubResource("BoxMesh_squ00")

[node name="StaticBody3D2" type="StaticBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15.4196, 4.97735, -0.203553)

[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.56819, -2.80535, 3.44596)
shape = SubResource("BoxShape3D_xj43u")

[node name="MeshInstance3D" type="MeshInstance3D" parent="StaticBody3D2/CollisionShape3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.437567, 0.122046, -0.110357)
mesh = SubResource("BoxMesh_squ00")

[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(0.999992, -0.00270241, -0.00291655, 0.00295939, 0.0159863, 0.999868, -0.00265543, -0.999869, 0.0159942, -0.52972, 7.17805, 2.54083)
fov = 113.555
Loading

0 comments on commit 5b33bc3

Please sign in to comment.