Skip to content

Commit

Permalink
added emergency camera limit disable option
Browse files Browse the repository at this point in the history
  • Loading branch information
GTcreyon committed Apr 10, 2022
1 parent 07675e0 commit 5b4ecba
Show file tree
Hide file tree
Showing 11 changed files with 1,240 additions and 1,107 deletions.
23 changes: 23 additions & 0 deletions actors/camera_area/camera_area.gd
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,29 @@ func _physics_process(dt):
if target_size.length() != window_prev_length:
set_hitbox_extends(target_size)

window_prev_length = target_size.length()
body_collision.polygon = PoolVector2Array([
Vector2(0, -target_size.y / 2),
Vector2(target_size.x / 2, 0),
Vector2(0, target_size.y / 2),
Vector2(-target_size.x / 2, 0)
])

#emergency workaround
if Singleton.disable_limits:
body_collision.polygon = PoolVector2Array([
Vector2.ZERO,
])
elif body_collision.polygon == PoolVector2Array([
Vector2.ZERO,
]):
body_collision.polygon = PoolVector2Array([
Vector2(0, -target_size.y / 2),
Vector2(target_size.x / 2, 0),
Vector2(0, target_size.y / 2),
Vector2(-target_size.x / 2, 0)
])

#update the camera position and stuff
var target = player.position
body.move_and_slide(((target - body.position) / dt))
Expand Down
24 changes: 1 addition & 23 deletions actors/debug/tickbox.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=8 format=2]

[ext_resource path="res://actors/debug/tickbox.png" type="Texture" id=1]
[ext_resource path="res://actors/debug/tickbox.gd" type="Script" id=2]
[ext_resource path="res://fonts/bylight/bylightv2.tres" type="DynamicFont" id=3]

[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
Expand All @@ -27,28 +26,10 @@ animations = [ {
[sub_resource type="StyleBoxEmpty" id=6]

[node name="Tickbox" type="Control"]
margin_right = 40.0
margin_bottom = 40.0
mouse_filter = 2
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Label" type="Label" parent="."]
margin_left = -81.0
margin_top = 20.0
margin_right = 81.0
margin_bottom = 35.0
custom_fonts/font = ExtResource( 3 )
text = "Lag"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Sprite" type="AnimatedSprite" parent="."]
position = Vector2( 0, 10 )
frames = SubResource( 5 )

[node name="Button" type="Button" parent="Sprite"]
Expand All @@ -62,8 +43,5 @@ custom_styles/pressed = SubResource( 6 )
custom_styles/focus = SubResource( 6 )
custom_styles/disabled = SubResource( 6 )
custom_styles/normal = SubResource( 6 )
__meta__ = {
"_edit_use_anchors_": false
}

[connection signal="pressed" from="Sprite/Button" to="." method="_on_Button_pressed"]
69 changes: 69 additions & 0 deletions actors/debug/tickbox_feedback.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[gd_scene load_steps=9 format=2]

[ext_resource path="res://actors/debug/tickbox.png" type="Texture" id=1]
[ext_resource path="res://actors/debug/tickbox.gd" type="Script" id=2]
[ext_resource path="res://fonts/bylight/bylightv2.tres" type="DynamicFont" id=3]

[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 20, 20 )

[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 1 )
region = Rect2( 0, 40, 20, 20 )

[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 1 )
region = Rect2( 0, 60, 20, 20 )

[sub_resource type="SpriteFrames" id=5]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 3 ), SubResource( 4 ) ],
"loop": false,
"name": "default",
"speed": 16.0
} ]

[sub_resource type="StyleBoxEmpty" id=6]

[node name="Tickbox" type="Control"]
margin_right = 40.0
margin_bottom = 40.0
mouse_filter = 2
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Label" type="Label" parent="."]
margin_left = -81.0
margin_top = 20.0
margin_right = 81.0
margin_bottom = 35.0
custom_fonts/font = ExtResource( 3 )
text = "Lag"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Sprite" type="AnimatedSprite" parent="."]
position = Vector2( 0, 10 )
frames = SubResource( 5 )

[node name="Button" type="Button" parent="Sprite"]
margin_left = -10.0
margin_top = -10.0
margin_right = 10.0
margin_bottom = 10.0
mouse_default_cursor_shape = 2
custom_styles/hover = SubResource( 6 )
custom_styles/pressed = SubResource( 6 )
custom_styles/focus = SubResource( 6 )
custom_styles/disabled = SubResource( 6 )
custom_styles/normal = SubResource( 6 )
__meta__ = {
"_edit_use_anchors_": false
}

[connection signal="pressed" from="Sprite/Button" to="." method="_on_Button_pressed"]
Loading

0 comments on commit 5b4ecba

Please sign in to comment.