From 51be54d90514daeda719e99f170d9d2f3c550367 Mon Sep 17 00:00:00 2001 From: Tabby <41929769+tabby-cat-nya@users.noreply.github.com> Date: Sun, 11 May 2025 20:11:41 +1000 Subject: [PATCH] asteroids cooking --- base modules/channel_controller.gd | 11 +++++++-- base modules/test_channel.tscn | 5 +--- game_scene.tscn | 18 +++++++-------- games/asteroids/asteroids.tscn | 4 ++++ games/asteroids/bullet.tscn | 15 ++++++++++++ project.godot | 1 + sprites/asteroids_bullet.png | Bin 0 -> 474 bytes sprites/asteroids_bullet.png.import | 34 ++++++++++++++++++++++++++++ 8 files changed, 73 insertions(+), 15 deletions(-) create mode 100644 games/asteroids/bullet.tscn create mode 100644 sprites/asteroids_bullet.png create mode 100644 sprites/asteroids_bullet.png.import diff --git a/base modules/channel_controller.gd b/base modules/channel_controller.gd index c222caf..9dffc1f 100644 --- a/base modules/channel_controller.gd +++ b/base modules/channel_controller.gd @@ -8,9 +8,16 @@ class_name Channel @export var offline_channel_cover : TextureRect @export var game_viewport : SubViewport -var channel_online : bool - +var channel_online : bool = true +func _ready() -> void: + var new_scene = channel_scene.instantiate() + game_viewport.add_child(new_scene) + + + +func _process(delta: float) -> void: + offline_channel_cover.visible = !channel_online func start_channel(): pass diff --git a/base modules/test_channel.tscn b/base modules/test_channel.tscn index b66bcfe..0cf36ed 100644 --- a/base modules/test_channel.tscn +++ b/base modules/test_channel.tscn @@ -1,8 +1,7 @@ -[gd_scene load_steps=5 format=3 uid="uid://63rik2noj8id"] +[gd_scene load_steps=4 format=3 uid="uid://63rik2noj8id"] [ext_resource type="Script" uid="uid://h43mmpjmmir4" path="res://base modules/channel_controller.gd" id="1_r07ln"] [ext_resource type="Texture2D" uid="uid://cyo0wl4dt3td1" path="res://sprites/offline_channel.png" id="2_01b3p"] -[ext_resource type="PackedScene" uid="uid://ch1x8pfdu2b1g" path="res://test_game.tscn" id="3_27arb"] [sub_resource type="ViewportTexture" id="ViewportTexture_iix04"] viewport_path = NodePath("GameViewport") @@ -46,5 +45,3 @@ texture = ExtResource("2_01b3p") handle_input_locally = false size = Vector2i(640, 360) render_target_update_mode = 4 - -[node name="Game" parent="GameViewport" instance=ExtResource("3_27arb")] diff --git a/game_scene.tscn b/game_scene.tscn index 9fbb082..4013ff6 100644 --- a/game_scene.tscn +++ b/game_scene.tscn @@ -1,7 +1,9 @@ -[gd_scene load_steps=3 format=3 uid="uid://ct8axfbvd2wn4"] +[gd_scene load_steps=5 format=3 uid="uid://ct8axfbvd2wn4"] [ext_resource type="PackedScene" uid="uid://63rik2noj8id" path="res://base modules/test_channel.tscn" id="1_mlf6e"] +[ext_resource type="PackedScene" uid="uid://ch1x8pfdu2b1g" path="res://test_game.tscn" id="2_mixcd"] [ext_resource type="Texture2D" uid="uid://cyo0wl4dt3td1" path="res://sprites/offline_channel.png" id="2_po0ka"] +[ext_resource type="PackedScene" uid="uid://bw1hhx7lyfonr" path="res://games/asteroids/asteroids.tscn" id="3_mj2jn"] [node name="GameScene" type="Control"] layout_mode = 3 @@ -31,7 +33,12 @@ columns = 3 [node name="Control" parent="GridContainer" instance=ExtResource("1_mlf6e")] layout_mode = 2 -channel_name = "" +channel_scene = ExtResource("2_mixcd") + +[node name="Control2" parent="GridContainer" instance=ExtResource("1_mlf6e")] +layout_mode = 2 +channel_name = "Asteroids" +channel_scene = ExtResource("3_mj2jn") [node name="ColorRect" type="TextureRect" parent="GridContainer"] layout_mode = 2 @@ -82,12 +89,5 @@ size_flags_vertical = 3 texture = ExtResource("2_po0ka") expand_mode = 1 -[node name="ColorRect8" type="TextureRect" parent="GridContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 3 -texture = ExtResource("2_po0ka") -expand_mode = 1 - [node name="Camera2D" type="Camera2D" parent="."] offset = Vector2(320, 180) diff --git a/games/asteroids/asteroids.tscn b/games/asteroids/asteroids.tscn index 023db0e..b669215 100644 --- a/games/asteroids/asteroids.tscn +++ b/games/asteroids/asteroids.tscn @@ -37,7 +37,11 @@ rotation_force = 10 drag = 10 [node name="Sprite2D" type="Sprite2D" parent="Ship"] +texture_filter = 1 texture = ExtResource("2_j0tb1") [node name="CollisionShape2D" type="CollisionShape2D" parent="Ship"] shape = SubResource("CircleShape2D_dtqgl") + +[node name="Shooter" type="Marker2D" parent="Ship"] +position = Vector2(30, 0) diff --git a/games/asteroids/bullet.tscn b/games/asteroids/bullet.tscn new file mode 100644 index 0000000..68317bc --- /dev/null +++ b/games/asteroids/bullet.tscn @@ -0,0 +1,15 @@ +[gd_scene load_steps=3 format=3 uid="uid://i4us3nam2kn5"] + +[ext_resource type="Texture2D" uid="uid://b775cji263ifl" path="res://sprites/asteroids_bullet.png" id="1_bvcl6"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_bvcl6"] +radius = 13.0 + +[node name="Bullet" type="Area2D"] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_bvcl6") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture_filter = 1 +texture = ExtResource("1_bvcl6") diff --git a/project.godot b/project.godot index 22890bd..f5c8a79 100644 --- a/project.godot +++ b/project.godot @@ -36,5 +36,6 @@ asteroids_right={ [rendering] +textures/canvas_textures/default_texture_filter=0 renderer/rendering_method="gl_compatibility" renderer/rendering_method.mobile="gl_compatibility" diff --git a/sprites/asteroids_bullet.png b/sprites/asteroids_bullet.png new file mode 100644 index 0000000000000000000000000000000000000000..35be69939026f9cee16a5c7257dc509779a5f283 GIT binary patch literal 474 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCils0(?ST|Ns9FWQHEPTnD6>N`m}?|1&(@Zr}yvaTa()7BevL9R^{>tE>FG#3Oq+n{I`#tVmRAsg~!{qb}T}>k1)%#vqntLJg7ED>u>kVf_IG1 zJJl+9Bz(K4EOX6zA1cGTrmdd!w$k0e4Vp_#bb~B&8!skzsa52&J{MfWx%|`@SiM