hp bar and borders

This commit is contained in:
Tabby 2025-07-20 17:33:13 +10:00
parent 4fa6a88b54
commit 16d7559965
10 changed files with 252 additions and 2 deletions

View file

@ -16,3 +16,4 @@ func _on_body_entered(body: Node2D) -> void:
#body.apply_force((body.global_position - global_position).normalized() *10000) #body.apply_force((body.global_position - global_position).normalized() *10000)
body.linear_velocity = (body.global_position - global_position).normalized() *100 body.linear_velocity = (body.global_position - global_position).normalized() *100
queue_free() queue_free()
body.got_hit.emit()

BIN
Sprites/sheilds.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cgvqs4g0bnol1"
path="res://.godot/imported/sheilds.png-e6f906b25cccea98b9af37620e951047.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/sheilds.png"
dest_files=["res://.godot/imported/sheilds.png-e6f906b25cccea98b9af37620e951047.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

BIN
Sprites/sheilds.pxo Normal file

Binary file not shown.

181
game.tscn
View file

@ -1,11 +1,14 @@
[gd_scene load_steps=15 format=4 uid="uid://hv07lm2tjwn4"] [gd_scene load_steps=30 format=4 uid="uid://hv07lm2tjwn4"]
[ext_resource type="PackedScene" uid="uid://crrbht7mwhgyc" path="res://Prefabs/lander.tscn" id="1_80nbo"] [ext_resource type="PackedScene" uid="uid://crrbht7mwhgyc" path="res://Prefabs/lander.tscn" id="1_80nbo"]
[ext_resource type="Script" uid="uid://bltj2frs6vqwj" path="res://autoscroll.gd" id="1_feb5d"] [ext_resource type="Script" uid="uid://bltj2frs6vqwj" path="res://autoscroll.gd" id="1_feb5d"]
[ext_resource type="Script" uid="uid://c8g6qerxpiepy" path="res://logic.gd" id="1_hve3p"]
[ext_resource type="Script" uid="uid://mwbiu2ajbxlk" path="res://battery_manager.gd" id="1_ryrav"] [ext_resource type="Script" uid="uid://mwbiu2ajbxlk" path="res://battery_manager.gd" id="1_ryrav"]
[ext_resource type="Texture2D" uid="uid://evhjxwdbsmlo" path="res://Sprites/start.png" id="2_e2o6t"] [ext_resource type="Texture2D" uid="uid://evhjxwdbsmlo" path="res://Sprites/start.png" id="2_e2o6t"]
[ext_resource type="Texture2D" uid="uid://cgvqs4g0bnol1" path="res://Sprites/sheilds.png" id="3_vef74"]
[ext_resource type="PackedScene" uid="uid://cfdsa5scvso6m" path="res://Prefabs/spare_battery.tscn" id="4_eow3j"] [ext_resource type="PackedScene" uid="uid://cfdsa5scvso6m" path="res://Prefabs/spare_battery.tscn" id="4_eow3j"]
[ext_resource type="Script" uid="uid://dd8psfqfobgau" path="res://test_obstacle_spawner.gd" id="6_vef74"] [ext_resource type="Script" uid="uid://dd8psfqfobgau" path="res://test_obstacle_spawner.gd" id="6_vef74"]
[ext_resource type="Script" uid="uid://b3w38e1a77qr0" path="res://screen_borders.gd" id="7_mfdv2"]
[ext_resource type="PackedScene" uid="uid://jb677rdhbj83" path="res://Prefabs/obstacle.tscn" id="8_j5wjh"] [ext_resource type="PackedScene" uid="uid://jb677rdhbj83" path="res://Prefabs/obstacle.tscn" id="8_j5wjh"]
[ext_resource type="PackedScene" uid="uid://bbtky034ivm5o" path="res://Prefabs/newObstacle.tscn" id="8_vef74"] [ext_resource type="PackedScene" uid="uid://bbtky034ivm5o" path="res://Prefabs/newObstacle.tscn" id="8_vef74"]
@ -23,6 +26,74 @@ height = 360
color_ramp = SubResource("Gradient_mwb40") color_ramp = SubResource("Gradient_mwb40")
noise = SubResource("FastNoiseLite_80nbo") noise = SubResource("FastNoiseLite_80nbo")
[sub_resource type="AtlasTexture" id="AtlasTexture_hve3p"]
atlas = ExtResource("3_vef74")
region = Rect2(0, 0, 49, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_mfdv2"]
atlas = ExtResource("3_vef74")
region = Rect2(49, 0, 49, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_iotsf"]
atlas = ExtResource("3_vef74")
region = Rect2(98, 0, 49, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_lc2xo"]
atlas = ExtResource("3_vef74")
region = Rect2(147, 0, 49, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_215e1"]
atlas = ExtResource("3_vef74")
region = Rect2(196, 0, 49, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_7sc4i"]
atlas = ExtResource("3_vef74")
region = Rect2(245, 0, 49, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_80cx4"]
atlas = ExtResource("3_vef74")
region = Rect2(294, 0, 49, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_e8heu"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_hve3p")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_mfdv2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_iotsf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lc2xo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_215e1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7sc4i")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_80cx4")
}],
"loop": false,
"name": &"default",
"speed": 5.0
}]
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_mfdv2"]
normal = Vector2(1, 0)
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_iotsf"]
normal = Vector2(0, 1)
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_lc2xo"]
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_215e1"]
normal = Vector2(-1, 0)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_feb5d"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_feb5d"]
size = Vector2(115, 20) size = Vector2(115, 20)
@ -33,7 +104,9 @@ scenes/1/scene = ExtResource("8_vef74")
physics_layer_0/collision_layer = 1 physics_layer_0/collision_layer = 1
sources/0 = SubResource("TileSetScenesCollectionSource_hve3p") sources/0 = SubResource("TileSetScenesCollectionSource_hve3p")
[node name="Game" type="Node2D"] [node name="Game" type="Node2D" node_paths=PackedStringArray("hp_bar")]
script = ExtResource("1_hve3p")
hp_bar = NodePath("CanvasLayer/UI/Sheilds/AnimatedSprite2D")
[node name="CanvasLayer" type="CanvasLayer" parent="."] [node name="CanvasLayer" type="CanvasLayer" parent="."]
@ -71,6 +144,19 @@ layout_mode = 2
[node name="Battery3" parent="CanvasLayer/UI/BatteryHolder" instance=ExtResource("4_eow3j")] [node name="Battery3" parent="CanvasLayer/UI/BatteryHolder" instance=ExtResource("4_eow3j")]
layout_mode = 2 layout_mode = 2
[node name="Sheilds" type="Control" parent="CanvasLayer/UI"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="CanvasLayer/UI/Sheilds"]
position = Vector2(589, 19)
scale = Vector2(2, 2)
sprite_frames = SubResource("SpriteFrames_e8heu")
[node name="Camera2D" type="Camera2D" parent="."] [node name="Camera2D" type="Camera2D" parent="."]
anchor_mode = 0 anchor_mode = 0
script = ExtResource("1_feb5d") script = ExtResource("1_feb5d")
@ -81,6 +167,40 @@ process_mode = 4
position = Vector2(673, 0) position = Vector2(673, 0)
script = ExtResource("6_vef74") script = ExtResource("6_vef74")
[node name="borders" type="Node2D" parent="Camera2D"]
[node name="screenBorders" type="Area2D" parent="Camera2D/borders" node_paths=PackedStringArray("collider")]
script = ExtResource("7_mfdv2")
collider = NodePath("CollisionShape2D")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Camera2D/borders/screenBorders"]
position = Vector2(-30, 209)
shape = SubResource("WorldBoundaryShape2D_mfdv2")
[node name="screenBorders2" type="Area2D" parent="Camera2D/borders" node_paths=PackedStringArray("collider")]
script = ExtResource("7_mfdv2")
collider = NodePath("CollisionShape2D2")
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Camera2D/borders/screenBorders2"]
position = Vector2(106, -30)
shape = SubResource("WorldBoundaryShape2D_iotsf")
[node name="screenBorders3" type="Area2D" parent="Camera2D/borders" node_paths=PackedStringArray("collider")]
script = ExtResource("7_mfdv2")
collider = NodePath("CollisionShape2D3")
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Camera2D/borders/screenBorders3"]
position = Vector2(141, 390)
shape = SubResource("WorldBoundaryShape2D_lc2xo")
[node name="screenBorders4" type="Area2D" parent="Camera2D/borders" node_paths=PackedStringArray("collider")]
script = ExtResource("7_mfdv2")
collider = NodePath("CollisionShape2D4")
[node name="CollisionShape2D4" type="CollisionShape2D" parent="Camera2D/borders/screenBorders4"]
position = Vector2(670, 182)
shape = SubResource("WorldBoundaryShape2D_215e1")
[node name="Lander" parent="." instance=ExtResource("1_80nbo")] [node name="Lander" parent="." instance=ExtResource("1_80nbo")]
position = Vector2(95, 324) position = Vector2(95, 324)
@ -123,5 +243,62 @@ position = Vector2(549, 39)
tile_map_data = PackedByteArray("AAAOABQAAAAAAAAAAQAPABUAAAAAAAAAAQAQABQAAAAAAAAAAQARABUAAAAAAAAAAQASABQAAAAAAAAAAQARAAsAAAAAAAAAAQASAAoAAAAAAAAAAQATAAsAAAAAAAAAAQAUAAoAAAAAAAAAAQAVAAsAAAAAAAAAAQAUAAwAAAAAAAAAAQASAAwAAAAAAAAAAQAdABIAAAAAAAAAAQAeABEAAAAAAAAAAQAeABMAAAAAAAAAAQAfABIAAAAAAAAAAQAgABEAAAAAAAAAAQAgABMAAAAAAAAAAQAhABIAAAAAAAAAAQAeAAMAAAAAAAAAAQAfAAQAAAAAAAAAAQAfAAIAAAAAAAAAAQAgAAMAAAAAAAAAAQAhAAIAAAAAAAAAAQAhAAQAAAAAAAAAAQAiAAMAAAAAAAAAAQAmABUAAAAAAAAAAQAnABQAAAAAAAAAAQAoABMAAAAAAAAAAQApABIAAAAAAAAAAQAqABEAAAAAAAAAAQArABAAAAAAAAAAAQAsAA8AAAAAAAAAAQAtAA4AAAAAAAAAAQAuAA0AAAAAAAAAAQAvAAwAAAAAAAAAAQAwAAsAAAAAAAAAAQAxAAoAAAAAAAAAAQAyAAkAAAAAAAAAAQAzAAgAAAAAAAAAAQBAAAAAAAAAAAAAAQBAAAIAAAAAAAAAAQBAAAQAAAAAAAAAAQBAAAYAAAAAAAAAAQBAAAgAAAAAAAAAAQBAAAoAAAAAAAAAAQA+AAwAAAAAAAAAAQA8AA4AAAAAAAAAAQA6ABAAAAAAAAAAAQA7AA8AAAAAAAAAAQA9AA0AAAAAAAAAAQA/AAsAAAAAAAAAAQA=") tile_map_data = PackedByteArray("AAAOABQAAAAAAAAAAQAPABUAAAAAAAAAAQAQABQAAAAAAAAAAQARABUAAAAAAAAAAQASABQAAAAAAAAAAQARAAsAAAAAAAAAAQASAAoAAAAAAAAAAQATAAsAAAAAAAAAAQAUAAoAAAAAAAAAAQAVAAsAAAAAAAAAAQAUAAwAAAAAAAAAAQASAAwAAAAAAAAAAQAdABIAAAAAAAAAAQAeABEAAAAAAAAAAQAeABMAAAAAAAAAAQAfABIAAAAAAAAAAQAgABEAAAAAAAAAAQAgABMAAAAAAAAAAQAhABIAAAAAAAAAAQAeAAMAAAAAAAAAAQAfAAQAAAAAAAAAAQAfAAIAAAAAAAAAAQAgAAMAAAAAAAAAAQAhAAIAAAAAAAAAAQAhAAQAAAAAAAAAAQAiAAMAAAAAAAAAAQAmABUAAAAAAAAAAQAnABQAAAAAAAAAAQAoABMAAAAAAAAAAQApABIAAAAAAAAAAQAqABEAAAAAAAAAAQArABAAAAAAAAAAAQAsAA8AAAAAAAAAAQAtAA4AAAAAAAAAAQAuAA0AAAAAAAAAAQAvAAwAAAAAAAAAAQAwAAsAAAAAAAAAAQAxAAoAAAAAAAAAAQAyAAkAAAAAAAAAAQAzAAgAAAAAAAAAAQBAAAAAAAAAAAAAAQBAAAIAAAAAAAAAAQBAAAQAAAAAAAAAAQBAAAYAAAAAAAAAAQBAAAgAAAAAAAAAAQBAAAoAAAAAAAAAAQA+AAwAAAAAAAAAAQA8AA4AAAAAAAAAAQA6ABAAAAAAAAAAAQA7AA8AAAAAAAAAAQA9AA0AAAAAAAAAAQA/AAsAAAAAAAAAAQA=")
tile_set = SubResource("TileSet_mfdv2") tile_set = SubResource("TileSet_mfdv2")
[connection signal="body_entered" from="Camera2D/borders/screenBorders" to="Camera2D/borders/screenBorders" method="_on_body_entered"]
[connection signal="body_entered" from="Camera2D/borders/screenBorders2" to="Camera2D/borders/screenBorders2" method="_on_body_entered"]
[connection signal="body_entered" from="Camera2D/borders/screenBorders3" to="Camera2D/borders/screenBorders3" method="_on_body_entered"]
[connection signal="body_entered" from="Camera2D/borders/screenBorders4" to="Camera2D/borders/screenBorders4" method="_on_body_entered"]
[connection signal="got_hit" from="Lander" to="." method="_on_lander_got_hit"]
[connection signal="moved" from="Lander" to="Camera2D" method="_on_lander_moved"] [connection signal="moved" from="Lander" to="Camera2D" method="_on_lander_moved"]
[connection signal="moved" from="Lander" to="Camera2D/TestObstacleSpawner" method="_on_lander_moved"] [connection signal="moved" from="Lander" to="Camera2D/TestObstacleSpawner" method="_on_lander_moved"]
[connection signal="body_entered" from="TileMapLayer/NewObstacle" to="TileMapLayer/NewObstacle" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57675" to="TileMapLayer/@Area2D@57675" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57676" to="TileMapLayer/@Area2D@57676" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57677" to="TileMapLayer/@Area2D@57677" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57678" to="TileMapLayer/@Area2D@57678" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57679" to="TileMapLayer/@Area2D@57679" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57680" to="TileMapLayer/@Area2D@57680" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57681" to="TileMapLayer/@Area2D@57681" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57682" to="TileMapLayer/@Area2D@57682" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57683" to="TileMapLayer/@Area2D@57683" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57684" to="TileMapLayer/@Area2D@57684" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57685" to="TileMapLayer/@Area2D@57685" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57686" to="TileMapLayer/@Area2D@57686" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57687" to="TileMapLayer/@Area2D@57687" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57688" to="TileMapLayer/@Area2D@57688" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57689" to="TileMapLayer/@Area2D@57689" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57690" to="TileMapLayer/@Area2D@57690" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57691" to="TileMapLayer/@Area2D@57691" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57692" to="TileMapLayer/@Area2D@57692" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57693" to="TileMapLayer/@Area2D@57693" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57694" to="TileMapLayer/@Area2D@57694" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57695" to="TileMapLayer/@Area2D@57695" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57696" to="TileMapLayer/@Area2D@57696" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57697" to="TileMapLayer/@Area2D@57697" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57698" to="TileMapLayer/@Area2D@57698" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57699" to="TileMapLayer/@Area2D@57699" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57700" to="TileMapLayer/@Area2D@57700" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57701" to="TileMapLayer/@Area2D@57701" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57702" to="TileMapLayer/@Area2D@57702" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57703" to="TileMapLayer/@Area2D@57703" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57704" to="TileMapLayer/@Area2D@57704" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57705" to="TileMapLayer/@Area2D@57705" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57706" to="TileMapLayer/@Area2D@57706" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57707" to="TileMapLayer/@Area2D@57707" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57708" to="TileMapLayer/@Area2D@57708" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57709" to="TileMapLayer/@Area2D@57709" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57710" to="TileMapLayer/@Area2D@57710" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57711" to="TileMapLayer/@Area2D@57711" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57712" to="TileMapLayer/@Area2D@57712" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57713" to="TileMapLayer/@Area2D@57713" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57714" to="TileMapLayer/@Area2D@57714" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57715" to="TileMapLayer/@Area2D@57715" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57716" to="TileMapLayer/@Area2D@57716" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57717" to="TileMapLayer/@Area2D@57717" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57718" to="TileMapLayer/@Area2D@57718" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57719" to="TileMapLayer/@Area2D@57719" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57720" to="TileMapLayer/@Area2D@57720" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57721" to="TileMapLayer/@Area2D@57721" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57722" to="TileMapLayer/@Area2D@57722" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57723" to="TileMapLayer/@Area2D@57723" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57724" to="TileMapLayer/@Area2D@57724" method="_on_body_entered"]
[connection signal="body_entered" from="TileMapLayer/@Area2D@57725" to="TileMapLayer/@Area2D@57725" method="_on_body_entered"]

17
logic.gd Normal file
View file

@ -0,0 +1,17 @@
extends Node2D
var hp : int = 6
@export var hp_bar : AnimatedSprite2D
# 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:
hp_bar.frame = hp
func _on_lander_got_hit() -> void:
hp -= 1

1
logic.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://c8g6qerxpiepy

18
screen_borders.gd Normal file
View file

@ -0,0 +1,18 @@
extends Area2D
@export var collider : CollisionShape2D
# 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
func _on_body_entered(body: Node2D) -> void:
if body is RigidBody2D:
#body.apply_force((body.global_position - global_position).normalized() *10000)
body.linear_velocity = (collider.shape.normal).normalized() *100
body.got_hit.emit()

1
screen_borders.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://b3w38e1a77qr0

View file

@ -1,6 +1,7 @@
extends RigidBody2D extends RigidBody2D
signal moved signal moved
signal got_hit
@export var thrust_power : float = 1 @export var thrust_power : float = 1
@export var turn_power : float = 1 @export var turn_power : float = 1