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 4b1752ead03312e551325ffd57c4249361ac2fa1
parent a362e3dac6d4b31d99902813f1175505d14a6e1c
Author: Yuval Langer <yuvallangerontheroad@gmail.com>
Date:   Sat,  2 Oct 2021 16:16:47 +0300

Display flying saucer.

Diffstat:
MConstants.gd | 8+++++++-
MHUD.tscn | 12++++++------
MPlayer.tscn | 7++++++-
MSaucer.gd | 15+++++++++++----
MSaucer.tscn | 12++----------
Mproject.godot | 5+++++
6 files changed, 37 insertions(+), 22 deletions(-)

diff --git a/Constants.gd b/Constants.gd @@ -18,6 +18,7 @@ extends Node # along with this program. If not, see <https://www.gnu.org/licenses/>. +# Used in collision detecting RayCasts. const on_floor_maximum_distance := 0.1 @@ -29,5 +30,10 @@ const fall_acceleration: float = 50.0 const on_the_floor_fall_acceleration: float = 1.0 const jump_impulse: float = 8.0 const maximum_forward_speed: float = 20.0 -const forward_speed_increment: float = 0.5 +const number_of_speed_bars: int = 34 +const forward_speed_increment: float = maximum_forward_speed / number_of_speed_bars const side_speed: float = 1.0 + + +const number_of_oxygen_bars: int = 10 +const number_of_fuel_bars: int = 10 diff --git a/HUD.tscn b/HUD.tscn @@ -3,18 +3,18 @@ [ext_resource path="res://HUD.gd" type="Script" id=1] [node name="HUD" type="Control"] -margin_right = 40.0 -margin_bottom = 40.0 +anchor_right = 1.0 +anchor_bottom = 1.0 script = ExtResource( 1 ) __meta__ = { "_edit_use_anchors_": false } [node name="SpeedHBoxContainer" type="HBoxContainer" parent="."] -margin_left = 447.357 -margin_top = 531.447 -margin_right = 522.357 -margin_bottom = 571.447 +anchor_top = 1.0 +anchor_bottom = 1.0 +margin_top = -40.0 +margin_right = 75.0 __meta__ = { "_edit_use_anchors_": false } diff --git a/Player.tscn b/Player.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://Player.gd" type="Script" id=1] +[ext_resource path="res://Saucer.tscn" type="PackedScene" id=2] [sub_resource type="SpatialMaterial" id=1] albedo_color = Color( 0.482353, 0.980392, 0.572549, 1 ) @@ -13,6 +14,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.336291, 0 ) script = ExtResource( 1 ) [node name="CSGBox2" type="CSGBox" parent="."] +visible = false width = 0.25 height = 0.15 depth = 0.3 @@ -40,3 +42,6 @@ enabled = true [node name="RayCast4" type="RayCast" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.125, -0.075, -0.15 ) enabled = true + +[node name="Saucer" parent="." instance=ExtResource( 2 )] +transform = Transform( 0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 0, 0, 0 ) diff --git a/Saucer.gd b/Saucer.gd @@ -19,18 +19,22 @@ func _ready() -> void: func setget_height(height): height_of_little_spheres = height - set_spheres() +# set_spheres() + func setget_distance(distance): distance_from_axis_of_little_spheres = distance - set_spheres() +# set_spheres() + func setget_number(number): number_of_little_spheres = number - set_spheres() +# set_spheres() + + func setget_radius(radius): radius_of_little_spheres = radius - set_spheres() +# set_spheres() func set_spheres() -> void: @@ -46,6 +50,8 @@ func remove_existing_spheres() -> void: func add_little_spheres() -> void: + var saucer_spatial_material: SpatialMaterial = load("res://SaucerMaterial.tres") + 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) @@ -54,5 +60,6 @@ func add_little_spheres() -> void: sphere.translation.z = z sphere.translation.y = height_of_little_spheres sphere.radius = radius_of_little_spheres + sphere.material = saucer_spatial_material small_spheres.add_child(sphere) print_debug("%s %s" % [x, z]) diff --git a/Saucer.tscn b/Saucer.tscn @@ -3,13 +3,14 @@ [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"] +[node name="Saucer" 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="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.874991, 0 ) operation = 1 radius = 1.13286 radial_segments = 20 @@ -36,12 +37,3 @@ 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/project.godot b/project.godot @@ -24,6 +24,11 @@ config/icon="res://icon.png" LevelLoader="*res://LevelLoader.gd" Constants="*res://Constants.gd" +[display] + +window/stretch/mode="viewport" +window/stretch/aspect="expand" + [input] jump={