Added base template (uninteractive yet)
This commit is contained in:
parent
93aa83dcaa
commit
2d4eb92751
8 changed files with 100 additions and 17 deletions
|
|
@ -13,6 +13,9 @@ script = ExtResource("2_n14ml")
|
|||
[node name="HullHolder" type="Node" parent="."]
|
||||
|
||||
[node name="Hull" parent="HullHolder" instance=ExtResource("3_upgeg")]
|
||||
collision_mask = 3
|
||||
max_contacts_reported = 1
|
||||
contact_monitor = true
|
||||
|
||||
[node name="Engine" parent="." instance=ExtResource("4_adr14")]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://crneq2enhxsw5"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://crneq2enhxsw5"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bsnrcw64qr2hr" path="res://scenes/Star Systems/star_system_template.tscn" id="1_2ai1l"]
|
||||
[ext_resource type="PackedScene" uid="uid://dk3nvl8f0v24e" path="res://scenes/base_template.tscn" id="3_m5ica"]
|
||||
[ext_resource type="PackedScene" uid="uid://dok3i8u5t1ka4" path="res://scenes/Ships/player_ship.tscn" id="7_jyplv"]
|
||||
|
||||
[node name="StarSystem" instance=ExtResource("1_2ai1l")]
|
||||
|
|
@ -11,10 +12,13 @@ height = 16384
|
|||
scroll_offset = Vector2(681.667, 317.783)
|
||||
stars_amount = 4000
|
||||
|
||||
[node name="Nebula" parent="Background" index="0" node_paths=PackedStringArray("tracked_node")]
|
||||
tracked_node = NodePath("../../PlayerShip")
|
||||
color_background = Color(0.276474, 0.0962249, 0.200656, 1)
|
||||
|
||||
[node name="PlayerShip" parent="." index="3" instance=ExtResource("7_jyplv")]
|
||||
process_mode = 0
|
||||
position = Vector2(19, 10)
|
||||
|
||||
[node name="Base" parent="." index="4" instance=ExtResource("3_m5ica")]
|
||||
position = Vector2(7171, -28)
|
||||
|
||||
[node name="Nebula" parent="Background" index="0" node_paths=PackedStringArray("tracked_node")]
|
||||
tracked_node = NodePath("../../PlayerShip")
|
||||
color_background = Color(0.276474, 0.0962249, 0.200656, 1)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,18 @@ pause_controller_scene = ExtResource("6_61vq5")
|
|||
process_mode = 1
|
||||
script = ExtResource("3_h5cm3")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="Version" type="Label" parent="CanvasLayer"]
|
||||
z_index = 4096
|
||||
z_as_relative = false
|
||||
offset_top = 6.0
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 29.0
|
||||
text = "GammaCosmicRays version Ifre 1.0"
|
||||
horizontal_alignment = 1
|
||||
script = SubResource("GDScript_4yoh5")
|
||||
|
||||
[node name="Background" type="CanvasLayer" parent="."]
|
||||
process_mode = 1
|
||||
layer = -10
|
||||
|
|
@ -45,13 +57,3 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
script = ExtResource("5_la84n")
|
||||
color_background = Color(0.36, 0.18612, 0.1116, 1)
|
||||
|
||||
[node name="Version" type="Label" parent="Background"]
|
||||
z_index = 50
|
||||
z_as_relative = false
|
||||
offset_top = 6.0
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 29.0
|
||||
text = "GammaCosmicRays version Ifre 1.0"
|
||||
horizontal_alignment = 1
|
||||
script = SubResource("GDScript_4yoh5")
|
||||
|
|
|
|||
23
scenes/base_template.tscn
Normal file
23
scenes/base_template.tscn
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://dk3nvl8f0v24e"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://3x77t3kd6v0x" path="res://sprites/triangle_base.png" id="1_nrkxw"]
|
||||
|
||||
[node name="Base" type="StaticBody2D"]
|
||||
collision_layer = 2
|
||||
collision_mask = 7
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
position = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("1_nrkxw")
|
||||
|
||||
[node name="BaseCollider" type="CollisionPolygon2D" parent="."]
|
||||
position = Vector2(1, -2)
|
||||
polygon = PackedVector2Array(-2, 251, -58, 275, -91, 307, -91, 414, -179, 462, -420, 488, -422, 488, -548, 468, -549, 466, -502, 343, -359, 148, -273, 95, -183, -60, -181, -161, -83, -383, -1, -483, 0, -483, 82, -383, 180, -160, 183, -58, 272, 96, 359, 149, 502, 345, 548, 466, 547, 468, 421, 488, 419, 488, 178, 462, 90, 414, 90, 308, 60, 277, 1, 251)
|
||||
|
||||
[node name="VisibleArea" type="ColorRect" parent="."]
|
||||
z_index = -1
|
||||
offset_left = -181.0
|
||||
offset_top = 248.0
|
||||
offset_right = 177.0
|
||||
offset_bottom = 458.0
|
||||
color = Color(1, 1, 1, 0.352941)
|
||||
|
|
@ -17,6 +17,8 @@ class_name Hull
|
|||
"Laser Energy": 100.0,
|
||||
"Rockets": 10,
|
||||
}
|
||||
## How much speed should ship have before collision to take damage
|
||||
@export var velocity_collision_treshold: float = 200.0
|
||||
## Current ammunition. Change this with set_ammunition
|
||||
@onready var ammunition: Dictionary = max_ammunition.duplicate()
|
||||
|
||||
|
|
@ -31,6 +33,9 @@ class_name Hull
|
|||
## Length of linear_velocity vector
|
||||
var scalar_velocity: float = 0.0
|
||||
|
||||
func _ready():
|
||||
body_entered.connect(_on_body_entered)
|
||||
|
||||
## Adds amount to ammunition, returns true if it was successful
|
||||
func add_ammunition(which: String, value: float) -> bool:
|
||||
if ammunition[which] + value < 0:
|
||||
|
|
@ -44,3 +49,10 @@ func _physics_process(_delta):
|
|||
ship.position = position
|
||||
ship.rotation = rotation
|
||||
scalar_velocity = linear_velocity.length()
|
||||
|
||||
func _on_body_entered(_body):
|
||||
if scalar_velocity >= velocity_collision_treshold:
|
||||
ship.shield.deal_damage(20.0 * (scalar_velocity / velocity_collision_treshold))
|
||||
|
||||
func warp_to_position(location: Vector2):
|
||||
position = location
|
||||
|
|
|
|||
|
|
@ -21,13 +21,18 @@ var faction : Game.Faction = Game.Faction.Player
|
|||
|
||||
func _ready() -> void:
|
||||
hull.global_position = global_position
|
||||
destroyed.connect(destroy)
|
||||
destroyed.connect(destroy_timeout)
|
||||
|
||||
func destroy_timeout():
|
||||
get_tree().create_timer(0.02).timeout.connect(destroy)
|
||||
|
||||
## Reset all required variables
|
||||
func destroy() -> void:
|
||||
hull.hp = hull.max_hp
|
||||
hull.global_position = spawn_position
|
||||
hull.linear_velocity = Vector2.ZERO
|
||||
hull.angular_velocity = 0.0
|
||||
shield.capacity = shield.max_capacity
|
||||
hull.warp_to_position(spawn_position)
|
||||
|
||||
## Swaps old hull with the new one
|
||||
func change_hull(new_hull_id: String) -> void:
|
||||
|
|
|
|||
BIN
sprites/triangle_base.png
Normal file
BIN
sprites/triangle_base.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
34
sprites/triangle_base.png.import
Normal file
34
sprites/triangle_base.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://3x77t3kd6v0x"
|
||||
path="res://.godot/imported/triangle_base.png-3d74a6cc4d3435c6c24f8e581c372deb.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://sprites/triangle_base.png"
|
||||
dest_files=["res://.godot/imported/triangle_base.png-3d74a6cc4d3435c6c24f8e581c372deb.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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…
Add table
Add a link
Reference in a new issue