fix player spawn+circle
This commit is contained in:
parent
a1c83154de
commit
08561d1a39
48
Map.gd
48
Map.gd
@ -41,6 +41,10 @@ func spawn(pos,vol):
|
||||
var cnt=int(tool.get_node("Count").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").text)
|
||||
var cnt=int(tool.get_node("Count").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()
|
||||
@ -69,45 +73,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()
|
||||
add_child(new_player)
|
||||
|
||||
func spawn_pool_circle(pos: Vector2, radius, count, r,g,b):
|
||||
for n in range(1,count+1):
|
||||
@ -117,9 +89,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):
|
||||
|
@ -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=""
|
||||
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}'"
|
||||
|
23
hud.tscn
23
hud.tscn
@ -111,6 +111,29 @@ text = "16"
|
||||
placeholder_text = "0"
|
||||
max_length = 5
|
||||
|
||||
[node name="Create Player Circle" type="HBoxContainer" parent="HBoxContainer/ToolSelect/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label2" type="Label" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Player Circle"]
|
||||
layout_mode = 2
|
||||
text = "Radius:"
|
||||
|
||||
[node name="Radius" type="LineEdit" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Player Circle"]
|
||||
layout_mode = 2
|
||||
text = "200"
|
||||
placeholder_text = "0"
|
||||
max_length = 5
|
||||
|
||||
[node name="Label3" type="Label" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Player Circle"]
|
||||
layout_mode = 2
|
||||
text = "Count:"
|
||||
|
||||
[node name="Count" type="LineEdit" parent="HBoxContainer/ToolSelect/VBoxContainer/Create Player Circle"]
|
||||
layout_mode = 2
|
||||
text = "16"
|
||||
placeholder_text = "0"
|
||||
max_length = 5
|
||||
|
||||
[node name="Paste" type="OptionButton" parent="HBoxContainer/ToolSelect/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user