Added level 1, base-level to abstract from, and level-controller

This commit is contained in:
Nathan Anderson
2022-08-05 17:15:17 -06:00
parent c95b9f9928
commit 77386f7af6
42 changed files with 985 additions and 531 deletions
-51
View File
@@ -1,51 +0,0 @@
extends Node2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var cloud1 = $Sprite
onready var cloud2 = $Sprite2
onready var cloud3 = $Sprite3
onready var cloud4 = $Sprite4
onready var topBorder = $TopBorder
onready var bottomBorder = $BottomBorder
onready var leftBorder = $LeftBorder
onready var rightBorder = $RightBorder
var clouds = []
var rng = RandomNumberGenerator.new()
var xSpeed = 0
# Called when the node enters the scene tree for the first time.
func _ready():
rng.randomize()
xSpeed = rng.randf_range(0.5,2)
clouds = [cloud1, cloud2, cloud3, cloud4]
_start_position()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
print(xSpeed)
for cloud in clouds:
if cloud.global_position.x + xSpeed < rightBorder.global_position.x:
cloud.global_position.x = cloud.global_position.x + xSpeed
else:
cloud.global_position.x = leftBorder.global_position.x
func _start_position():
rng.randomize()
for cloud in clouds:
var y = rng.randi_range(topBorder.global_position.y, bottomBorder.global_position.y)
var x = rng.randi_range(leftBorder.global_position.x, rightBorder.global_position.x)
cloud.global_position = Vector2(x, y)
+2
View File
@@ -243,4 +243,6 @@ scale = Vector2( 5, 5 )
tile_set = SubResource( 2 )
cell_size = Vector2( 16, 16 )
show_collision = true
collision_layer = 4
collision_mask = 0
format = 1
-47
View File
@@ -1,47 +0,0 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://assets/fonts/8-BIT WONDER.TTF" type="DynamicFontData" id=1]
[ext_resource path="res://scripts/UI.gd" type="Script" id=2]
[ext_resource path="res://assets/ui/music-enabled.png" type="Texture" id=3]
[sub_resource type="DynamicFont" id=1]
font_data = ExtResource( 1 )
[sub_resource type="Theme" id=2]
default_font = SubResource( 1 )
[node name="GUI" type="Node2D"]
script = ExtResource( 2 )
[node name="MarginContainer" type="MarginContainer" parent="."]
margin_left = 20.0
margin_top = 20.0
margin_right = 1279.0
margin_bottom = 257.0
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
margin_right = 1259.0
margin_bottom = 237.0
[node name="TimeLabel" type="RichTextLabel" parent="MarginContainer/HBoxContainer"]
margin_right = 1227.0
margin_bottom = 237.0
size_flags_horizontal = 3
size_flags_vertical = 3
theme = SubResource( 2 )
text = "Time fdsafdsafdsa"
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"]
margin_left = 1231.0
margin_right = 1259.0
margin_bottom = 237.0
[node name="ToolButton" type="ToolButton" parent="MarginContainer/HBoxContainer/VBoxContainer"]
margin_right = 28.0
margin_bottom = 24.0
toggle_mode = true
icon = ExtResource( 3 )
[node name="GameTimer" type="Timer" parent="."]
[connection signal="toggled" from="MarginContainer/HBoxContainer/VBoxContainer/ToolButton" to="." method="_on_ToolButton_toggled"]
+139
View File
@@ -0,0 +1,139 @@
[gd_scene load_steps=13 format=2]
[ext_resource path="res://Y2Mate.is - Won't You Be My Neighbor [8 Bit Tribute to Mr. Rogers] - 8 Bit Universe-8f3BEcQp1Q4-48k-1659646018463.mp3" type="AudioStream" id=1]
[ext_resource path="res://scenes/clouds.tscn" type="PackedScene" id=2]
[ext_resource path="res://scenes/TileMap.tscn" type="PackedScene" id=3]
[ext_resource path="res://scripts/base_level.gd" type="Script" id=4]
[ext_resource path="res://scenes/trolley.tscn" type="PackedScene" id=5]
[ext_resource path="res://scenes/player.tscn" type="PackedScene" id=6]
[ext_resource path="res://scenes/neighbor.tscn" type="PackedScene" id=7]
[ext_resource path="res://scenes/house.tscn" type="PackedScene" id=8]
[ext_resource path="res://assets/fonts/8-BIT WONDER.TTF" type="DynamicFontData" id=9]
[sub_resource type="DynamicFont" id=1]
size = 40
font_data = ExtResource( 9 )
[sub_resource type="DynamicFont" id=3]
size = 40
[sub_resource type="Theme" id=2]
default_font = SubResource( 3 )
RichTextLabel/fonts/normal_font = SubResource( 1 )
[node name="BaseLevel" type="Node2D"]
script = ExtResource( 4 )
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 1 )
pitch_scale = 0.75
[node name="TileMap" parent="." instance=ExtResource( 3 )]
collision_mask = 7
[node name="YSort" type="YSort" parent="."]
[node name="Player" parent="YSort" instance=ExtResource( 6 )]
position = Vector2( 619.221, 307.07 )
[node name="Trolley" parent="YSort" instance=ExtResource( 5 )]
position = Vector2( 629.977, 650.649 )
[node name="House1" parent="YSort" instance=ExtResource( 8 )]
position = Vector2( 1066, 540 )
[node name="Neighbor1" parent="YSort" instance=ExtResource( 7 )]
position = Vector2( 131, 429 )
[node name="Clouds" parent="." instance=ExtResource( 2 )]
position = Vector2( -0.17392, 0.152588 )
[node name="CameraBounds" type="Node2D" parent="."]
[node name="Left" type="Node2D" parent="CameraBounds"]
position = Vector2( -521, 432 )
[node name="Top" type="Node2D" parent="CameraBounds"]
position = Vector2( 594, -189 )
[node name="Right" type="Node2D" parent="CameraBounds"]
position = Vector2( 1757, 455 )
[node name="Bottom" type="Node2D" parent="CameraBounds"]
position = Vector2( 655, 1037 )
[node name="TrolleyLocations" type="Node2D" parent="."]
[node name="TrolleyStart" type="Node2D" parent="TrolleyLocations"]
position = Vector2( 72, 91 )
[node name="TrolleyEnd" type="Node2D" parent="TrolleyLocations"]
position = Vector2( 1258, 154 )
[node name="Panel" type="Panel" parent="."]
visible = false
margin_left = -2.0
margin_top = -6.0
margin_right = 1361.0
margin_bottom = 1054.0
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Control" type="Control" parent="Panel/VBoxContainer"]
margin_right = 1363.0
margin_bottom = 279.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="EndGameTitle" type="RichTextLabel" parent="Panel/VBoxContainer"]
margin_left = 181.0
margin_top = 283.0
margin_right = 1181.0
margin_bottom = 324.0
rect_min_size = Vector2( 1000, 0 )
size_flags_horizontal = 4
size_flags_vertical = 4
theme = SubResource( 2 )
text = "This is the text"
fit_content_height = true
[node name="Control3" type="Control" parent="Panel/VBoxContainer"]
margin_top = 328.0
margin_right = 1363.0
margin_bottom = 390.0
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_stretch_ratio = 0.22
[node name="EndGameBody" type="RichTextLabel" parent="Panel/VBoxContainer"]
margin_left = 181.0
margin_top = 394.0
margin_right = 1181.0
margin_bottom = 435.0
rect_min_size = Vector2( 1000, 0 )
size_flags_horizontal = 4
size_flags_vertical = 4
theme = SubResource( 2 )
text = "This is the text"
fit_content_height = true
[node name="Control2" type="Control" parent="Panel/VBoxContainer"]
margin_top = 439.0
margin_right = 1363.0
margin_bottom = 1060.0
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_stretch_ratio = 2.22
[node name="DisplayTimer" type="Timer" parent="."]
one_shot = true
autostart = true
[connection signal="left_wih_rogers" from="YSort/Trolley" to="." method="_on_Trolley_left_wih_rogers"]
[connection signal="rogers_entered_trolley" from="YSort/Trolley" to="." method="_on_Trolley_rogers_entered_trolley"]
[connection signal="rogers_left_trolley" from="YSort/Trolley" to="." method="_on_Trolley_rogers_left_trolley"]
[connection signal="timeout" from="DisplayTimer" to="." method="_on_DisplayTimer_timeout"]
+20
View File
@@ -0,0 +1,20 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scripts/Clouds.gd" type="Script" id=3]
[node name="Clouds" type="Node2D"]
position = Vector2( -2.43112, -0.845276 )
scale = Vector2( 10, 10 )
script = ExtResource( 3 )
[node name="RightBorder" type="Node2D" parent="."]
position = Vector2( 127.8, 47.0604 )
[node name="LeftBorder" type="Node2D" parent="."]
position = Vector2( 0.0503082, 46.0223 )
[node name="TopBorder" type="Node2D" parent="."]
position = Vector2( 62.236, 0.33577 )
[node name="BottomBorder" type="Node2D" parent="."]
position = Vector2( 61.0313, 94.858 )
+36
View File
@@ -0,0 +1,36 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://assets/fonts/8-BIT WONDER.TTF" type="DynamicFontData" id=1]
[sub_resource type="DynamicFont" id=1]
size = 30
font_data = ExtResource( 1 )
[sub_resource type="Theme" id=2]
RichTextLabel/fonts/normal_font = SubResource( 1 )
[node name="Panel" type="Panel"]
margin_left = -31.0
margin_top = -245.0
margin_right = 1332.0
margin_bottom = 815.0
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_right = 1299.0
margin_bottom = 992.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_right = 1299.0
margin_bottom = 992.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="RichTextLabel" type="RichTextLabel" parent="VBoxContainer/HBoxContainer"]
margin_right = 1299.0
margin_bottom = 992.0
size_flags_horizontal = 3
size_flags_vertical = 3
theme = SubResource( 2 )
text = "This is the text"
+99
View File
@@ -0,0 +1,99 @@
[gd_scene load_steps=12 format=2]
[ext_resource path="res://assets/ui/play.png" type="Texture" id=1]
[ext_resource path="res://scripts/UI.gd" type="Script" id=2]
[ext_resource path="res://assets/ui/music-enabled.png" type="Texture" id=3]
[ext_resource path="res://assets/fonts/ice_pixel-7.ttf" type="DynamicFontData" id=4]
[ext_resource path="res://assets/ui/pause.png" type="Texture" id=5]
[ext_resource path="res://assets/ui/pause-hover.png" type="Texture" id=6]
[ext_resource path="res://assets/ui/music-disabled.png" type="Texture" id=7]
[ext_resource path="res://assets/ui/music-hover.png" type="Texture" id=8]
[sub_resource type="DynamicFont" id=8]
size = 60
outline_size = 1
outline_color = Color( 0.203125, 0.203125, 0.203125, 1 )
use_mipmaps = true
font_data = ExtResource( 4 )
[sub_resource type="DynamicFont" id=1]
size = 45
font_data = ExtResource( 4 )
[sub_resource type="Theme" id=2]
default_font = SubResource( 1 )
RichTextLabel/fonts/normal_font = SubResource( 8 )
[node name="GUI" type="Node2D"]
script = ExtResource( 2 )
[node name="MarginContainer" type="MarginContainer" parent="."]
margin_left = 25.0
margin_top = 25.0
margin_right = 1255.0
margin_bottom = 100.0
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
margin_right = 1230.0
margin_bottom = 75.0
[node name="TimeLabel" type="RichTextLabel" parent="MarginContainer/HBoxContainer"]
margin_right = 305.0
margin_bottom = 75.0
size_flags_horizontal = 3
size_flags_vertical = 3
theme = SubResource( 2 )
text = "Time:"
[node name="NeighborLabel" type="RichTextLabel" parent="MarginContainer/HBoxContainer"]
margin_left = 309.0
margin_right = 920.0
margin_bottom = 75.0
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_stretch_ratio = 2.0
theme = SubResource( 2 )
text = "Neighbors Left: 6"
[node name="GridContainer" type="GridContainer" parent="MarginContainer/HBoxContainer"]
margin_left = 924.0
margin_right = 1230.0
margin_bottom = 75.0
size_flags_horizontal = 3
columns = 3
[node name="PauseButton" type="TextureButton" parent="MarginContainer/HBoxContainer/GridContainer"]
margin_right = 100.0
margin_bottom = 75.0
focus_mode = 1
size_flags_horizontal = 3
size_flags_vertical = 3
toggle_mode = true
texture_normal = ExtResource( 5 )
texture_pressed = ExtResource( 1 )
texture_hover = ExtResource( 6 )
expand = true
stretch_mode = 4
[node name="MusicButton" type="TextureButton" parent="MarginContainer/HBoxContainer/GridContainer"]
margin_left = 104.0
margin_right = 204.0
margin_bottom = 75.0
size_flags_horizontal = 3
toggle_mode = true
texture_normal = ExtResource( 3 )
texture_pressed = ExtResource( 7 )
texture_hover = ExtResource( 8 )
expand = true
stretch_mode = 4
[node name="GameTimer" type="Timer" parent="."]
one_shot = true
[connection signal="mouse_entered" from="MarginContainer/HBoxContainer/GridContainer/PauseButton" to="." method="_on_mouse_entered"]
[connection signal="mouse_exited" from="MarginContainer/HBoxContainer/GridContainer/PauseButton" to="." method="_on_mouse_exited"]
[connection signal="toggled" from="MarginContainer/HBoxContainer/GridContainer/PauseButton" to="." method="_on_PauseButton_toggled"]
[connection signal="mouse_entered" from="MarginContainer/HBoxContainer/GridContainer/MusicButton" to="." method="_on_mouse_entered"]
[connection signal="mouse_exited" from="MarginContainer/HBoxContainer/GridContainer/MusicButton" to="." method="_on_mouse_exited"]
[connection signal="toggled" from="MarginContainer/HBoxContainer/GridContainer/MusicButton" to="." method="_on_MusicButton_toggled"]
[connection signal="timeout" from="GameTimer" to="." method="_on_GameTimer_timeout"]
+101
View File
File diff suppressed because one or more lines are too long
+4 -330
View File
File diff suppressed because one or more lines are too long
+7
View File
@@ -0,0 +1,7 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/base_level.tscn" type="PackedScene" id=1]
[node name="Level1" type="Node2D"]
[node name="BaseLevel" parent="." instance=ExtResource( 1 )]
+11
View File
@@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scripts/level_controller.gd" type="Script" id=1]
[node name="Master" type="Node2D"]
script = ExtResource( 1 )
[node name="EndTimer" type="Timer" parent="."]
one_shot = true
[connection signal="timeout" from="EndTimer" to="." method="_on_EndTimer_timeout"]
+10 -10
View File
@@ -11,11 +11,7 @@
[ext_resource path="res://scripts/player.gd" type="Script" id=9]
[ext_resource path="res://assets/mrRogers.png" type="Texture" id=10]
[ext_resource path="res://assets/chevron_pointer.png" type="Texture" id=11]
[ext_resource path="res://scenes/UI.tscn" type="PackedScene" id=12]
[sub_resource type="CapsuleShape2D" id=2]
radius = 13.0
height = 10.0001
[ext_resource path="res://scenes/gui.tscn" type="PackedScene" id=12]
[sub_resource type="SpriteFrames" id=1]
animations = [ {
@@ -30,17 +26,16 @@ animations = [ {
"speed": 8.0
} ]
[sub_resource type="CapsuleShape2D" id=2]
radius = 13.0
height = 10.0001
[node name="Player" type="KinematicBody2D"]
collision_mask = 7
script = ExtResource( 9 )
ACCELERATION = 2000
FRICTION = 2500
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, 4 )
rotation = 1.5708
shape = SubResource( 2 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
position = Vector2( 2, -25 )
scale = Vector2( 5, 5 )
@@ -48,6 +43,11 @@ frames = SubResource( 1 )
animation = "idle"
playing = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, 4 )
rotation = 1.5708
shape = SubResource( 2 )
[node name="Camera2D" type="Camera2D" parent="."]
current = true
-80
View File
File diff suppressed because one or more lines are too long
+11 -2
View File
@@ -1,8 +1,11 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://assets/trolley-lg.png" type="Texture" id=1]
[ext_resource path="res://scripts/trolley.gd" type="Script" id=2]
[sub_resource type="CircleShape2D" id=4]
radius = 172.29
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 38, 10 )
@@ -13,6 +16,12 @@ extents = Vector2( 44.5, 8.25 )
collision_layer = 4
script = ExtResource( 2 )
[node name="TrolleySurroundingArea" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="TrolleySurroundingArea"]
position = Vector2( 0, -45 )
shape = SubResource( 4 )
[node name="TrolleySeatArea" type="Area2D" parent="."]
collision_layer = 0
@@ -34,5 +43,5 @@ polygon = PoolVector2Array( 172, -5, 198, 106, 150, 106, 122, 127, 74, 109, 46,
position = Vector2( 0, -2.25 )
shape = SubResource( 3 )
[connection signal="body_shape_exited" from="TrolleySurroundingArea" to="." method="_on_TrolleySurroundingArea_body_exited"]
[connection signal="body_entered" from="TrolleySeatArea" to="." method="_on_TrolleySeatArea_body_entered"]
[connection signal="body_exited" from="TrolleySeatArea" to="." method="_on_TrolleySeatArea_body_exited"]