space-vroom

A SkyRoads clone with only one boring "level" written in Godot Engine version 3.
git clone https://kaka.farm/~git/spacevroom
Log | Files | Refs | LICENSE

commit 7c59ae6b22755b242f6bbedb42517e5d0275fab6
parent 1dbc43df656ae8120201d2fd05b0c76b951b8138
Author: Yuval Langer <yuvallangerontheroad@gmail.com>
Date:   Sat,  2 Oct 2021 14:53:07 +0300

Add flying saucer stuff.

Diffstat:
ASaucer.gd | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASaucer.tscn | 47+++++++++++++++++++++++++++++++++++++++++++++++
ASaucerMaterial.tres | 4++++
3 files changed, 111 insertions(+), 0 deletions(-)

diff --git a/Saucer.gd b/Saucer.gd @@ -0,0 +1,60 @@ +tool +extends Spatial + + + +onready var small_spheres: = $CSGSphere/SmallSpheres + + +export var radius_of_little_spheres: float = 0.1 setget setget_radius +export var number_of_little_spheres: int = 3 setget setget_number +export var distance_from_axis_of_little_spheres: float = 0.34 setget setget_distance +export var height_of_little_spheres: float = 0.924 setget setget_height + + + +func _ready() -> void: + if Engine.editor_hint: + set_spheres() + + +func setget_height(height): + height_of_little_spheres = height + set_spheres() + +func setget_distance(distance): + distance_from_axis_of_little_spheres = distance + set_spheres() + +func setget_number(number): + number_of_little_spheres = number + set_spheres() +func setget_radius(radius): + radius_of_little_spheres = radius + set_spheres() + + +func set_spheres() -> void: + remove_existing_spheres() + add_little_spheres() + + +func remove_existing_spheres() -> void: + if Engine.editor_hint: + print_debug(small_spheres) + var small_sphere_children: = small_spheres.get_children() + for small_sphere in small_sphere_children: + small_spheres.remove_child(small_sphere) + + +func add_little_spheres() -> void: + for i in range(number_of_little_spheres): + var x: = distance_from_axis_of_little_spheres * sin(TAU * i/number_of_little_spheres) + var z: = distance_from_axis_of_little_spheres * cos(TAU * i/number_of_little_spheres) + var sphere: = CSGSphere.new() + sphere.translation.x = x + sphere.translation.z = z + sphere.translation.y = height_of_little_spheres + sphere.radius = radius_of_little_spheres + small_spheres.add_child(sphere) + print_debug("%s %s" % [x, z]) diff --git a/Saucer.tscn b/Saucer.tscn @@ -0,0 +1,47 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://SaucerMaterial.tres" type="Material" id=1] +[ext_resource path="res://Saucer.gd" type="Script" id=2] + +[node name="Spatial" type="Spatial"] +script = ExtResource( 2 ) +radius_of_little_spheres = 0.12 +distance_from_axis_of_little_spheres = 0.4 +height_of_little_spheres = 0.9 + +[node name="CSGSphere" type="CSGSphere" parent="."] +operation = 1 +radius = 1.13286 +radial_segments = 20 +rings = 20 +material = ExtResource( 1 ) + +[node name="CSGSphere2" type="CSGSphere" parent="CSGSphere"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.54212, 0 ) +operation = 1 +radial_segments = 20 +rings = 20 +material = ExtResource( 1 ) + +[node name="SmallSpheres" type="Spatial" parent="CSGSphere"] + +[node name="CSGSphere" type="CSGSphere" parent="CSGSphere"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.305537, 0 ) +operation = 2 +radius = 1.3125 +radial_segments = 100 +rings = 100 +material = ExtResource( 1 ) + +[node name="CSGSphere3" type="CSGSphere" parent="CSGSphere"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.03549, 0 ) +radius = 0.320976 + +[node name="Camera" type="Camera" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.328694, 0.771193, 1.66526 ) + +[node name="Camera2" type="Camera" parent="."] +transform = Transform( 1, 0, 0, 0, 0.885912, -0.463853, 0, 0.463853, 0.885912, 0.965183, 0.0861396, 2.54216 ) + +[node name="DirectionalLight" type="DirectionalLight" parent="."] +transform = Transform( 1, 0, 0, 0, 0.850462, 0.526036, 0, -0.526036, 0.850462, 0, 2.33933, 5.7499 ) diff --git a/SaucerMaterial.tres b/SaucerMaterial.tres @@ -0,0 +1,4 @@ +[gd_resource type="SpatialMaterial" format=2] + +[resource] +roughness = 0.14