Skip to content

Commit

Permalink
Screen resized to 1440 x 920, associated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MylesScholz committed May 24, 2024
1 parent dc7ce84 commit 82ea5b1
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 34 deletions.
12 changes: 6 additions & 6 deletions cell_environment.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
[ext_resource type="PackedScene" uid="uid://htdfk532t5nd" path="res://nutrient_zone.tscn" id="1_5dxwq"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_4vorx"]
size = Vector2(200, 720)
size = Vector2(200, 920)

[sub_resource type="RectangleShape2D" id="RectangleShape2D_du2en"]
size = Vector2(1480, 200)
size = Vector2(1840, 200)

[node name="CellEnvironment" type="CellEnvironment"]
nutrient_zone_scene = ExtResource("1_5dxwq")
Expand All @@ -15,17 +15,17 @@ n_nutrient_zones = 3
[node name="ViewportBoundaries" type="StaticBody2D" parent="."]

[node name="LeftEdgeBoundary" type="CollisionShape2D" parent="ViewportBoundaries"]
position = Vector2(-100, 360)
position = Vector2(-100, 460)
shape = SubResource("RectangleShape2D_4vorx")

[node name="RightEdgeBoundary" type="CollisionShape2D" parent="ViewportBoundaries"]
position = Vector2(1180, 360)
position = Vector2(1540, 460)
shape = SubResource("RectangleShape2D_4vorx")

[node name="TopEdgeBoundary" type="CollisionShape2D" parent="ViewportBoundaries"]
position = Vector2(540, -100)
position = Vector2(720, -100)
shape = SubResource("RectangleShape2D_du2en")

[node name="BottomEdgeBoundary" type="CollisionShape2D" parent="ViewportBoundaries"]
position = Vector2(540, 820)
position = Vector2(720, 1020)
shape = SubResource("RectangleShape2D_du2en")
45 changes: 31 additions & 14 deletions cell_spawner.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,16 @@ corner_radius_bottom_right = 10
corner_radius_bottom_left = 10

[node name="CellSpawner" type="CellSpawner"]
num_cells = 10
num_cells = 20
cell_scene = ExtResource("1_dm1x8")

[node name="CellEnvironment" parent="." instance=ExtResource("2_g8x7p")]
n_nutrient_zones = 5

[node name="UI" type="CanvasLayer" parent="."]

[node name="ExtraPanel" type="VBoxContainer" parent="UI"]
visible = false
offset_left = 536.0
offset_top = 15.0
offset_right = 640.0
Expand Down Expand Up @@ -147,10 +149,17 @@ text = "\"C\" - Toggle Camera Tracking
[node name="MenuPanel" type="Panel" parent="UI"]
visible = false
z_index = 50
offset_left = 296.0
offset_top = 216.0
offset_right = 776.0
offset_bottom = 568.0
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -240.0
offset_top = -176.0
offset_right = 240.0
offset_bottom = 176.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("2_d86u0")
script = ExtResource("9_i2ah6")

Expand Down Expand Up @@ -444,7 +453,7 @@ theme = ExtResource("2_d86u0")
unique_name_in_owner = true
offset_left = 184.0
offset_right = 464.0
offset_bottom = 720.0
offset_bottom = 920.0
theme = ExtResource("2_d86u0")

[node name="Title" type="Label" parent="UI/BarPanel"]
Expand Down Expand Up @@ -518,7 +527,7 @@ script = ExtResource("6_cqljf")
[node name="NavBar" type="Panel" parent="UI"]
unique_name_in_owner = true
visible = false
offset_right = 1080.0
offset_right = 1440.0
offset_bottom = 80.0
theme = ExtResource("2_d86u0")
theme_type_variation = &"BarPanel"
Expand Down Expand Up @@ -582,11 +591,18 @@ offset_bottom = 40.0
mouse_default_cursor_shape = 2

[node name="SpeedControlPanel" type="Panel" parent="UI/NavBar"]
layout_mode = 0
offset_left = 856.0
offset_top = 16.0
offset_right = 1064.0
offset_bottom = 64.0
layout_mode = 1
anchors_preset = 6
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -224.0
offset_top = -24.0
offset_right = -16.0
offset_bottom = 24.0
grow_horizontal = 0
grow_vertical = 2
theme = ExtResource("2_d86u0")
theme_override_styles/panel = SubResource("StyleBoxFlat_itm0m")

Expand All @@ -596,6 +612,7 @@ offset_left = 162.0
offset_top = 12.0
offset_right = 196.0
offset_bottom = 35.0
text = "1x"
script = ExtResource("4_qih6h")

[node name="SpeedUpButton" type="TextureButton" parent="UI/NavBar/SpeedControlPanel"]
Expand Down Expand Up @@ -677,8 +694,8 @@ anchor_mode = 0
ignore_rotation = false
limit_left = 0
limit_top = 0
limit_right = 1080
limit_bottom = 720
limit_right = 1440
limit_bottom = 920
script = ExtResource("2_iwa60")

[connection signal="toggled" from="UI/MenuPanel/TabContainer/General/ExtraMenuCheck" to="UI/ExtraPanel" method="_on_check_button_2_toggled"]
Expand Down
3 changes: 2 additions & 1 deletion lineage_button.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ func _pressed():
ui_cam.clear_selection()
if target_cell and not luca_targeted:
lineage_camera.select_cell(target_cell)
ui_cam.on_cell_select(target_cell)
if target_cell.get_node("CellState").get_alive():
ui_cam.on_cell_select(target_cell)

# Called when the node enters the scene tree for the first time.
func _ready():
Expand Down
4 changes: 1 addition & 3 deletions nutrient_zone.tscn
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
[gd_scene load_steps=3 format=3 uid="uid://htdfk532t5nd"]

[ext_resource type="Texture2D" uid="uid://q37a7gray3ag" path="res://NutrientZone.png" id="1_dkqov"]
[ext_resource type="Texture2D" uid="uid://q37a7gray3ag" path="res://sprites/NutrientZone/NutrientZone.png" id="1_dkqov"]

[sub_resource type="CircleShape2D" id="CircleShape2D_4wa2l"]
radius = 200.0

[node name="NutrientZone" type="NutrientZone"]

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(540, 360)
shape = SubResource("CircleShape2D_4wa2l")

[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(540, 360)
scale = Vector2(0.308, 0.308)
texture = ExtResource("1_dkqov")
4 changes: 2 additions & 2 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ GlobalVariables="*res://GlobalVariables.gd"

[display]

window/size/viewport_width=1080
window/size/viewport_height=720
window/size/viewport_width=1440
window/size/viewport_height=920
window/size/resizable=false
window/vsync/vsync_mode=0

Expand Down
10 changes: 3 additions & 7 deletions src/cell_environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ void CellEnvironment::spawnNutrientZone() {

// Set the NutrientZone's position randomly in the viewport
nutrientZone->set_position(Vector2(
rand.randi_range(-viewportSize.x / 2, viewportSize.x / 2),
rand.randi_range(-viewportSize.y / 2, viewportSize.y / 2)));
rand.randi_range(0, viewportSize.x),
rand.randi_range(0, viewportSize.y)));

// Add the NutrientZone as a child of this node
this->add_child(nutrientZone);
Expand Down Expand Up @@ -117,15 +117,11 @@ void CellEnvironment::_on_cell_death(Cell *cell) {
// Instantiate the NutrientZone scene and cast it to a NutrientZone
NutrientZone *nutrientZone = Object::cast_to<NutrientZone>(_nutrientZoneScene->instantiate());

// Get viewport size for positioning
Size2 viewportSize = get_viewport()->get_visible_rect().size;

// Apply a scaling to the NutrientZone approximately proportional to the dead cell
nutrientZone->applyScale(cell->getScale() / 4);

// Set the NutrientZone's position in the same position as the dead cell
Vector2 nutrientZonePosition = Vector2(cellPosition.x - viewportSize.x / 2, cellPosition.y - viewportSize.y / 2);
nutrientZone->set_position(nutrientZonePosition);
nutrientZone->set_position(cellPosition);

// Set the NutrientZone to delete itself when it runs out of nutrients
nutrientZone->setDeleteOnEmpty(true);
Expand Down
2 changes: 1 addition & 1 deletion src/lineage_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LineageGraph::LineageGraph() {
// Number of columns of Cells in the storage area
_nColumns = 5;
// Storage basis vector; the top left position of the storage area; just to the right of the CellEnvironment
_storageBasis = Vector2(1400, 0);
_storageBasis = Vector2(2000, 0);
// Spacing between Cells in the storage area
_storageSpacing = 200;
_vertices = Vector<LineageGraphVertex *>();
Expand Down

0 comments on commit 82ea5b1

Please sign in to comment.