Medium asteroids, orbit zones, various atmospheric changes
This commit is contained in:
parent
1053468a71
commit
5a7cc35613
11 changed files with 150 additions and 30 deletions
|
|
@ -16,6 +16,10 @@ config/features=PackedStringArray("4.5", "Mobile")
|
|||
boot_splash/bg_color=Color(0, 0, 0, 1)
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[autoload]
|
||||
|
||||
global="*res://scripts/global.gd"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1600
|
||||
|
|
@ -83,6 +87,17 @@ boost={
|
|||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":8,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
fullscreen={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194342,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
pause={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
|
|
@ -94,4 +109,5 @@ boost={
|
|||
|
||||
textures/canvas_textures/default_texture_filter=0
|
||||
renderer/rendering_method="mobile"
|
||||
environment/defaults/default_clear_color=Color(0, 0, 0, 1)
|
||||
2d/snap/snap_2d_transforms_to_pixel=true
|
||||
|
|
|
|||
|
|
@ -1,16 +1,30 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dgng5vdhn6anc"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dgng5vdhn6anc"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://co67k1hqadpv4" path="res://textures/asteroid_small.png" id="1_akfqu"]
|
||||
[ext_resource type="Script" uid="uid://cvk1sd0aqqmpq" path="res://scripts/asteroid.gd" id="1_t4se3"]
|
||||
[ext_resource type="Texture2D" uid="uid://dibsut6ee6qd5" path="res://textures/asteroid_medium.png" id="2_6mo6b"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_uwrxv"]
|
||||
radius = 16.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_t4se3"]
|
||||
radius = 29.614185
|
||||
|
||||
[node name="Asteroid" type="RigidBody2D"]
|
||||
mass = 2.5
|
||||
linear_damp = 4.0
|
||||
script = ExtResource("1_t4se3")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
[node name="Variants" type="Node2D" parent="."]
|
||||
|
||||
[node name="Small" type="Sprite2D" parent="Variants"]
|
||||
texture = ExtResource("1_akfqu")
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape2D" parent="."]
|
||||
[node name="CollisionShape" type="CollisionShape2D" parent="Variants/Small"]
|
||||
shape = SubResource("CircleShape2D_uwrxv")
|
||||
|
||||
[node name="Mediun" type="Sprite2D" parent="Variants"]
|
||||
texture = ExtResource("2_6mo6b")
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape2D" parent="Variants/Mediun"]
|
||||
shape = SubResource("CircleShape2D_t4se3")
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://bauklhpieuivd"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://bauklhpieuivd"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d0qswyhwbhdua" path="res://scripts/game.gd" id="1_u5sy4"]
|
||||
[ext_resource type="Texture2D" uid="uid://dtwo7g0ipc4k" path="res://textures/ship_1.png" id="1_uwrxv"]
|
||||
[ext_resource type="Script" uid="uid://bfxfkrkaebxk0" path="res://scripts/player.gd" id="1_yqjtg"]
|
||||
[ext_resource type="AudioStream" uid="uid://brqjxveo53kco" path="res://sounds/boost.mp3" id="2_iywne"]
|
||||
[ext_resource type="AudioStream" uid="uid://5tr30e1tmdp6" path="res://sounds/collision.mp3" id="2_lbhrr"]
|
||||
[ext_resource type="PackedScene" uid="uid://dgng5vdhn6anc" path="res://scenes/asteroid.tscn" id="3_lnu2h"]
|
||||
[ext_resource type="AudioStream" uid="uid://b1ung55xg31l3" path="res://sounds/boost_finish.mp3" id="3_p57ef"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_uwrxv"]
|
||||
|
|
@ -51,18 +50,6 @@ debug_color = Color(0.9686392, 0, 0.4696517, 0.41960785)
|
|||
|
||||
[node name="Unloadables" type="Node2D" parent="."]
|
||||
|
||||
[node name="Asteroid" parent="Unloadables" instance=ExtResource("3_lnu2h")]
|
||||
position = Vector2(-42, -173)
|
||||
|
||||
[node name="Asteroid2" parent="Unloadables" instance=ExtResource("3_lnu2h")]
|
||||
position = Vector2(227, 37)
|
||||
|
||||
[node name="Asteroid3" parent="Unloadables" instance=ExtResource("3_lnu2h")]
|
||||
position = Vector2(-216, 134)
|
||||
|
||||
[node name="Asteroid4" parent="Unloadables" instance=ExtResource("3_lnu2h")]
|
||||
position = Vector2(-192, -427)
|
||||
|
||||
[node name="UI" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="Control" type="Control" parent="UI"]
|
||||
|
|
@ -79,4 +66,15 @@ offset_right = 40.0
|
|||
offset_bottom = 24.0
|
||||
text = "BOOST: 100"
|
||||
|
||||
[node name="Distance" type="Label" parent="UI/Control"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_top = -12.0
|
||||
offset_right = 136.0
|
||||
offset_bottom = 12.0
|
||||
grow_vertical = 2
|
||||
text = "DIST: 2048"
|
||||
|
||||
[connection signal="body_shape_entered" from="Player/Hitbox" to="Player" method="_on_hitbox_body_shape_entered"]
|
||||
|
|
|
|||
15
scripts/asteroid.gd
Normal file
15
scripts/asteroid.gd
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
extends RigidBody2D
|
||||
|
||||
func _ready() -> void:
|
||||
var variants = $Variants.get_children()
|
||||
var variant = variants[randi_range(0, variants.size() - 1)]
|
||||
|
||||
$Variants.remove_child(variant)
|
||||
|
||||
add_child(variant)
|
||||
|
||||
var collision_shape = variant.get_node("CollisionShape")
|
||||
variant.remove_child(collision_shape)
|
||||
add_child(collision_shape)
|
||||
|
||||
$Variants.queue_free()
|
||||
1
scripts/asteroid.gd.uid
Normal file
1
scripts/asteroid.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cvk1sd0aqqmpq
|
||||
|
|
@ -14,6 +14,8 @@ func chunk_to_world(position: Vector2) -> Vector2:
|
|||
|
||||
func _process(delta: float) -> void:
|
||||
$UI/Control/BoostText.text = "BOOST: " + str($Player.boost)
|
||||
$UI/Control/Distance.text = "DIST: " + str(floori($Player.position.length()))
|
||||
|
||||
chunk_tick_timer -= delta
|
||||
|
||||
if chunk_tick_timer < 0:
|
||||
|
|
@ -39,19 +41,26 @@ func _process(delta: float) -> void:
|
|||
"time_to_unload": 0,
|
||||
}
|
||||
|
||||
var amount = 4
|
||||
|
||||
var i = 0
|
||||
|
||||
while i < amount:
|
||||
var asteroid = asteroid_scene.instantiate()
|
||||
|
||||
asteroid.rotation = randf_range(-5.0, 5.0)
|
||||
asteroid.position = chunk_to_world(chunk_position) + Vector2(randi_range(0, 1024), randi_range(0, 1024))
|
||||
var world_position = chunk_to_world(chunk_position)
|
||||
var orbit_zone = null
|
||||
for n in global.orbit_zones:
|
||||
|
||||
$Unloadables.add_child(asteroid)
|
||||
if world_position.length() < n.distance:
|
||||
continue
|
||||
orbit_zone = n
|
||||
|
||||
i += 1
|
||||
for n in orbit_zone.spawns:
|
||||
var i = 0
|
||||
|
||||
while i < n.amount_min:
|
||||
var asteroid = asteroid_scene.instantiate()
|
||||
|
||||
asteroid.rotation = randf_range(-5.0, 5.0)
|
||||
asteroid.position = chunk_to_world(chunk_position) + Vector2(randi_range(0, 1024), randi_range(0, 1024))
|
||||
|
||||
$Unloadables.add_child(asteroid)
|
||||
|
||||
i += 1
|
||||
|
||||
y_mod += 1
|
||||
|
||||
|
|
|
|||
21
scripts/global.gd
Normal file
21
scripts/global.gd
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
extends Node
|
||||
|
||||
var orbit_zones = [
|
||||
{
|
||||
"name": "Test Zone",
|
||||
"distance": 0,
|
||||
"spawns": [
|
||||
{
|
||||
"type": "asteroid",
|
||||
"chance_percent": 100,
|
||||
"amount_min": 4,
|
||||
"amount_max": 5,
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Test Zone 2",
|
||||
"distance": 2048 * 1.5,
|
||||
"spawns": []
|
||||
}
|
||||
]
|
||||
1
scripts/global.gd.uid
Normal file
1
scripts/global.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bh7d7yrshcjqg
|
||||
|
|
@ -14,6 +14,9 @@ func _process(delta: float) -> void:
|
|||
if Input.is_action_pressed("boost"):
|
||||
boost -= delta * 40
|
||||
|
||||
if camera_shake_power < 2:
|
||||
camera_shake_power = 2
|
||||
|
||||
if boost <= 0:
|
||||
boost = 0
|
||||
boosting = false
|
||||
|
|
@ -41,18 +44,20 @@ func _process(delta: float) -> void:
|
|||
|
||||
func _physics_process(delta: float) -> void:
|
||||
var axis = Input.get_axis("turn_left", "turn_right")
|
||||
var movement_axis = Input.get_axis("forward", "backward")
|
||||
|
||||
angular_velocity = deg_to_rad(180 * axis)
|
||||
|
||||
var final_speed = 512
|
||||
|
||||
if boosting:
|
||||
movement_axis = -1
|
||||
final_speed = 1024
|
||||
|
||||
# Slow down on collision and gradually speed up
|
||||
if time_since_last_collision < 1: final_speed *= (time_since_last_collision + 0.15) * 2
|
||||
if time_since_last_collision < 0.85: final_speed *= (time_since_last_collision + 0.15)
|
||||
|
||||
var new_velocity = transform.y * Input.get_axis("forward", "backward") * final_speed
|
||||
var new_velocity = transform.y * movement_axis * final_speed
|
||||
|
||||
if (new_velocity.length() > linear_velocity.length() - 12):
|
||||
linear_velocity = new_velocity
|
||||
|
|
|
|||
BIN
textures/asteroid_medium.png
Normal file
BIN
textures/asteroid_medium.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 467 B |
40
textures/asteroid_medium.png.import
Normal file
40
textures/asteroid_medium.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dibsut6ee6qd5"
|
||||
path="res://.godot/imported/asteroid_medium.png-2f424bbaac58810b8d103ec74fa6bc89.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://textures/asteroid_medium.png"
|
||||
dest_files=["res://.godot/imported/asteroid_medium.png-2f424bbaac58810b8d103ec74fa6bc89.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Loading…
Reference in a new issue