summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrom <romangraef@gmail.com>2021-04-26 21:22:40 +0200
committerrom <romangraef@gmail.com>2021-04-26 21:22:40 +0200
commit85da9f59bad9ae98e61820f9feaff0dd5968228f (patch)
tree631efd240081991b859e997538196d9e3e425329
parent52f19ebb7a2804a7807471502a073f157483398a (diff)
downloadldjam48-85da9f59bad9ae98e61820f9feaff0dd5968228f.tar.gz
ldjam48-85da9f59bad9ae98e61820f9feaff0dd5968228f.tar.bz2
ldjam48-85da9f59bad9ae98e61820f9feaff0dd5968228f.zip
loop
-rw-r--r--scenes/levels/base_level.gd10
-rw-r--r--scenes/levels/base_level.tscn2
2 files changed, 9 insertions, 3 deletions
diff --git a/scenes/levels/base_level.gd b/scenes/levels/base_level.gd
index 3c52029..e7db980 100644
--- a/scenes/levels/base_level.gd
+++ b/scenes/levels/base_level.gd
@@ -28,14 +28,18 @@ func _ready():
func _get_next_level_pos() -> Vector2:
var dir = (randi() % 2) * 2 -1
- return _last_camera_location + Vector2(1000, dir * (1000 + randi() % 1000))
+ return _last_camera_location + Vector2(1000, dir * (1024 + randi() % 1024))
func _create_path_from(from: Vector2, to: Vector2):
var path = Path2D.new()
var curve = Curve2D.new()
- var diff = to -from
+ var diff = to - from
+ var extra_x = randf() * 400 + 100
+ var extra_y = (randf() * 400 + 100) * ((randi() % 2) * 2 - 1)
curve.add_point(from)
- curve.add_point(from + Vector2(diff.x, 0))
+ curve.add_point(from + Vector2(diff.x + extra_x, 0))
+ curve.add_point(from + Vector2(diff.x + extra_x, extra_y))
+ curve.add_point(from + Vector2(diff.x, extra_y))
curve.add_point(to)
path.curve = curve
return path
diff --git a/scenes/levels/base_level.tscn b/scenes/levels/base_level.tscn
index 6681a7d..c13cdaa 100644
--- a/scenes/levels/base_level.tscn
+++ b/scenes/levels/base_level.tscn
@@ -24,6 +24,7 @@ __meta__ = {
position = Vector2( 153.457, 427.259 )
current = true
script = ExtResource( 7 )
+speedup_time = 10
[node name="healthbar" parent="Camera2D" instance=ExtResource( 3 )]
position = Vector2( -595.377, -321.363 )
@@ -41,6 +42,7 @@ position = Vector2( 571.642, -311.599 )
text = "Menu"
[node name="PauseMenu" parent="Camera2D" instance=ExtResource( 5 )]
+
[connection signal="done" from="Camera2D" to="." method="_on_Camera2D_done"]
[connection signal="on_click" from="Camera2D/MenuButton" to="." method="_on_MenuButton_on_click"]
[connection signal="unpause" from="Camera2D/PauseMenu" to="." method="_on_PauseMenu_unpause"]