-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f80a796
commit 7240d49
Showing
9 changed files
with
397 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class_name Biome | ||
extends Area2D | ||
|
||
@export var water_bg_color: Color | ||
@export var water_color: Color | ||
|
||
func _on_body_entered(body: Node2D) -> void: | ||
if body is Player: | ||
GameEvents.on_enter_new_biome.emit(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
extends Node | ||
|
||
signal add_debug_obj(key, value) | ||
signal add_message(message) | ||
signal add_debug_obj(key: String, value) | ||
signal add_message(message: String) | ||
signal on_enter_new_biome(biome: Biome) | ||
|
||
func add_message_emit(message): | ||
add_message.emit(message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
extends Polygon2D | ||
|
||
@export var default_biome: Biome | ||
@export var biome_transition_time: float = 1.0 | ||
@export var biome_transition_curve: Curve | ||
@onready var water_bg: Polygon2D = $WaterBG | ||
|
||
|
||
var current_biome: Biome | ||
var previous_water_color: Color | ||
var previous_water_bg_color: Color | ||
|
||
var count = 0.0 | ||
func _ready(): | ||
GameEvents.on_enter_new_biome.connect(on_enter_new_biome) | ||
color = default_biome.water_color | ||
water_bg.color = default_biome.water_bg_color | ||
current_biome = default_biome | ||
|
||
func on_enter_new_biome(new_biome: Biome): | ||
print(new_biome) | ||
if new_biome == current_biome: | ||
return | ||
count = biome_transition_time | ||
current_biome = new_biome | ||
previous_water_bg_color = water_bg.color | ||
previous_water_color = color | ||
|
||
|
||
func _process(delta: float) -> void: | ||
if count <= 0: | ||
return | ||
|
||
count -= delta | ||
var t = 1 - (count/biome_transition_time) | ||
var sample = biome_transition_curve.sample(t) | ||
color = lerp(previous_water_color, current_biome.water_color, sample) | ||
water_bg.color = lerp(previous_water_bg_color, current_biome.water_bg_color, sample) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://b1tw6cgdbe6r7"] | ||
|
||
[ext_resource type="Script" path="res://Biome.gd" id="1_nuv4q"] | ||
|
||
[node name="Biome" type="Area2D"] | ||
script = ExtResource("1_nuv4q") | ||
water_bg_color = Color(0.356863, 0.431373, 0.882353, 1) | ||
water_color = Color(0.262745, 0.317647, 0.768627, 0.501961) | ||
|
||
[connection signal="body_entered" from="." to="." method="_on_body_entered"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,227 @@ | ||
[gd_scene load_steps=11 format=3 uid="uid://c1e2254bs6m3e"] | ||
|
||
[ext_resource type="PackedScene" uid="uid://mnaxd41w2loc" path="res://player.tscn" id="1_rotku"] | ||
[ext_resource type="Script" path="res://Water.gd" id="2_imxiw"] | ||
[ext_resource type="PackedScene" uid="uid://cjiok5o0qam3w" path="res://ui.tscn" id="3_0cdyn"] | ||
[ext_resource type="Script" path="res://WaterArea.gd" id="3_58cow"] | ||
[ext_resource type="Script" path="res://Biome.gd" id="5_hobyo"] | ||
|
||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_sylxd"] | ||
|
||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_mb8yo"] | ||
size = Vector2(7897, 3751) | ||
|
||
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_t5me4"] | ||
size = Vector2(16, 16) | ||
|
||
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_mk1d2"] | ||
size = Vector2(80, 16) | ||
|
||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_as6lo"] | ||
size = Vector2(4246, 659) | ||
|
||
[node name="Main" type="Node2D"] | ||
|
||
[node name="UI" parent="." instance=ExtResource("3_0cdyn")] | ||
|
||
[node name="Water" type="Polygon2D" parent="."] | ||
modulate = Color(0.356863, 0.431373, 0.882353, 0.498039) | ||
z_index = 1 | ||
material = SubResource("ShaderMaterial_sylxd") | ||
polygon = PackedVector2Array(4050, 0, -2686, 0, -3110, 3000, 4967, 3000) | ||
script = ExtResource("2_imxiw") | ||
|
||
[node name="WaterBG" type="Polygon2D" parent="Water"] | ||
z_index = -1 | ||
material = SubResource("ShaderMaterial_sylxd") | ||
color = Color(0.356863, 0.431373, 0.882353, 1) | ||
polygon = PackedVector2Array(4050, 0, -2686, 0, -3110, 3000, 4967, 3000) | ||
|
||
[node name="Player" parent="." instance=ExtResource("1_rotku")] | ||
position = Vector2(-129, -48) | ||
|
||
[node name="WaterArea" type="Area2D" parent="."] | ||
gravity_space_override = 2 | ||
gravity_point_center = Vector2(0, 0) | ||
gravity_direction = Vector2(0, 0) | ||
linear_damp_space_override = 2 | ||
linear_damp = 0.5 | ||
script = ExtResource("3_58cow") | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="WaterArea"] | ||
position = Vector2(1978.5, 1882.5) | ||
shape = SubResource("RectangleShape2D_mb8yo") | ||
|
||
[node name="Placeholder Sprites" type="Node2D" parent="."] | ||
|
||
[node name="Sprite2D" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-234, 25) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D2" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-209, 72) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D3" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(2, 60) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D4" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-3, 12) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D5" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-285, 94) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D6" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-303, -1) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D7" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(183, 151) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D8" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(208, 198) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D9" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(419, 186) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D10" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(414, 138) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D11" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(132, 220) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D12" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(114, 125) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D13" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-51, 84) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D14" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-26, 131) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D15" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(185, 119) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D16" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(180, 71) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D17" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-102, 153) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D18" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-120, 58) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D19" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-522, 58) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D20" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-497, 105) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D21" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-286, 93) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D22" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-291, 45) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D23" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-573, 127) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D24" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-591, 32) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D25" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-348, 277) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D26" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-323, 324) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D27" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-112, 312) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D28" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-117, 264) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D29" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-399, 346) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="Sprite2D30" type="Sprite2D" parent="Placeholder Sprites"] | ||
position = Vector2(-417, 251) | ||
texture = SubResource("PlaceholderTexture2D_t5me4") | ||
|
||
[node name="StaticBody2D" type="StaticBody2D" parent="."] | ||
position = Vector2(-110, -8) | ||
|
||
[node name="Sprite2D" type="Sprite2D" parent="StaticBody2D"] | ||
texture = SubResource("PlaceholderTexture2D_mk1d2") | ||
|
||
[node name="Polygon2D" type="Polygon2D" parent="StaticBody2D"] | ||
color = Color(0.321569, 0.192157, 0, 1) | ||
polygon = PackedVector2Array(39, -8, 64, 11, 91, 47, 84, 77, 42, 79, -31, 57, -62, 95, -13, 233, -131, 779, -357, 968, -323, 1727, -908, 2114, -786, 5, -695, -463, -372, -460, -288, -73, -192, -2, -101, -8, -39, -8) | ||
|
||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="StaticBody2D"] | ||
visible = false | ||
polygon = PackedVector2Array(39, -8, 64, 11, 91, 47, 84, 77, 42, 79, -31, 57, -62, 95, -13, 233, -131, 779, -357, 968, -323, 1727, -908, 2114, -786, 5, -695, -463, -372, -460, -288, -73, -192, -2, -101, -8, -39, -8) | ||
|
||
[node name="StaticBody2D3" type="StaticBody2D" parent="."] | ||
position = Vector2(2240, 2) | ||
|
||
[node name="Sprite2D" type="Sprite2D" parent="StaticBody2D3"] | ||
texture = SubResource("PlaceholderTexture2D_mk1d2") | ||
|
||
[node name="Polygon2D" type="Polygon2D" parent="StaticBody2D3"] | ||
color = Color(0.321569, 0.192157, 0, 1) | ||
polygon = PackedVector2Array(-677, -104, -783, -1932, -1047, -1962, -1017, -112, -1387, 107, -1349, 560, -1047, 832, -919, 1157, -889, 1504, -972, 1814, -1221, 2108, -1160, 2350, -934, 2463, -405, 2342, 55, 2123, 86, 1610, -88, 1421, -315, 1270, -428, 968, -443, 628, -405, 432, -473, 130) | ||
|
||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="StaticBody2D3"] | ||
polygon = PackedVector2Array(-677, -104, -783, -1932, -1047, -1962, -1017, -112, -1387, 107, -1349, 560, -1047, 832, -919, 1157, -889, 1504, -972, 1814, -1221, 2108, -1160, 2350, -934, 2463, -405, 2342, 55, 2123, 86, 1610, -88, 1421, -315, 1270, -428, 968, -443, 628, -405, 432, -473, 130) | ||
|
||
[node name="StaticBody2D2" type="StaticBody2D" parent="."] | ||
position = Vector2(-1647, 2848) | ||
|
||
[node name="Sprite2D" type="Sprite2D" parent="StaticBody2D2"] | ||
texture = SubResource("PlaceholderTexture2D_mk1d2") | ||
|
||
[node name="Polygon2D" type="Polygon2D" parent="StaticBody2D2"] | ||
color = Color(0.321569, 0.192157, 0, 1) | ||
polygon = PackedVector2Array(808, -4029, 778, -238, 6109, -117, 5384, -2715, 6305, -5010, 10941, 170, 5928, 2662, -1246, 2435, -2484, -4436) | ||
|
||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="StaticBody2D2"] | ||
visible = false | ||
polygon = PackedVector2Array(808, -4029, 778, -238, 6109, -117, 5384, -2715, 6305, -5010, 10941, 170, 5928, 2662, -1246, 2435, -2484, -4436) | ||
|
||
[node name="NormalBiome" type="Area2D" parent="."] | ||
script = ExtResource("5_hobyo") | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="NormalBiome"] | ||
position = Vector2(1826, 329.5) | ||
shape = SubResource("RectangleShape2D_as6lo") | ||
debug_color = Color(0.666667, 0.933333, 1, 0.419608) | ||
|
||
[connection signal="body_entered" from="WaterArea" to="WaterArea" method="_on_body_entered"] | ||
[connection signal="body_exited" from="WaterArea" to="WaterArea" method="_on_body_exited"] |
Oops, something went wrong.