working on platfoermer, rather confused
This commit is contained in:
parent
34eb42616d
commit
88cb8f5899
11 changed files with 244 additions and 7 deletions
10
bugs.md
Normal file
10
bugs.md
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# High Priority
|
||||||
|
- [ ] remote breaking animation not working
|
||||||
|
- [x] pressing enter causes the platformer channel to restart event after the intiial prompt dismissial
|
||||||
|
- [ ] lasers not appearing
|
||||||
|
- [ ] only 1 lane getting warning
|
||||||
|
|
||||||
|
|
||||||
|
# Minor
|
||||||
|
- [ ] score text is infront of the player
|
||||||
|
- [ ] warning areas are infront of the player
|
||||||
|
|
@ -61,6 +61,7 @@ func get_ready():
|
||||||
|
|
||||||
func start_game():
|
func start_game():
|
||||||
gameplay = true
|
gameplay = true
|
||||||
|
main_channel.start_channel()
|
||||||
|
|
||||||
func game_loop(delta : float):
|
func game_loop(delta : float):
|
||||||
target_channels += channel_growth_per_min * (delta/60)
|
target_channels += channel_growth_per_min * (delta/60)
|
||||||
|
|
@ -82,7 +83,10 @@ func game_loop(delta : float):
|
||||||
var random_channel_number = randi_range(0, offline_channels.size()-1)
|
var random_channel_number = randi_range(0, offline_channels.size()-1)
|
||||||
var random_game = randi_range(0, games.size()-1)
|
var random_game = randi_range(0, games.size()-1)
|
||||||
#offline_channels[random_channel_number].start_channel()
|
#offline_channels[random_channel_number].start_channel()
|
||||||
|
if(offline_channels[random_channel_number] != main_channel):
|
||||||
offline_channels[random_channel_number].start_specific_channel(games[random_game])
|
offline_channels[random_channel_number].start_specific_channel(games[random_game])
|
||||||
|
else:
|
||||||
|
main_channel.start_channel()
|
||||||
|
|
||||||
func rec_channel_win():
|
func rec_channel_win():
|
||||||
score += 1
|
score += 1
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ signal channel_win
|
||||||
signal channel_lose
|
signal channel_lose
|
||||||
signal update_data(score : int, lives : int)
|
signal update_data(score : int, lives : int)
|
||||||
signal skip_intro
|
signal skip_intro
|
||||||
|
signal start_platformer
|
||||||
|
signal end_platformer
|
||||||
|
|
||||||
@export var broken_tv_remote : Texture
|
@export var broken_tv_remote : Texture
|
||||||
var are_we_skipping_intro : bool = false
|
var are_we_skipping_intro : bool = false
|
||||||
|
|
@ -47,6 +49,7 @@ func prepare_for_gaming():
|
||||||
|
|
||||||
func actually_gaming():
|
func actually_gaming():
|
||||||
gaming.emit()
|
gaming.emit()
|
||||||
|
start_platformer.emit()
|
||||||
|
|
||||||
func send_update_data(score : int, lives: int):
|
func send_update_data(score : int, lives: int):
|
||||||
update_data.emit(score, lives)
|
update_data.emit(score, lives)
|
||||||
|
|
|
||||||
16
games/platformer/flasher.gd
Normal file
16
games/platformer/flasher.gd
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
extends Sprite2D
|
||||||
|
|
||||||
|
var flash_delay : float = 0.3
|
||||||
|
var timer :float = 1
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
timer = flash_delay
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
timer -= delta
|
||||||
|
if(timer <= 0):
|
||||||
|
visible = !visible
|
||||||
|
timer = flash_delay
|
||||||
1
games/platformer/flasher.gd.uid
Normal file
1
games/platformer/flasher.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bvldm4nv0g3
|
||||||
|
|
@ -3,21 +3,45 @@ extends Node
|
||||||
signal game_win
|
signal game_win
|
||||||
signal game_lose
|
signal game_lose
|
||||||
|
|
||||||
|
enum GameStage{
|
||||||
|
Warning, # big red highlights (flashing?) show the player where to avoid
|
||||||
|
Lasers, # the lasers actively firing
|
||||||
|
None # the starting and ending (offline) state where nothing is happening
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@export var warning_duration = 5
|
||||||
|
@export var laser_duration = 2
|
||||||
@export_group("Node References")
|
@export_group("Node References")
|
||||||
@export var score_label : Label
|
@export var score_label : Label
|
||||||
@export var player : CharacterBody2D
|
@export var player : CharacterBody2D
|
||||||
@export var skip_location : Marker2D
|
@export var skip_location : Marker2D
|
||||||
|
@export var timer : Timer
|
||||||
|
@export var warning_areas : Array[Node2D]
|
||||||
|
@export var laser_areas : Array[Area2D]
|
||||||
|
|
||||||
|
var game_active : bool = false
|
||||||
|
var stage : GameStage = GameStage.None
|
||||||
|
var safe_lane : int # 0,1 or 2 - the others will be hit by lasers
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
GameManager.skip_intro.connect(rec_skip_intro)
|
GameManager.skip_intro.connect(rec_skip_intro)
|
||||||
GameManager.update_data.connect(update_ui)
|
GameManager.update_data.connect(update_ui)
|
||||||
|
GameManager.start_platformer.connect(start_game)
|
||||||
|
GameManager.end_platformer.connect(end_game)
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
|
for i in range(2):
|
||||||
|
#warning_areas[i].visible = stage == GameStage.Warning and safe_lane!=i
|
||||||
|
#laser_areas[i].visible = stage == GameStage.Lasers and safe_lane!=i
|
||||||
pass
|
pass
|
||||||
|
warning_areas[0].visible = stage == GameStage.Warning
|
||||||
|
laser_areas[0].visible = stage == GameStage.Lasers
|
||||||
|
#todo make sure lasers dont trigger the door/remote/event hitboxes
|
||||||
|
|
||||||
func update_ui(score : int, lives :int):
|
func update_ui(score : int, lives :int):
|
||||||
score_label.text = str(score)
|
score_label.text = str(score)
|
||||||
|
|
@ -27,3 +51,22 @@ func rec_skip_intro():
|
||||||
player.global_position = skip_location.global_position
|
player.global_position = skip_location.global_position
|
||||||
#maybe bring up an invis wall behind them but it doesnt matter
|
#maybe bring up an invis wall behind them but it doesnt matter
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
func start_game():
|
||||||
|
game_active = true
|
||||||
|
timer.start(warning_duration)
|
||||||
|
safe_lane = randi_range(0,2)
|
||||||
|
stage = GameStage.Warning
|
||||||
|
pass
|
||||||
|
|
||||||
|
func end_game():
|
||||||
|
game_active = false
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _on_timer_timeout() -> void:
|
||||||
|
if(stage == GameStage.Warning):
|
||||||
|
stage = GameStage.Lasers
|
||||||
|
timer.start(laser_duration)
|
||||||
|
if(stage == GameStage.Lasers):
|
||||||
|
stage = GameStage.None
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=32 format=4 uid="uid://ckbyiwy0dxbsd"]
|
[gd_scene load_steps=36 format=4 uid="uid://ckbyiwy0dxbsd"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dqyddqx8xm0gw" path="res://games/platformer/player.gd" id="1_1wj3w"]
|
[ext_resource type="Script" uid="uid://dqyddqx8xm0gw" path="res://games/platformer/player.gd" id="1_1wj3w"]
|
||||||
[ext_resource type="Script" uid="uid://bs4keltwfbrrn" path="res://games/platformer/platformer.gd" id="1_mauky"]
|
[ext_resource type="Script" uid="uid://bs4keltwfbrrn" path="res://games/platformer/platformer.gd" id="1_mauky"]
|
||||||
|
|
@ -15,6 +15,9 @@
|
||||||
[ext_resource type="Texture2D" uid="uid://r71wb0u4bsxw" path="res://sprites/broken_tv_remote.png" id="11_vuxiy"]
|
[ext_resource type="Texture2D" uid="uid://r71wb0u4bsxw" path="res://sprites/broken_tv_remote.png" id="11_vuxiy"]
|
||||||
[ext_resource type="Script" uid="uid://bl7sx7fl7ye4a" path="res://games/platformer/tv_remote.gd" id="13_7gl5q"]
|
[ext_resource type="Script" uid="uid://bl7sx7fl7ye4a" path="res://games/platformer/tv_remote.gd" id="13_7gl5q"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dv4ex5tshavff" path="res://games/platformer/door.tscn" id="14_yphhh"]
|
[ext_resource type="PackedScene" uid="uid://dv4ex5tshavff" path="res://games/platformer/door.tscn" id="14_yphhh"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bvnudttaiaab5" path="res://sprites/platformer_lab_laser.png" id="16_wtveo"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dyfubdnvunea2" path="res://sprites/whiteSqaure.png" id="17_x1jr7"]
|
||||||
|
[ext_resource type="Script" uid="uid://bvldm4nv0g3" path="res://games/platformer/flasher.gd" id="18_x1jr7"]
|
||||||
|
|
||||||
[sub_resource type="Gradient" id="Gradient_1wj3w"]
|
[sub_resource type="Gradient" id="Gradient_1wj3w"]
|
||||||
offsets = PackedFloat32Array(0.0209205, 1)
|
offsets = PackedFloat32Array(0.0209205, 1)
|
||||||
|
|
@ -185,11 +188,17 @@ animations = [{
|
||||||
font_size = 86
|
font_size = 86
|
||||||
font_color = Color(1, 1, 1, 0.439216)
|
font_color = Color(1, 1, 1, 0.439216)
|
||||||
|
|
||||||
[node name="Platformer" type="Node" node_paths=PackedStringArray("score_label", "player", "skip_location")]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_gyyvr"]
|
||||||
|
size = Vector2(576, 64)
|
||||||
|
|
||||||
|
[node name="Platformer" type="Node" node_paths=PackedStringArray("score_label", "player", "skip_location", "timer", "warning_areas", "laser_areas")]
|
||||||
script = ExtResource("1_mauky")
|
script = ExtResource("1_mauky")
|
||||||
score_label = NodePath("Score")
|
score_label = NodePath("Score")
|
||||||
player = NodePath("Player")
|
player = NodePath("Player")
|
||||||
skip_location = NodePath("IntroSkipLocation")
|
skip_location = NodePath("IntroSkipLocation")
|
||||||
|
timer = NodePath("Timer")
|
||||||
|
warning_areas = [NodePath("Warnings/WarningNode"), NodePath("Warnings/WarningNode2"), NodePath("Warnings/WarningNode3")]
|
||||||
|
laser_areas = [NodePath("Lasers/LaserSet"), NodePath("Lasers/LaserSet2"), NodePath("Lasers/LaserSet3")]
|
||||||
|
|
||||||
[node name="Parallax2D" type="Parallax2D" parent="."]
|
[node name="Parallax2D" type="Parallax2D" parent="."]
|
||||||
scroll_scale = Vector2(0, 0)
|
scroll_scale = Vector2(0, 0)
|
||||||
|
|
@ -330,6 +339,106 @@ horizontal_alignment = 1
|
||||||
[node name="IntroSkipLocation" type="Marker2D" parent="."]
|
[node name="IntroSkipLocation" type="Marker2D" parent="."]
|
||||||
position = Vector2(-40, 256)
|
position = Vector2(-40, 256)
|
||||||
|
|
||||||
|
[node name="Timer" type="Timer" parent="."]
|
||||||
|
|
||||||
|
[node name="Lasers" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="LaserSet" type="Area2D" parent="Lasers"]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(40, 40)
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="Lasers/LaserSet"]
|
||||||
|
position = Vector2(280, 8)
|
||||||
|
rotation = 1.57079
|
||||||
|
scale = Vector2(2.003, 36)
|
||||||
|
texture = ExtResource("16_wtveo")
|
||||||
|
|
||||||
|
[node name="Sprite2D2" type="Sprite2D" parent="Lasers/LaserSet"]
|
||||||
|
position = Vector2(280, 40)
|
||||||
|
rotation = 1.57079
|
||||||
|
scale = Vector2(2.003, 36)
|
||||||
|
texture = ExtResource("16_wtveo")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Lasers/LaserSet"]
|
||||||
|
position = Vector2(280, 24)
|
||||||
|
shape = SubResource("RectangleShape2D_gyyvr")
|
||||||
|
debug_color = Color(0.977603, 0, 0.402823, 0.42)
|
||||||
|
|
||||||
|
[node name="LaserSet2" type="Area2D" parent="Lasers"]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(40, 136)
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="Lasers/LaserSet2"]
|
||||||
|
position = Vector2(280, 8)
|
||||||
|
rotation = 1.57079
|
||||||
|
scale = Vector2(2.003, 36)
|
||||||
|
texture = ExtResource("16_wtveo")
|
||||||
|
|
||||||
|
[node name="Sprite2D2" type="Sprite2D" parent="Lasers/LaserSet2"]
|
||||||
|
position = Vector2(280, 40)
|
||||||
|
rotation = 1.57079
|
||||||
|
scale = Vector2(2.003, 36)
|
||||||
|
texture = ExtResource("16_wtveo")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Lasers/LaserSet2"]
|
||||||
|
position = Vector2(280, 24)
|
||||||
|
shape = SubResource("RectangleShape2D_gyyvr")
|
||||||
|
debug_color = Color(0.977603, 0, 0.402823, 0.42)
|
||||||
|
|
||||||
|
[node name="LaserSet3" type="Area2D" parent="Lasers"]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(40, 232)
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="Lasers/LaserSet3"]
|
||||||
|
position = Vector2(280, 8)
|
||||||
|
rotation = 1.57079
|
||||||
|
scale = Vector2(2.003, 36)
|
||||||
|
texture = ExtResource("16_wtveo")
|
||||||
|
|
||||||
|
[node name="Sprite2D2" type="Sprite2D" parent="Lasers/LaserSet3"]
|
||||||
|
position = Vector2(280, 40)
|
||||||
|
rotation = 1.57079
|
||||||
|
scale = Vector2(2.003, 36)
|
||||||
|
texture = ExtResource("16_wtveo")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Lasers/LaserSet3"]
|
||||||
|
position = Vector2(280, 24)
|
||||||
|
shape = SubResource("RectangleShape2D_gyyvr")
|
||||||
|
debug_color = Color(0.977603, 0, 0.402823, 0.42)
|
||||||
|
|
||||||
|
[node name="Warnings" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="WarningNode" type="Node2D" parent="Warnings"]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(320, 64)
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="Warnings/WarningNode"]
|
||||||
|
modulate = Color(1, 0, 0, 0.482353)
|
||||||
|
scale = Vector2(18, 2)
|
||||||
|
texture = ExtResource("17_x1jr7")
|
||||||
|
script = ExtResource("18_x1jr7")
|
||||||
|
|
||||||
|
[node name="WarningNode2" type="Node2D" parent="Warnings"]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(320, 160)
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="Warnings/WarningNode2"]
|
||||||
|
modulate = Color(1, 0, 0, 0.482353)
|
||||||
|
scale = Vector2(18, 2)
|
||||||
|
texture = ExtResource("17_x1jr7")
|
||||||
|
script = ExtResource("18_x1jr7")
|
||||||
|
|
||||||
|
[node name="WarningNode3" type="Node2D" parent="Warnings"]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(320, 256)
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="Warnings/WarningNode3"]
|
||||||
|
modulate = Color(1, 0, 0, 0.482353)
|
||||||
|
scale = Vector2(18, 2)
|
||||||
|
texture = ExtResource("17_x1jr7")
|
||||||
|
script = ExtResource("18_x1jr7")
|
||||||
|
|
||||||
[connection signal="area_entered" from="Player/hitbox" to="Player" method="_on_hitbox_area_entered"]
|
[connection signal="area_entered" from="Player/hitbox" to="Player" method="_on_hitbox_area_entered"]
|
||||||
[connection signal="area_entered" from="TheBitWhereYouTrip" to="TripAnimation" method="_on_the_bit_where_you_trip_area_entered"]
|
[connection signal="area_entered" from="TheBitWhereYouTrip" to="TripAnimation" method="_on_the_bit_where_you_trip_area_entered"]
|
||||||
[connection signal="area_entered" from="BrokenRemote" to="AnimationProps/TVRemote" method="_on_broken_remote_area_entered"]
|
[connection signal="area_entered" from="BrokenRemote" to="AnimationProps/TVRemote" method="_on_broken_remote_area_entered"]
|
||||||
|
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,18 @@
|
||||||
extends Channel
|
extends Channel
|
||||||
|
|
||||||
|
var platformer_online : bool = true
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
#GameManager.end_platformer.connect(end_channel) #maybe?
|
||||||
|
pass
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
offline_channel_cover.visible = channel_mode == Mode.Offline
|
offline_channel_cover.visible = channel_mode == Mode.Offline
|
||||||
static_channel_cover.visible = channel_mode == Mode.Static
|
static_channel_cover.visible = channel_mode == Mode.Static
|
||||||
|
if platformer_online :
|
||||||
|
modulate = Color.WHITE
|
||||||
|
else:
|
||||||
|
modulate = Color.DIM_GRAY
|
||||||
|
|
||||||
func start_specific_channel(scene : PackedScene):
|
func start_specific_channel(scene : PackedScene):
|
||||||
var new_scene = scene.instantiate()
|
var new_scene = scene.instantiate()
|
||||||
|
|
@ -12,11 +22,16 @@ func start_specific_channel(scene : PackedScene):
|
||||||
channel_mode = Mode.Online
|
channel_mode = Mode.Online
|
||||||
|
|
||||||
func start_channel():
|
func start_channel():
|
||||||
start_specific_channel(channel_scene)
|
#start_specific_channel(channel_scene)
|
||||||
|
print("we do a bit of ovveridng")
|
||||||
|
platformer_online = true
|
||||||
|
GameManager.start_platformer.emit()
|
||||||
|
|
||||||
|
|
||||||
func end_channel():
|
func end_channel():
|
||||||
channel_mode = Mode.Static
|
#channel_mode = Mode.Static
|
||||||
modulate = Color.DIM_GRAY
|
#modulate = Color.DIM_GRAY
|
||||||
|
platformer_online = false
|
||||||
# TODO: a bunch of stuff here
|
# TODO: a bunch of stuff here
|
||||||
## bro what did you mean when you meant this T_T
|
## bro what did you mean when you meant this T_T
|
||||||
#game_viewport.get_child(0).queue_free()
|
#game_viewport.get_child(0).queue_free()
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ func _process(delta: float) -> void:
|
||||||
if(Input.is_action_just_pressed("advance_prompt")):
|
if(Input.is_action_just_pressed("advance_prompt")):
|
||||||
hidePopup()
|
hidePopup()
|
||||||
if(label.text == "Broken TV Remote"):
|
if(label.text == "Broken TV Remote"):
|
||||||
|
label.text = ""
|
||||||
|
print("meow")
|
||||||
GameManager.actually_gaming()
|
GameManager.actually_gaming()
|
||||||
|
|
||||||
func showPopup(item_name : String, item_texture : Texture):
|
func showPopup(item_name : String, item_texture : Texture):
|
||||||
|
|
|
||||||
BIN
sprites/whiteSqaure.png
Normal file
BIN
sprites/whiteSqaure.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 368 B |
34
sprites/whiteSqaure.png.import
Normal file
34
sprites/whiteSqaure.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dyfubdnvunea2"
|
||||||
|
path="res://.godot/imported/whiteSqaure.png-2e11be57a2236d893a3450f853de9c71.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://sprites/whiteSqaure.png"
|
||||||
|
dest_files=["res://.godot/imported/whiteSqaure.png-2e11be57a2236d893a3450f853de9c71.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