Compare commits

...

14 Commits

Author SHA1 Message Date
James
6ac70e6a75 kinda usable but not perfect 2024-01-15 19:15:50 +00:00
James
706590e3dd getting close with android inutr 2024-01-15 18:04:33 +00:00
James
fec645d6b3 fix 2023-12-28 19:51:01 +00:00
James
4a11cc42e4 refactor UI 2023-12-28 19:47:27 +00:00
James
3943a1eff2 refactor 2023-12-28 17:21:25 +00:00
James
87542751e4 optimise 2023-12-28 15:58:40 +00:00
James
a9dcb4b850 macbook 2023-12-28 12:10:07 +00:00
James
b86369c359 debug 2023-12-28 12:01:29 +00:00
James
0db01b0978 mac inputs 2023-12-28 11:46:02 +00:00
James
60ca7e6ca8 fixes, maps 2023-12-28 11:23:03 +00:00
James
15b4c5d320 stats and better collision dropping dev, interface 2023-12-27 20:17:09 +00:00
James
006e83d5bf alpha12 2023-12-24 14:11:06 +00:00
James
584b674cc1 conf 2023-12-15 16:14:11 +00:00
James
08561d1a39 fix player spawn+circle 2023-12-13 20:17:12 +00:00
20 changed files with 8357 additions and 305 deletions

View File

@ -2,16 +2,26 @@ extends Camera2D
var last_mouse_position = Vector2.ZERO
var touch_start_positions = {}
var last_zoom_distance = -1
var last_zoom_center = Vector2.ZERO
func _ready():
set_process_input(true)
func _input(event):
print(event.as_text())
handle_mouse_events(event)
handle_touch_events(event)
func handle_mouse_events(event):
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_MIDDLE and event.pressed:
if event.button_index == MOUSE_BUTTON_RIGHT and event.pressed:
last_mouse_position = get_global_mouse_position()
elif event.button_index == MOUSE_BUTTON_MIDDLE and not event.pressed:
elif event.button_index == MOUSE_BUTTON_RIGHT and not event.pressed:
last_mouse_position = Vector2.ZERO
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN and event.pressed:
elif event.button_index == MOUSE_BUTTON_WHEEL_DOWN and event.pressed:
zoom_towards_mouse(Vector2(0.9, 0.9))
elif event.button_index == MOUSE_BUTTON_WHEEL_UP and event.pressed:
zoom_towards_mouse(Vector2(1.1, 1.1))
@ -23,8 +33,45 @@ func _input(event):
position -= drag_offset
last_mouse_position = get_global_mouse_position()
# Macbook touchpad
elif event is InputEventPanGesture:
position+=event.delta
elif event is InputEventMagnifyGesture:
zoom_towards_mouse(Vector2(event.factor,event.factor))
func zoom_towards_mouse(zoom_factor):
var previous_mouse_position := get_local_mouse_position()
zoom *= zoom_factor
var diff = previous_mouse_position - get_local_mouse_position()
position += diff
func handle_touch_events(event):
if event is InputEventScreenTouch:
if event.pressed:
touch_start_positions[event.index] = event.position
if event.index==0:
$"../Touch1Sprite".position=event.position
if event.index==1:
$"../Touch2Sprite".position=event.position
if len(touch_start_positions) == 2:
last_zoom_distance = touch_start_positions[0].distance_to(touch_start_positions[1])
last_zoom_center = (touch_start_positions[0] + touch_start_positions[1]) / 2.0
else:
touch_start_positions.erase(event.index)
last_zoom_distance = -1
last_zoom_center = Vector2.ZERO
elif event is InputEventScreenDrag:
if event.index in touch_start_positions:
touch_start_positions[event.index] = event.position
if len(touch_start_positions) == 2:
var new_zoom_center = (touch_start_positions[0] + touch_start_positions[1]) / 2.0
var new_zoom_distance = touch_start_positions[0].distance_to(touch_start_positions[1])
if last_zoom_distance > 0:
var zoom_factor = last_zoom_distance / new_zoom_distance
zoom/=zoom_factor
position -= (new_zoom_center - last_zoom_center) / zoom
last_zoom_distance = new_zoom_distance
last_zoom_center = new_zoom_center

37
HUD.gd
View File

@ -1,37 +0,0 @@
extends PanelContainer
var elapsed_time = 0.0 # Initialize a variable to keep track of elapsed time
# Called when the node enters the scene tree for the first time.
func _ready():
var popup_menu = $HBoxContainer/Right/File.get_popup()
popup_menu.connect("id_pressed", self._on_PopupMenu_id_pressed)
func _on_PopupMenu_id_pressed(id):
match id:
0:
$"../NewDialog".popup_centered()
1:
$"../LoadDialog".popup_centered()
2:
$"../SaveDialog".popup_centered()
4:
$"../SettingsWindow".popup_centered()
func _process(delta):
elapsed_time += delta # Increment the elapsed time by the frame's delta time
var hours = int(elapsed_time / 3600)
var minutes = int(elapsed_time / 60) % 60
var seconds = int(elapsed_time) % 60
var time_string = "%02d:%02d:%02d" % [hours, minutes, seconds] # Format time as H:M:S
var fps = Engine.get_frames_per_second() # Get the current FPS
$HBoxContainer/Debug.text = time_string+" "+str(fps) + " fps" # Combine FPS and runtime into one string
if %Map.controlling and is_instance_valid(%Map.controlling):
$HBoxContainer/Debug.text += " [H:"+str(%Map.controlling.health)+"]"
func _on_settings_window_close_requested():
print("close")
$"../SettingsWindow".hide()
func _on_control_stop_button_pressed():
%Map.controlling=null

View File

@ -29,5 +29,5 @@ func _on_confirmed():
$"../SaveDialog/LineEdit".text=$ItemList.get_item_text(item)
var filename = "user://saves/" + $ItemList.get_item_text(item)
print("load:", filename)
get_tree().root.get_node("Sim/Map").load_map(filename)
%Map.load_map(filename)
break

93
Map.gd
View File

@ -21,26 +21,30 @@ func _unhandled_input(event):
func spawn(pos,vol):
var tool=$"../ScreenOverlay/HUD/HBoxContainer/ToolSelect".get_selected()
var tool=%ToolSelect.get_selected()
if tool.name=="Create Player":
spawn_player(pos,vol)
if tool.name=="Create Pool":
var r=int(tool.get_node("Red").text)
var g=int(tool.get_node("Green").text)
var b=int(tool.get_node("Blue").text)
var r=int(tool.get_node("Red/val").text)
var g=int(tool.get_node("Green/val").text)
var b=int(tool.get_node("Blue/val").text)
if r+g+b>0:
spawm_pool(pos,r,g,b)
if tool.name=="Paste":
var filename="user://saves/"+tool.get_item_text(tool.get_selected_id())
get_tree().root.get_node("Sim/Map").paste_map(filename,pos)
if tool.name=="Create Pool Circle":
var r=int(tool.get_node("Red").text)
var g=int(tool.get_node("Green").text)
var b=int(tool.get_node("Blue").text)
var rad=int(tool.get_node("Radius").text)
var cnt=int(tool.get_node("Count").text)
var r=int(tool.get_node("Red/val").text)
var g=int(tool.get_node("Green/val").text)
var b=int(tool.get_node("Blue/val").text)
var rad=int(tool.get_node("Radius/val").text)
var cnt=int(tool.get_node("Count/val").text)
if r+g+b>0:
spawn_pool_circle(pos,rad,cnt,r,g,b)
if tool.name=="Create Player Circle":
var rad=int(tool.get_node("Radius/val").text)
var cnt=int(tool.get_node("Count/val").text)
spawn_player_circle(pos,rad,cnt)
if tool.name=="Delete":
var space_state = get_world_2d().direct_space_state
var query_params = PhysicsPointQueryParameters2D.new()
@ -62,6 +66,29 @@ func spawn(pos,vol):
min_distance = distance
closest_node = node
controlling=closest_node
if tool.name=="Impulse":
if tool.get_node("Type").selected==0: # linear
for node in %Map.get_children():
if node is Player:
var direction = vol.normalized()
var distance = pos.distance_to(node.position)
var dropOff = int(tool.get_node("Attenuation/val").text)
var power = int(tool.get_node("Power/val").text)
var magnitude = power * vol.length()
if dropOff:
magnitude/= distance * dropOff
node.apply_impulse(direction * magnitude)
if tool.get_node("Type").selected==1: # radial
for node in %Map.get_children():
if node is Player:
var direction = pos.direction_to(node.position)
var distance = pos.distance_to(node.position)
var dropOff = int(tool.get_node("DropOff").text)
var power = int(tool.get_node("Power").text)
var magnitude = power * vol.length()
if dropOff:
magnitude/= distance * dropOff
node.apply_impulse(direction * magnitude)
func spawm_pool(pos,red,green,blue):
var new_pool: Pool = load("res://pool.tscn").instantiate()
@ -69,45 +96,13 @@ func spawm_pool(pos,red,green,blue):
new_pool.mana_r=red
new_pool.mana_g=green
new_pool.mana_b=blue
new_pool.get_node("CollisionShape2D2").disabled=true;
#new_pool.get_node("StaticBody2D/CollisionShape2D2").set_deferred("disabled", true)
get_tree().root.get_node("Sim/Map").call_deferred("add_child",new_pool)
func spawn_player(pos,vol):
var new_player = load("res://player.tscn").instantiate()
new_player.position = pos
new_player.apply_impulse(vol)
# Prepare the shape query parameters
var query_parameters = PhysicsShapeQueryParameters2D.new()
var collision_shape = new_player.get_node("CollisionShape2D").shape
query_parameters.set_shape(collision_shape)
query_parameters.set_transform(Transform2D(0, pos))
query_parameters.set_collision_mask(1)
# Get the Physics2DDirectSpaceState for collision checking
var space_state = get_world_2d().direct_space_state
# Check for collision
var collision_results = space_state.intersect_shape(query_parameters)
if collision_results.size() == 0:
# No collision, safe to add child
add_child(new_player)
else:
for collision in collision_results:
#print
if collision.collider.get_parent() is Pool:
new_player.queue_free()
collision.collider.get_parent()._on_decay_timer_timeout()
return
var marker = Sprite2D.new()
marker.position = new_player.position
marker.scale=Vector2(0.1,0.1)
marker.texture = load("res://images/crosshair.png")
add_child(marker)
new_player.queue_free()
func spawn_pool_circle(pos: Vector2, radius, count, r,g,b):
for n in range(1,count+1):
@ -117,9 +112,17 @@ func spawn_pool_circle(pos: Vector2, radius, count, r,g,b):
new_pool.mana_r=r
new_pool.mana_g=g
new_pool.mana_b=b
new_pool.get_node("CollisionShape2D2").disabled=true;
#new_pool.get_node("CollisionShape2D2").disabled=true;
add_child(new_pool)
func spawn_player_circle(pos: Vector2, radius, count):
for n in range(1,count+1):
var new_player: Player = load("res://player.tscn").instantiate()
var t=(float(n)/count)*3.141*2
new_player.position = pos + (Vector2(sin(t),cos(t))*radius)
#new_player.get_node("CollisionShape2D2").disabled=true;
add_child(new_player)
func paste_map(filename,offset):
print("paste:", filename)
if not FileAccess.file_exists(filename):
@ -159,8 +162,11 @@ func load_map(filename):
return # Error! We don't have a save to load.
# deleting saveable objects.
var save_nodes = get_tree().get_nodes_in_group("Persist")
var save_nodes = get_tree().root.get_node("Sim/Map").get_children()
for i in save_nodes:
if i is Player or i is Pool:
i.collision_layer = 0
i.collision_mask = 0
i.queue_free()
# Load the file line by line and process
@ -191,6 +197,7 @@ func load_map(filename):
add_child(new_object)
func _on_new_dialog_confirmed():
await get_tree().process_frame
var save_nodes = get_tree().get_nodes_in_group("Persist")
for i in save_nodes:
i.queue_free()

View File

@ -2,6 +2,7 @@ class_name Player
extends RigidBody2D
var health=60
var can_pickup=true
func _integrate_forces(state: PhysicsDirectBodyState2D):
var contact_count = state.get_contact_count()
@ -13,6 +14,8 @@ func _integrate_forces(state: PhysicsDirectBodyState2D):
handle_pool_collision(collider_object)
func handle_player_collision(player: Player):
if not get_tree().root.get_node("Sim/ScreenOverlay/SettingsWindow/VBoxContainer/DropOnColl").is_pressed():
return
if is_carrying() and player.is_carrying():
doubledrop(player)
drop()
@ -26,21 +29,6 @@ var carrying_g=0
var carrying_b=0
func _process(_delta):
if $CollisionShape2D.disabled:
# Prepare the shape query parameters
var query_parameters = PhysicsShapeQueryParameters2D.new()
var collision_shape = $CollisionShape2D.shape
query_parameters.set_shape(collision_shape)
query_parameters.set_transform(Transform2D(0, position))
query_parameters.set_collision_mask(2) #2=pools
# Get the Physics2DDirectSpaceState for collision checking
var space_state = get_world_2d().direct_space_state
# Check for collision
var collision_results = space_state.intersect_shape(query_parameters)
if collision_results.size() == 0:
$CollisionShape2D.disabled=false
var controlling=get_tree().root.get_node("Sim/Map").controlling
if controlling and is_instance_valid(controlling) and controlling==self:
@ -58,14 +46,14 @@ func drop():
if not is_carrying():
return
var new_pool: Pool = load("res://pool.tscn").instantiate()
new_pool.position = position
new_pool.position = position-(linear_velocity.normalized()*15)
new_pool.mana_r=carrying_r
new_pool.mana_g=carrying_g
new_pool.mana_b=carrying_b
new_pool.get_node("CollisionShape2D2").disabled=true;
carrying_r=0
carrying_g=0
carrying_b=0
$PickupTimer.start()
get_tree().root.get_node("Sim/Map").call_deferred("add_child",new_pool)
update()
@ -77,18 +65,30 @@ func doubledrop(player: Player):
new_pool.mana_r=carrying_r+player.carrying_r
new_pool.mana_g=carrying_g+player.carrying_g
new_pool.mana_b=carrying_b+player.carrying_b
new_pool.get_node("CollisionShape2D2").disabled=true;
carrying_r=0
carrying_g=0
carrying_b=0
player.carrying_r=0
player.carrying_g=0
player.carrying_b=0
can_pickup=false
$PickupTimer.start()
player.can_pickup=false
player.get_node("PickupTimer").start()
get_tree().root.get_node("Sim/Map").call_deferred("add_child",new_pool)
update()
player.update()
func _on_Timer_timeout():
# This function will be called after 5 seconds
print("Timer finished!")
func exchange_with(pool: Pool):
if ! can_pickup:
return
if is_carrying():
pool.mana_r+=carrying_r
pool.mana_g+=carrying_g
@ -107,6 +107,8 @@ func exchange_with(pool: Pool):
elif pool.mana_b>0:
pool.mana_b -= 1
carrying_b=1
can_pickup=false
$PickupTimer.start()
update()
func update():
@ -143,6 +145,7 @@ func load_data(data):
carrying_r=data["r"]
carrying_g=data["g"]
carrying_b=data["b"]
update()
func _on_health_timer_timeout():
if not get_tree().root.get_node("Sim/ScreenOverlay/SettingsWindow/VBoxContainer/Health").is_pressed():
@ -155,3 +158,7 @@ func _on_health_timer_timeout():
if(health<1):
self.queue_free()
func _on_pickup_timer_timeout():
can_pickup=true

54
Pool.gd
View File

@ -29,6 +29,59 @@ func _process(_delta):
$CollisionShape2D2.disabled=false
update()
func pool_coll_check():
var query_parameters = PhysicsShapeQueryParameters2D.new()
var collision_shape = $CollisionShape2D2.shape
query_parameters.set_shape(collision_shape)
query_parameters.set_transform(Transform2D(0, scale, 0, position))
query_parameters.set_collision_mask(2) #2=pools
# Get the Physics2DDirectSpaceState for collision checking
var space_state = get_world_2d().direct_space_state
# Check for collision
var collision_results = space_state.intersect_shape(query_parameters)
for result in collision_results:
if result.collider is Pool and result.collider != self:
if is_fully_overlapping(self, result.collider):
merge_with(result.collider)
func is_fully_overlapping(pool1, pool2):
var radius1 = pool1.scale[0]*pool1.get_node("CollisionShape2D2").scale[0]*pool1.get_node("CollisionShape2D2").shape.radius
var radius2 = pool2.scale[0]*pool2.get_node("CollisionShape2D2").scale[0]*pool1.get_node("CollisionShape2D2").shape.radius
var center_distance = pool1.position.distance_to(pool2.position)
# Check if one circle is completely inside the other
return center_distance <= abs(radius1 - radius2)
func merge_with(p: Pool):
# Calculate RGB sums for both pools
var sum_rgb_self = mana_r + mana_g + mana_b
var sum_rgb_other = p.mana_r + p.mana_g + p.mana_b
# Avoid division by zero
var total_sum = sum_rgb_self + sum_rgb_other
if total_sum == 0:
return
# Calculate weighted positions
var weighted_position_self = position * sum_rgb_self
var weighted_position_other = p.position * sum_rgb_other
# Compute new position as weighted average
position = (weighted_position_self + weighted_position_other) / total_sum
# Merge mana values
mana_r += p.mana_r
mana_g += p.mana_g
mana_b += p.mana_b
p.mana_r = 0
p.mana_g = 0
p.mana_b = 0
#update()
#p.update()
func update():
var max_value: float = max(mana_r, mana_g, mana_b)
if max_value==0:
@ -42,6 +95,7 @@ func update():
var s=sqrt((mana_r+mana_g+mana_b)/1000.0)
self.scale=Vector2(s,s)
self.queue_redraw() # Request to redraw the node
pool_coll_check()
func decay():
var new_player = load("res://player.tscn").instantiate()

52
StatsWindow.gd Normal file
View File

@ -0,0 +1,52 @@
extends Window
var elapsed_time = 0.0 # Initialize a variable to keep track of elapsed time
var time_text=""
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
elapsed_time += delta # Increment the elapsed time by the frame's delta time
var hours = int(elapsed_time / 3600)
var minutes = int(elapsed_time / 60) % 60
var seconds = int(elapsed_time) % 60
var time_string = "%02d:%02d:%02d" % [hours, minutes, seconds] # Format time as H:M:S
var fps = Engine.get_frames_per_second() # Get the current FPS
time_text = time_string+" "+str(fps) + " fps" # Combine FPS and runtime into one string
if %Map.controlling and is_instance_valid(%Map.controlling):
time_text += " [H:"+str(%Map.controlling.health)+"]"
func _on_timer_timeout():
var pl=0
var po=0
var rpl=0
var gpl=0
var bpl=0
var rpo=0
var gpo=0
var bpo=0
for node in %Map.get_children():
if node is Player:
pl+=1
rpl+=node.carrying_r
gpl+=node.carrying_g
bpl+=node.carrying_b
if node is Pool:
po+=1
rpo+=node.mana_r
gpo+=node.mana_g
bpo+=node.mana_b
$Label.text=\
time_text + "\n" +\
"Players: "+str(pl)+"\n"+ \
"Pools: "+str(po)+"\n"+ \
"R: "+str(rpo+rpl)+" ("+str(rpo)+"+"+str(rpl)+")\n"+\
"G: "+str(gpo+gpl)+" ("+str(gpo)+"+"+str(gpl)+")\n"+\
"B: "+str(bpo+bpl)+" ("+str(bpo)+"+"+str(bpl)+")\n"
func _on_close_requested():
hide()

View File

@ -6,9 +6,9 @@ runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
include_filter="saves/*"
exclude_filter=""
export_path="bin/alpha11.apk"
export_path="../../cloud@jhodges/alpha110.apk"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
@ -30,7 +30,7 @@ version/code=1
version/name="1.0"
package/unique_name="uk.co.jhodges.jhrgb"
package/name=""
package/signed=false
package/signed=true
package/app_category=2
package/retain_data_on_uninstall=false
package/exclude_from_recents=false
@ -211,9 +211,9 @@ runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
include_filter="saves/*"
exclude_filter=""
export_path="bin/alpha11.x86_64"
export_path="bin/alpha12.x86_64"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
@ -251,9 +251,9 @@ runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
include_filter="saves/*"
exclude_filter=""
export_path="bin/alpha11_macos.zip"
export_path="bin/alpha12_macos.zip"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
@ -347,3 +347,66 @@ open \"{temp_dir}/{exe_name}.app\" --args {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name}.app/Contents/MacOS/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""
[preset.3]
name="Windows Desktop"
platform="Windows Desktop"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter="saves/*"
exclude_filter=""
export_path="bin/alpha11.exe"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
[preset.3.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=true
texture_format/bptc=true
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
binary_format/architecture="x86_64"
codesign/enable=false
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PackedStringArray()
application/modify_resources=true
application/icon=""
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""
application/export_angle=0
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
$settings = New-ScheduledTaskSettingsSet
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
Start-ScheduledTask -TaskName godot_remote_debug
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
Remove-Item -Recurse -Force '{temp_dir}'"

153
hud.tscn
View File

@ -1,153 +0,0 @@
[gd_scene load_steps=3 format=3 uid="uid://i5hw0qow332a"]
[ext_resource type="Script" path="res://HUD.gd" id="1_4qotk"]
[ext_resource type="Script" path="res://ToolSelect.gd" id="2_m1iu2"]
[node name="HUD" type="PanelContainer"]
anchors_preset = 10
anchor_right = 1.0
grow_horizontal = 2
script = ExtResource("1_4qotk")
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 2
[node name="ToolSelect" type="HBoxContainer" parent="HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 2
script = ExtResource("2_m1iu2")
[node name="VBoxContainer" type="HBoxContainer" parent="HBoxContainer/ToolSelect"]
layout_mode = 2
[node name="OptionButton" type="OptionButton" parent="HBoxContainer/ToolSelect/VBoxContainer"]
layout_mode = 2
[node name="Create Player" type="VBoxContainer" parent="HBoxContainer/ToolSelect/VBoxContainer"]
layout_mode = 2
[node name="Create Pool" type="HBoxContainer" parent="HBoxContainer/ToolSelect/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool"]
layout_mode = 2
text = "R:"
[node name="Red" type="LineEdit" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool"]
layout_mode = 2
text = "100"
placeholder_text = "0"
[node name="Label5" type="Label" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool"]
layout_mode = 2
text = "G:"
[node name="Green" type="LineEdit" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool"]
layout_mode = 2
text = "100"
placeholder_text = "0"
max_length = 5
[node name="Label4" type="Label" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool"]
layout_mode = 2
text = "B:"
[node name="Blue" type="LineEdit" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool"]
layout_mode = 2
text = "100"
placeholder_text = "0"
max_length = 5
[node name="Create Pool Circle" type="HBoxContainer" parent="HBoxContainer/ToolSelect/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool Circle"]
layout_mode = 2
text = "R:"
[node name="Red" type="LineEdit" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool Circle"]
layout_mode = 2
text = "100"
placeholder_text = "0"
max_length = 5
[node name="Label5" type="Label" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool Circle"]
layout_mode = 2
text = "G:"
[node name="Green" type="LineEdit" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool Circle"]
layout_mode = 2
text = "100"
placeholder_text = "0"
max_length = 5
[node name="Label4" type="Label" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool Circle"]
layout_mode = 2
text = "B:"
[node name="Blue" type="LineEdit" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool Circle"]
layout_mode = 2
text = "100"
placeholder_text = "0"
max_length = 5
[node name="Label2" type="Label" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool Circle"]
layout_mode = 2
text = "Radius:"
[node name="Radius" type="LineEdit" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool Circle"]
layout_mode = 2
text = "200"
placeholder_text = "0"
max_length = 5
[node name="Label3" type="Label" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool Circle"]
layout_mode = 2
text = "Count:"
[node name="Count" type="LineEdit" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Pool Circle"]
layout_mode = 2
text = "16"
placeholder_text = "0"
max_length = 5
[node name="Paste" type="OptionButton" parent="HBoxContainer/ToolSelect/VBoxContainer"]
layout_mode = 2
[node name="Delete" type="VBoxContainer" parent="HBoxContainer/ToolSelect/VBoxContainer"]
layout_mode = 2
[node name="Control Player" type="VBoxContainer" parent="HBoxContainer/ToolSelect/VBoxContainer"]
layout_mode = 2
[node name="Button" type="Button" parent="HBoxContainer/ToolSelect/VBoxContainer/Control Player"]
layout_mode = 2
text = "Stop"
[node name="Debug" type="Label" parent="HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 6
text = "debug"
[node name="Right" type="HBoxContainer" parent="HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 10
[node name="File" type="MenuButton" parent="HBoxContainer/Right"]
layout_mode = 2
text = "File..."
item_count = 5
popup/item_0/text = "New..."
popup/item_0/id = 0
popup/item_1/text = "Load..."
popup/item_1/id = 1
popup/item_2/text = "Save..."
popup/item_2/id = 2
popup/item_3/text = ""
popup/item_3/id = 3
popup/item_3/separator = true
popup/item_4/text = "Settings..."
popup/item_4/id = 4
[connection signal="item_selected" from="HBoxContainer/ToolSelect/VBoxContainer/OptionButton" to="HBoxContainer/ToolSelect" method="_on_option_button_item_selected"]
[connection signal="pressed" from="HBoxContainer/ToolSelect/VBoxContainer/Control Player/Button" to="." method="_on_control_stop_button_pressed"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -24,4 +24,9 @@ shape = SubResource("CircleShape2D_yt706")
[node name="HealthTimer" type="Timer" parent="."]
autostart = true
[node name="PickupTimer" type="Timer" parent="."]
wait_time = 0.25
one_shot = true
[connection signal="timeout" from="HealthTimer" to="." method="_on_health_timer_timeout"]
[connection signal="timeout" from="PickupTimer" to="." method="_on_pickup_timer_timeout"]

View File

@ -52,6 +52,11 @@ escape={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
"zoom in"={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}
[layer_names]

1068
saves/atoms24 Normal file

File diff suppressed because it is too large Load Diff

3884
saves/atoms24_running Normal file

File diff suppressed because it is too large Load Diff

2707
saves/trippy Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,14 @@
[gd_scene load_steps=8 format=3 uid="uid://bpy475nyq5ea1"]
[gd_scene load_steps=10 format=3 uid="uid://bpy475nyq5ea1"]
[ext_resource type="Script" path="res://Map.gd" id="2_rolej"]
[ext_resource type="Script" path="res://ScreenShots.gd" id="3_7b3mn"]
[ext_resource type="Texture2D" uid="uid://1g54esg7yd35" path="res://images/crosshair.png" id="3_i24br"]
[ext_resource type="Script" path="res://Camera2D.gd" id="4_g4kw0"]
[ext_resource type="PackedScene" uid="uid://i5hw0qow332a" path="res://hud.tscn" id="4_u63sk"]
[ext_resource type="Script" path="res://LoadDialog.gd" id="6_0mayr"]
[ext_resource type="Script" path="res://SaveDialog.gd" id="6_v2wl8"]
[ext_resource type="Script" path="res://StatsWindow.gd" id="7_8peal"]
[ext_resource type="PackedScene" uid="uid://bfjdgwkowj6rr" path="res://src/Windows/tool_select.tscn" id="8_wgtoc"]
[ext_resource type="PackedScene" uid="uid://0i5mf5rafi45" path="res://src/Windows/settings.tscn" id="8_yj6l1"]
[node name="Sim" type="Node2D"]
@ -18,13 +20,22 @@ script = ExtResource("2_rolej")
script = ExtResource("4_g4kw0")
[node name="OriginSprite" type="Sprite2D" parent="Map"]
modulate = Color(0, 0, 0, 1)
scale = Vector2(0.2, 0.2)
texture = ExtResource("3_i24br")
[node name="Touch1Sprite" type="Sprite2D" parent="Map"]
modulate = Color(0, 0.513726, 0, 1)
scale = Vector2(0.2, 0.2)
texture = ExtResource("3_i24br")
[node name="Touch2Sprite" type="Sprite2D" parent="Map"]
modulate = Color(0, 0, 0.827451, 1)
scale = Vector2(0.2, 0.2)
texture = ExtResource("3_i24br")
[node name="ScreenOverlay" type="CanvasLayer" parent="."]
[node name="HUD" parent="ScreenOverlay" instance=ExtResource("4_u63sk")]
[node name="LoadDialog" type="ConfirmationDialog" parent="ScreenOverlay"]
title = "Load"
position = Vector2i(0, 36)
@ -54,37 +65,26 @@ placeholder_text = "Filename"
[node name="NewDialog" type="ConfirmationDialog" parent="ScreenOverlay"]
dialog_text = "Clear current map?"
[node name="SettingsWindow" type="Window" parent="ScreenOverlay"]
title = "Settings"
position = Vector2i(18, 50)
size = Vector2i(300, 200)
[node name="StatsWindow" type="Window" parent="ScreenOverlay"]
title = "Stats"
position = Vector2i(15, 197)
size = Vector2i(200, 200)
visible = false
script = ExtResource("7_8peal")
[node name="Timer" type="Timer" parent="ScreenOverlay/StatsWindow"]
autostart = true
[node name="Label" type="Label" parent="ScreenOverlay/StatsWindow"]
offset_right = 40.0
offset_bottom = 23.0
[node name="SettingsWindow" parent="ScreenOverlay" instance=ExtResource("8_yj6l1")]
visible = false
[node name="VBoxContainer" type="VBoxContainer" parent="ScreenOverlay/SettingsWindow"]
offset_right = 123.0
offset_bottom = 101.0
[node name="Decay" type="CheckBox" parent="ScreenOverlay/SettingsWindow/VBoxContainer"]
layout_mode = 2
text = "Decay"
[node name="Health" type="CheckBox" parent="ScreenOverlay/SettingsWindow/VBoxContainer"]
layout_mode = 2
text = "Health"
[node name="HBoxContainer" type="HBoxContainer" parent="ScreenOverlay/SettingsWindow/VBoxContainer"]
layout_mode = 2
[node name="Screenshots" type="CheckBox" parent="ScreenOverlay/SettingsWindow/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Screenshots @"
[node name="Interval" type="LineEdit" parent="ScreenOverlay/SettingsWindow/VBoxContainer/HBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="ScreenOverlay/SettingsWindow/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "sec"
[node name="ToolSelect" parent="ScreenOverlay" instance=ExtResource("8_wgtoc")]
unique_name_in_owner = true
position = Vector2i(20, 50)
[node name="ScreenShots" type="Timer" parent="."]
wait_time = 60.0
@ -96,7 +96,7 @@ script = ExtResource("3_7b3mn")
[connection signal="about_to_popup" from="ScreenOverlay/SaveDialog" to="ScreenOverlay/SaveDialog" method="_on_about_to_popup"]
[connection signal="confirmed" from="ScreenOverlay/SaveDialog" to="ScreenOverlay/SaveDialog" method="_on_confirmed"]
[connection signal="confirmed" from="ScreenOverlay/NewDialog" to="Map" method="_on_new_dialog_confirmed"]
[connection signal="close_requested" from="ScreenOverlay/SettingsWindow" to="ScreenOverlay/HUD" method="_on_settings_window_close_requested"]
[connection signal="toggled" from="ScreenOverlay/SettingsWindow/VBoxContainer/HBoxContainer/Screenshots" to="ScreenShots" method="_on_screenshots_toggled"]
[connection signal="text_changed" from="ScreenOverlay/SettingsWindow/VBoxContainer/HBoxContainer/Interval" to="ScreenShots" method="_on_interval_text_changed"]
[connection signal="close_requested" from="ScreenOverlay/StatsWindow" to="ScreenOverlay/StatsWindow" method="_on_close_requested"]
[connection signal="timeout" from="ScreenOverlay/StatsWindow/Timer" to="ScreenOverlay/StatsWindow" method="_on_timer_timeout"]
[connection signal="close_requested" from="ScreenOverlay/SettingsWindow" to="ScreenOverlay/SettingsWindow" method="_on_close_requested"]
[connection signal="timeout" from="ScreenShots" to="ScreenShots" method="_on_timeout"]

4
src/Windows/settings.gd Normal file
View File

@ -0,0 +1,4 @@
extends Window
func _on_close_requested():
hide()

39
src/Windows/settings.tscn Normal file
View File

@ -0,0 +1,39 @@
[gd_scene load_steps=2 format=3 uid="uid://0i5mf5rafi45"]
[ext_resource type="Script" path="res://src/Windows/settings.gd" id="1_i80kr"]
[node name="SettingsWindow" type="Window"]
title = "Settings"
position = Vector2i(0, 36)
size = Vector2i(250, 200)
script = ExtResource("1_i80kr")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
offset_right = 123.0
offset_bottom = 101.0
[node name="Decay" type="CheckBox" parent="VBoxContainer"]
layout_mode = 2
text = "Decay"
[node name="Health" type="CheckBox" parent="VBoxContainer"]
layout_mode = 2
text = "Health"
[node name="DropOnColl" type="CheckBox" parent="VBoxContainer"]
layout_mode = 2
text = "Drop on Coll"
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
[node name="Screenshots" type="CheckBox" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Screenshots @"
[node name="Interval" type="LineEdit" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "sec"

View File

@ -1,7 +1,8 @@
extends Control
extends Window
# Called when the node enters the scene tree for the first time.
func _ready():
$VBoxContainer/OptionButton.clear()
var first_child = true # Flag to identify the first child node
for child in $VBoxContainer.get_children():
if child != $VBoxContainer/OptionButton:
@ -58,3 +59,30 @@ func get_selected():
if i - 1 == index: # Adjusted index because of the OptionButton
return child
return null
func _on_tool_select_container_resized():
print($VBoxContainer.get_rect())
size=Vector2(200,$VBoxContainer.get_rect().size[1])
func _on_new_pressed():
$"../NewDialog".popup_centered()
func _on_load_pressed():
$"../LoadDialog".popup_centered()
func _on_save_pressed():
$"../SaveDialog".popup_centered()
func _on_kill_all_pressed():
for node in %Map.get_children():
if node is Player:
node.queue_free()
func _on_control_stop_pressed():
%Map.controlling=null
func _on_stats_pressed():
$"../StatsWindow".popup_centered()
func _on_settings_pressed():
$"../SettingsWindow".popup_centered()

View File

@ -0,0 +1,272 @@
[gd_scene load_steps=2 format=3 uid="uid://bfjdgwkowj6rr"]
[ext_resource type="Script" path="res://src/Windows/tool_select.gd" id="1_suvl4"]
[node name="ToolSelect" type="Window"]
title = "Tool"
position = Vector2i(0, 36)
size = Vector2i(200, 200)
script = ExtResource("1_suvl4")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
offset_right = 1656.0
offset_bottom = 31.0
[node name="OptionButton" type="OptionButton" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 0
item_count = 1
selected = 0
popup/item_0/text = "Select Tool..."
popup/item_0/id = 0
[node name="File" type="VBoxContainer" parent="VBoxContainer"]
layout_mode = 2
[node name="New" type="Button" parent="VBoxContainer/File"]
layout_mode = 2
size_flags_horizontal = 0
text = "New..."
[node name="Load" type="Button" parent="VBoxContainer/File"]
layout_mode = 2
size_flags_horizontal = 0
text = "Load..."
[node name="Save" type="Button" parent="VBoxContainer/File"]
layout_mode = 2
size_flags_horizontal = 0
text = "Save..."
[node name="Stats" type="Button" parent="VBoxContainer/File"]
layout_mode = 2
size_flags_horizontal = 0
text = "Stats..."
[node name="Settings" type="Button" parent="VBoxContainer/File"]
layout_mode = 2
size_flags_horizontal = 0
text = "Settings..."
[node name="Create Player" type="VBoxContainer" parent="VBoxContainer"]
visible = false
layout_mode = 2
[node name="Create Pool" type="VBoxContainer" parent="VBoxContainer"]
visible = false
layout_mode = 2
[node name="Red" type="HBoxContainer" parent="VBoxContainer/Create Pool"]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/Create Pool/Red"]
layout_mode = 2
text = "R:"
[node name="val" type="LineEdit" parent="VBoxContainer/Create Pool/Red"]
layout_mode = 2
text = "100"
placeholder_text = "0"
[node name="Blue" type="HBoxContainer" parent="VBoxContainer/Create Pool"]
layout_mode = 2
[node name="Label4" type="Label" parent="VBoxContainer/Create Pool/Blue"]
layout_mode = 2
text = "B:"
[node name="val" type="LineEdit" parent="VBoxContainer/Create Pool/Blue"]
layout_mode = 2
text = "100"
placeholder_text = "0"
max_length = 5
[node name="Green" type="HBoxContainer" parent="VBoxContainer/Create Pool"]
layout_mode = 2
[node name="Label5" type="Label" parent="VBoxContainer/Create Pool/Green"]
layout_mode = 2
text = "G:"
[node name="val" type="LineEdit" parent="VBoxContainer/Create Pool/Green"]
layout_mode = 2
text = "100"
placeholder_text = "0"
max_length = 5
[node name="Create Player Circle" type="VBoxContainer" parent="VBoxContainer"]
visible = false
layout_mode = 2
[node name="Radius" type="HBoxContainer" parent="VBoxContainer/Create Player Circle"]
layout_mode = 2
[node name="Label2" type="Label" parent="VBoxContainer/Create Player Circle/Radius"]
layout_mode = 2
text = "Radius:"
[node name="val" type="LineEdit" parent="VBoxContainer/Create Player Circle/Radius"]
layout_mode = 2
text = "50"
placeholder_text = "0"
max_length = 5
[node name="Count" type="HBoxContainer" parent="VBoxContainer/Create Player Circle"]
layout_mode = 2
[node name="Label3" type="Label" parent="VBoxContainer/Create Player Circle/Count"]
layout_mode = 2
text = "Count:"
[node name="val" type="LineEdit" parent="VBoxContainer/Create Player Circle/Count"]
layout_mode = 2
text = "16"
placeholder_text = "0"
max_length = 5
[node name="Create Pool Circle" type="VBoxContainer" parent="VBoxContainer"]
visible = false
layout_mode = 2
[node name="Red" type="HBoxContainer" parent="VBoxContainer/Create Pool Circle"]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/Create Pool Circle/Red"]
layout_mode = 2
text = "R:"
[node name="val" type="LineEdit" parent="VBoxContainer/Create Pool Circle/Red"]
layout_mode = 2
text = "100"
placeholder_text = "0"
max_length = 5
[node name="Green" type="HBoxContainer" parent="VBoxContainer/Create Pool Circle"]
layout_mode = 2
[node name="Label5" type="Label" parent="VBoxContainer/Create Pool Circle/Green"]
layout_mode = 2
text = "G:"
[node name="val" type="LineEdit" parent="VBoxContainer/Create Pool Circle/Green"]
layout_mode = 2
text = "100"
placeholder_text = "0"
max_length = 5
[node name="Blue" type="HBoxContainer" parent="VBoxContainer/Create Pool Circle"]
layout_mode = 2
[node name="Label4" type="Label" parent="VBoxContainer/Create Pool Circle/Blue"]
layout_mode = 2
text = "B:"
[node name="val" type="LineEdit" parent="VBoxContainer/Create Pool Circle/Blue"]
layout_mode = 2
text = "100"
placeholder_text = "0"
max_length = 5
[node name="Radius" type="HBoxContainer" parent="VBoxContainer/Create Pool Circle"]
layout_mode = 2
[node name="Label2" type="Label" parent="VBoxContainer/Create Pool Circle/Radius"]
layout_mode = 2
text = "Radius:"
[node name="val" type="LineEdit" parent="VBoxContainer/Create Pool Circle/Radius"]
layout_mode = 2
text = "200"
placeholder_text = "0"
max_length = 5
[node name="Count" type="HBoxContainer" parent="VBoxContainer/Create Pool Circle"]
layout_mode = 2
[node name="Label3" type="Label" parent="VBoxContainer/Create Pool Circle/Count"]
layout_mode = 2
text = "Count:"
[node name="val" type="LineEdit" parent="VBoxContainer/Create Pool Circle/Count"]
layout_mode = 2
text = "16"
placeholder_text = "0"
max_length = 5
[node name="Paste" type="OptionButton" parent="VBoxContainer"]
visible = false
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 0
[node name="Delete" type="VBoxContainer" parent="VBoxContainer"]
visible = false
layout_mode = 2
[node name="Impulse" type="VBoxContainer" parent="VBoxContainer"]
visible = false
layout_mode = 2
[node name="Type" type="OptionButton" parent="VBoxContainer/Impulse"]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 0
item_count = 2
selected = 0
popup/item_0/text = "Linear"
popup/item_0/id = 0
popup/item_1/text = "Radial"
popup/item_1/id = 1
[node name="Power" type="HBoxContainer" parent="VBoxContainer/Impulse"]
layout_mode = 2
[node name="Label2" type="Label" parent="VBoxContainer/Impulse/Power"]
layout_mode = 2
text = "Power
"
[node name="val" type="LineEdit" parent="VBoxContainer/Impulse/Power"]
layout_mode = 2
text = "1"
[node name="Attenuation" type="HBoxContainer" parent="VBoxContainer/Impulse"]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/Impulse/Attenuation"]
layout_mode = 2
text = "Attenuation"
[node name="val" type="LineEdit" parent="VBoxContainer/Impulse/Attenuation"]
layout_mode = 2
text = "1"
[node name="Control Player" type="VBoxContainer" parent="VBoxContainer"]
visible = false
layout_mode = 2
[node name="control_stop" type="Button" parent="VBoxContainer/Control Player"]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 0
text = "Stop"
[node name="GOD" type="VBoxContainer" parent="VBoxContainer"]
layout_mode = 2
[node name="kill all" type="Button" parent="VBoxContainer/GOD"]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 0
text = "Kill All"
[connection signal="resized" from="VBoxContainer" to="." method="_on_tool_select_container_resized"]
[connection signal="item_selected" from="VBoxContainer/OptionButton" to="." method="_on_option_button_item_selected"]
[connection signal="pressed" from="VBoxContainer/File/New" to="." method="_on_new_pressed"]
[connection signal="pressed" from="VBoxContainer/File/Load" to="." method="_on_load_pressed"]
[connection signal="pressed" from="VBoxContainer/File/Save" to="." method="_on_save_pressed"]
[connection signal="pressed" from="VBoxContainer/File/Stats" to="." method="_on_stats_pressed"]
[connection signal="pressed" from="VBoxContainer/File/Settings" to="." method="_on_settings_pressed"]
[connection signal="pressed" from="VBoxContainer/Control Player/control_stop" to="." method="_on_control_stop_pressed"]
[connection signal="pressed" from="VBoxContainer/GOD/kill all" to="." method="_on_kill_all_pressed"]