very good progress, next up: tripping and starting the game

This commit is contained in:
Tabby 2025-05-15 15:28:16 +10:00
parent 8be34b6c12
commit f16d046a6c
14 changed files with 206 additions and 19 deletions

View file

@ -24,7 +24,7 @@ frame_3/duration = 1.0
frame_4/texture = ExtResource("7_5mkxt")
frame_4/duration = 1.0
[node name="Control" type="Control" node_paths=PackedStringArray("offline_channel_cover", "game_viewport")]
[node name="Control" type="Control" node_paths=PackedStringArray("offline_channel_cover", "static_channel_cover", "game_viewport")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
@ -36,6 +36,7 @@ size_flags_vertical = 3
script = ExtResource("1_r07ln")
channel_name = "Test"
offline_channel_cover = NodePath("OfflineChannelCover")
static_channel_cover = NodePath("Static")
game_viewport = NodePath("GameViewport")
[node name="GameDisplay" type="TextureRect" parent="."]

28
chatboxController.gd Normal file
View file

@ -0,0 +1,28 @@
extends PanelContainer
signal display_finished
@export var rich_label : RichTextLabel
var active : bool = false
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
GameManager.show_chat_signal.connect(displayMessage)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
visible = active
if Input.is_action_just_pressed("advance_prompt"):
hideMessage()
func hideMessage():
active = false
GameManager.change_player_movement(true)
func displayMessage(message = "String"):
rich_label.text = message
active = true
GameManager.change_player_movement(false)

1
chatboxController.gd.uid Normal file
View file

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

View file

@ -10,6 +10,7 @@ enum Gamemode{
@export var lives = 3
@export var platformer_game : PackedScene
@export var games : Array[PackedScene]
@export var zoom_speed : float = 0.5
@export_group("Node References")
@export var main_camera : Camera2D
@export var outer_channels : Array[Channel]
@ -30,7 +31,7 @@ func _process(delta: float) -> void:
#if(Input.is_action_just_pressed("ui_down")):
#zoom_out()
if(zooming_out):
var zoom_amount : float = clampf(main_camera.zoom.x - delta,1, 4 )
var zoom_amount : float = clampf(main_camera.zoom.x - delta * zoom_speed,1, 4 )
main_camera.zoom = Vector2(zoom_amount,zoom_amount)
func zoom_out():

View file

@ -3,6 +3,9 @@ extends Node
# it is I, the manaegr of the games~
signal zoom_out_signal
signal allow_movement(bool)
signal show_chat_signal(String)
signal show_item_signal(String, Texture)
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
@ -15,3 +18,12 @@ func _process(delta: float) -> void:
func play_zoom_out():
zoom_out_signal.emit()
func show_chat(text : String):
show_chat_signal.emit(text)
func show_item(text : String, texture : Texture):
show_item_signal.emit(text,texture)
func change_player_movement(state : bool):
allow_movement.emit(state)

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=3 uid="uid://ct8axfbvd2wn4"]
[gd_scene load_steps=15 format=3 uid="uid://ct8axfbvd2wn4"]
[ext_resource type="Script" uid="uid://d2q6xfk8htbyy" path="res://game_logic.gd" id="1_j5hk1"]
[ext_resource type="PackedScene" uid="uid://63rik2noj8id" path="res://base modules/test_channel.tscn" id="1_mlf6e"]
@ -11,6 +11,12 @@
[ext_resource type="PackedScene" uid="uid://bkabgl6p44c5b" path="res://games/space invaders/space_invaders.tscn" id="9_miq82"]
[ext_resource type="PackedScene" uid="uid://drk2fwkv816qv" path="res://games/crafting/crafting.tscn" id="9_udeyl"]
[ext_resource type="Texture2D" uid="uid://baf30tscdkl0i" path="res://sprites/tv_remote.png" id="11_j5hk1"]
[ext_resource type="Script" uid="uid://dgq2y6wjlye6" path="res://chatboxController.gd" id="11_ueiaa"]
[ext_resource type="Script" uid="uid://dnptjh111yd8i" path="res://itemPopup.gd" id="12_daj04"]
[sub_resource type="LabelSettings" id="LabelSettings_daj04"]
font_size = 11
font_color = Color(1, 1, 1, 0.533333)
[node name="GameScene" type="Control" node_paths=PackedStringArray("main_camera", "outer_channels", "main_channel")]
layout_mode = 3
@ -91,9 +97,10 @@ channel_scene = ExtResource("9_udeyl")
[node name="Camera2D" type="Camera2D" parent="."]
offset = Vector2(320, 180)
[node name="Chat" type="PanelContainer" parent="."]
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Chat" type="PanelContainer" parent="CanvasLayer" node_paths=PackedStringArray("rich_label")]
custom_minimum_size = Vector2(500, 0)
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
@ -105,59 +112,78 @@ offset_right = 250.0
offset_bottom = -11.0
grow_horizontal = 2
grow_vertical = 0
script = ExtResource("11_ueiaa")
rich_label = NodePath("MarginContainer/RichTextLabel")
[node name="MarginContainer" type="MarginContainer" parent="Chat"]
[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer/Chat"]
layout_mode = 2
theme_override_constants/margin_left = 5
theme_override_constants/margin_top = 5
theme_override_constants/margin_right = 5
theme_override_constants/margin_bottom = 5
[node name="RichTextLabel" type="RichTextLabel" parent="Chat/MarginContainer"]
[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/Chat/MarginContainer"]
layout_mode = 2
bbcode_enabled = true
text = "Uh oh...."
[node name="Item Get Popup" type="PanelContainer" parent="."]
[node name="Label" type="Label" parent="CanvasLayer/Chat"]
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 8
text = "Press Enter..."
label_settings = SubResource("LabelSettings_daj04")
[node name="Item Get Popup" type="PanelContainer" parent="CanvasLayer" node_paths=PackedStringArray("texture_rect", "label")]
custom_minimum_size = Vector2(200, 200)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -5.0
offset_top = -5.0
offset_right = 5.0
offset_bottom = 5.0
offset_left = -100.0
offset_top = -100.0
offset_right = 100.0
offset_bottom = 100.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("12_daj04")
texture_rect = NodePath("MarginContainer/VBoxContainer/TextureRect")
label = NodePath("MarginContainer/VBoxContainer/Label2")
[node name="MarginContainer" type="MarginContainer" parent="Item Get Popup"]
[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer/Item Get Popup"]
layout_mode = 2
theme_override_constants/margin_left = 5
theme_override_constants/margin_top = 5
theme_override_constants/margin_right = 5
theme_override_constants/margin_bottom = 5
[node name="VBoxContainer" type="VBoxContainer" parent="Item Get Popup/MarginContainer"]
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/Item Get Popup/MarginContainer"]
layout_mode = 2
[node name="Label" type="RichTextLabel" parent="Item Get Popup/MarginContainer/VBoxContainer"]
[node name="Label" type="RichTextLabel" parent="CanvasLayer/Item Get Popup/MarginContainer/VBoxContainer"]
layout_mode = 2
bbcode_enabled = true
text = "[wave]You got an Item!"
fit_content = true
horizontal_alignment = 1
[node name="TextureRect" type="TextureRect" parent="Item Get Popup/MarginContainer/VBoxContainer"]
[node name="TextureRect" type="TextureRect" parent="CanvasLayer/Item Get Popup/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
texture = ExtResource("11_j5hk1")
stretch_mode = 5
[node name="Label2" type="RichTextLabel" parent="Item Get Popup/MarginContainer/VBoxContainer"]
[node name="Label2" type="RichTextLabel" parent="CanvasLayer/Item Get Popup/MarginContainer/VBoxContainer"]
layout_mode = 2
bbcode_enabled = true
text = "[b]TV Remote"
fit_content = true
horizontal_alignment = 1
[node name="Label3" type="Label" parent="CanvasLayer/Item Get Popup/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 8
text = "Press Enter..."
label_settings = SubResource("LabelSettings_daj04")

View file

@ -0,0 +1,12 @@
[gd_scene load_steps=3 format=3 uid="uid://bgpoql6pt8pph"]
[ext_resource type="Script" uid="uid://xt8j1hudv1kh" path="res://games/platformer/talky.gd" id="1_hssep"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_gqvfi"]
size = Vector2(100, 20)
[node name="Event" type="Area2D"]
script = ExtResource("1_hssep")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_gqvfi")

View file

@ -1,12 +1,14 @@
[gd_scene load_steps=17 format=4 uid="uid://ckbyiwy0dxbsd"]
[gd_scene load_steps=20 format=4 uid="uid://ckbyiwy0dxbsd"]
[ext_resource type="Script" uid="uid://dqyddqx8xm0gw" path="res://games/platformer/player.gd" id="1_1wj3w"]
[ext_resource type="Texture2D" uid="uid://diilj7xuttpqu" path="res://icon.svg" id="1_oyf6i"]
[ext_resource type="Texture2D" uid="uid://baf30tscdkl0i" path="res://sprites/tv_remote.png" id="2_7eu3u"]
[ext_resource type="Texture2D" uid="uid://g5arxk4po7kw" path="res://sprites/platformer_lab_tile.png" id="3_84mot"]
[ext_resource type="Texture2D" uid="uid://d1mo5ecyjgngw" path="res://sprites/platformer_stone_tile.png" id="4_86tx6"]
[ext_resource type="PackedScene" uid="uid://q3wdnawp7n63" path="res://games/platformer/lab_platform.tscn" id="4_w58m1"]
[ext_resource type="Script" uid="uid://43jxroyergh0" path="res://games/platformer/platformerCam.gd" id="5_x2rtd"]
[ext_resource type="Texture2D" uid="uid://dyjxtuapxfiip" path="res://sprites/box.png" id="6_02uuf"]
[ext_resource type="PackedScene" uid="uid://bgpoql6pt8pph" path="res://games/platformer/event.tscn" id="8_gqvfi"]
[sub_resource type="Gradient" id="Gradient_1wj3w"]
offsets = PackedFloat32Array(0.0209205, 1)
@ -45,6 +47,9 @@ sources/1 = SubResource("TileSetAtlasSource_gqvfi")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_86tx6"]
size = Vector2(32, 32)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_7eu3u"]
size = Vector2(20, 150)
[node name="Platformer" type="Node"]
[node name="Parallax2D" type="Parallax2D" parent="."]
@ -65,6 +70,7 @@ texture = SubResource("GradientTexture2D_84mot")
[node name="Player" type="CharacterBody2D" parent="."]
position = Vector2(-1552, -504)
script = ExtResource("1_1wj3w")
remote_sprite = ExtResource("2_7eu3u")
[node name="Sprite2D" type="Sprite2D" parent="Player"]
scale = Vector2(0.25, 0.25)
@ -117,4 +123,25 @@ texture = ExtResource("6_02uuf")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Box"]
shape = SubResource("RectangleShape2D_86tx6")
[node name="Event" parent="." instance=ExtResource("8_gqvfi")]
position = Vector2(-1552, -472)
text = "Aha, I've finaly found a way in! Now time to find some treasure from this abandoned lab..."
[node name="Event2" parent="." instance=ExtResource("8_gqvfi")]
position = Vector2(-856, 240)
rotation = 1.57079
text = "Ooh that looks interesting..."
[node name="Zoomer" type="Area2D" parent="."]
position = Vector2(-368, 208)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Zoomer"]
shape = SubResource("RectangleShape2D_7eu3u")
[node name="TheBitWhereYouTrip" type="Area2D" parent="."]
position = Vector2(32, 248)
[node name="CollisionShape2D" type="CollisionShape2D" parent="TheBitWhereYouTrip"]
shape = SubResource("RectangleShape2D_7eu3u")
[connection signal="area_entered" from="Player/hitbox" to="Player" method="_on_hitbox_area_entered"]

View file

@ -4,8 +4,11 @@ signal remote_get
@export var SPEED = 200.0
@export var JUMP_VELOCITY = -450.0
@export var remote_sprite : Texture
var controls_enabled : bool = true
func _ready() -> void:
GameManager.allow_movement.connect(change_player_movement)
func _process(delta: float) -> void:
@ -13,6 +16,7 @@ func _process(delta: float) -> void:
if not is_on_floor():
velocity += get_gravity() * delta
if(controls_enabled):
# Handle jump.
if Input.is_action_just_pressed("platformer_jump") and is_on_floor():
@ -25,6 +29,8 @@ func _process(delta: float) -> void:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
move_and_slide()
@ -32,8 +38,28 @@ func _process(delta: float) -> void:
func _on_hitbox_area_entered(area: Area2D) -> void:
#print(area.name)
if(area.name == "Box"):
#GameManager.play_zoom_out()
area.monitoring = false
GameManager.show_item("TV Remote", remote_sprite)
GameManager.show_chat("Wonder what i can do with this")
if(is_instance_of(area,Event)):
#GameManager.play_zoom_out()
area.monitoring = false
if(area.type == Event.Type.Chat):
GameManager.show_chat(area.text)
elif(area.type == Event.Type.Item):
GameManager.show_item(area.text, area.texture)
if(area.name == "Zoomer"):
GameManager.play_zoom_out()
GameManager.show_chat("I guess it did something..?")
#GameManager.play_zoom_out()
#box event
#laser event
#sticky tape event
pass # Replace with function body.
func change_player_movement(state : bool):
#print(state) #im an idiot :3
controls_enabled = state

20
games/platformer/talky.gd Normal file
View file

@ -0,0 +1,20 @@
extends Area2D
class_name Event
enum Type{
Chat,
Item
}
@export var type : Type
@export_multiline var text : String
@export var texture : Texture
# 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

View file

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

26
itemPopup.gd Normal file
View file

@ -0,0 +1,26 @@
extends PanelContainer
@export var texture_rect : TextureRect
@export var label : RichTextLabel
var active : bool = false
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
GameManager.show_item_signal.connect(showPopup)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
visible = active
if(Input.is_action_just_pressed("advance_prompt")):
hidePopup()
func showPopup(item_name : String, item_texture : Texture):
label.text = item_name
texture_rect.texture = item_texture
active = true
GameManager.change_player_movement(false)
func hidePopup():
active = false
GameManager.change_player_movement(true)

1
itemPopup.gd.uid Normal file
View file

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

View file

@ -212,6 +212,11 @@ ddr_right={
"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":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
advance_prompt={
"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":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[rendering]