make phone friendly
commit
c6340573c0
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,403 @@
|
||||||
|
[preset.0]
|
||||||
|
|
||||||
|
name="Android"
|
||||||
|
platform="Android"
|
||||||
|
runnable=true
|
||||||
|
dedicated_server=false
|
||||||
|
custom_features=""
|
||||||
|
export_filter="all_resources"
|
||||||
|
include_filter=""
|
||||||
|
exclude_filter=""
|
||||||
|
export_path="export/test.apk"
|
||||||
|
encryption_include_filters=""
|
||||||
|
encryption_exclude_filters=""
|
||||||
|
encrypt_pck=false
|
||||||
|
encrypt_directory=false
|
||||||
|
|
||||||
|
[preset.0.options]
|
||||||
|
|
||||||
|
custom_template/debug=""
|
||||||
|
custom_template/release=""
|
||||||
|
gradle_build/use_gradle_build=false
|
||||||
|
gradle_build/export_format=0
|
||||||
|
gradle_build/min_sdk=""
|
||||||
|
gradle_build/target_sdk=""
|
||||||
|
architectures/armeabi-v7a=false
|
||||||
|
architectures/arm64-v8a=true
|
||||||
|
architectures/x86=false
|
||||||
|
architectures/x86_64=false
|
||||||
|
version/code=1
|
||||||
|
version/name=""
|
||||||
|
package/unique_name="com.example.$genname"
|
||||||
|
package/name=""
|
||||||
|
package/signed=true
|
||||||
|
package/app_category=2
|
||||||
|
package/retain_data_on_uninstall=false
|
||||||
|
package/exclude_from_recents=false
|
||||||
|
package/show_in_android_tv=false
|
||||||
|
package/show_in_app_library=true
|
||||||
|
package/show_as_launcher_app=false
|
||||||
|
launcher_icons/main_192x192=""
|
||||||
|
launcher_icons/adaptive_foreground_432x432=""
|
||||||
|
launcher_icons/adaptive_background_432x432=""
|
||||||
|
graphics/opengl_debug=false
|
||||||
|
xr_features/xr_mode=0
|
||||||
|
screen/immersive_mode=true
|
||||||
|
screen/support_small=true
|
||||||
|
screen/support_normal=true
|
||||||
|
screen/support_large=true
|
||||||
|
screen/support_xlarge=true
|
||||||
|
user_data_backup/allow=false
|
||||||
|
command_line/extra_args=""
|
||||||
|
apk_expansion/enable=false
|
||||||
|
apk_expansion/SALT=""
|
||||||
|
apk_expansion/public_key=""
|
||||||
|
permissions/custom_permissions=PackedStringArray()
|
||||||
|
permissions/access_checkin_properties=false
|
||||||
|
permissions/access_coarse_location=false
|
||||||
|
permissions/access_fine_location=false
|
||||||
|
permissions/access_location_extra_commands=false
|
||||||
|
permissions/access_mock_location=false
|
||||||
|
permissions/access_network_state=false
|
||||||
|
permissions/access_surface_flinger=false
|
||||||
|
permissions/access_wifi_state=false
|
||||||
|
permissions/account_manager=false
|
||||||
|
permissions/add_voicemail=false
|
||||||
|
permissions/authenticate_accounts=false
|
||||||
|
permissions/battery_stats=false
|
||||||
|
permissions/bind_accessibility_service=false
|
||||||
|
permissions/bind_appwidget=false
|
||||||
|
permissions/bind_device_admin=false
|
||||||
|
permissions/bind_input_method=false
|
||||||
|
permissions/bind_nfc_service=false
|
||||||
|
permissions/bind_notification_listener_service=false
|
||||||
|
permissions/bind_print_service=false
|
||||||
|
permissions/bind_remoteviews=false
|
||||||
|
permissions/bind_text_service=false
|
||||||
|
permissions/bind_vpn_service=false
|
||||||
|
permissions/bind_wallpaper=false
|
||||||
|
permissions/bluetooth=false
|
||||||
|
permissions/bluetooth_admin=false
|
||||||
|
permissions/bluetooth_privileged=false
|
||||||
|
permissions/brick=false
|
||||||
|
permissions/broadcast_package_removed=false
|
||||||
|
permissions/broadcast_sms=false
|
||||||
|
permissions/broadcast_sticky=false
|
||||||
|
permissions/broadcast_wap_push=false
|
||||||
|
permissions/call_phone=false
|
||||||
|
permissions/call_privileged=false
|
||||||
|
permissions/camera=false
|
||||||
|
permissions/capture_audio_output=false
|
||||||
|
permissions/capture_secure_video_output=false
|
||||||
|
permissions/capture_video_output=false
|
||||||
|
permissions/change_component_enabled_state=false
|
||||||
|
permissions/change_configuration=false
|
||||||
|
permissions/change_network_state=false
|
||||||
|
permissions/change_wifi_multicast_state=false
|
||||||
|
permissions/change_wifi_state=false
|
||||||
|
permissions/clear_app_cache=false
|
||||||
|
permissions/clear_app_user_data=false
|
||||||
|
permissions/control_location_updates=false
|
||||||
|
permissions/delete_cache_files=false
|
||||||
|
permissions/delete_packages=false
|
||||||
|
permissions/device_power=false
|
||||||
|
permissions/diagnostic=false
|
||||||
|
permissions/disable_keyguard=false
|
||||||
|
permissions/dump=false
|
||||||
|
permissions/expand_status_bar=false
|
||||||
|
permissions/factory_test=false
|
||||||
|
permissions/flashlight=false
|
||||||
|
permissions/force_back=false
|
||||||
|
permissions/get_accounts=false
|
||||||
|
permissions/get_package_size=false
|
||||||
|
permissions/get_tasks=false
|
||||||
|
permissions/get_top_activity_info=false
|
||||||
|
permissions/global_search=false
|
||||||
|
permissions/hardware_test=false
|
||||||
|
permissions/inject_events=false
|
||||||
|
permissions/install_location_provider=false
|
||||||
|
permissions/install_packages=false
|
||||||
|
permissions/install_shortcut=false
|
||||||
|
permissions/internal_system_window=false
|
||||||
|
permissions/internet=false
|
||||||
|
permissions/kill_background_processes=false
|
||||||
|
permissions/location_hardware=false
|
||||||
|
permissions/manage_accounts=false
|
||||||
|
permissions/manage_app_tokens=false
|
||||||
|
permissions/manage_documents=false
|
||||||
|
permissions/manage_external_storage=false
|
||||||
|
permissions/master_clear=false
|
||||||
|
permissions/media_content_control=false
|
||||||
|
permissions/modify_audio_settings=false
|
||||||
|
permissions/modify_phone_state=false
|
||||||
|
permissions/mount_format_filesystems=false
|
||||||
|
permissions/mount_unmount_filesystems=false
|
||||||
|
permissions/nfc=false
|
||||||
|
permissions/persistent_activity=false
|
||||||
|
permissions/process_outgoing_calls=false
|
||||||
|
permissions/read_calendar=false
|
||||||
|
permissions/read_call_log=false
|
||||||
|
permissions/read_contacts=false
|
||||||
|
permissions/read_external_storage=false
|
||||||
|
permissions/read_frame_buffer=false
|
||||||
|
permissions/read_history_bookmarks=false
|
||||||
|
permissions/read_input_state=false
|
||||||
|
permissions/read_logs=false
|
||||||
|
permissions/read_phone_state=false
|
||||||
|
permissions/read_profile=false
|
||||||
|
permissions/read_sms=false
|
||||||
|
permissions/read_social_stream=false
|
||||||
|
permissions/read_sync_settings=false
|
||||||
|
permissions/read_sync_stats=false
|
||||||
|
permissions/read_user_dictionary=false
|
||||||
|
permissions/reboot=false
|
||||||
|
permissions/receive_boot_completed=false
|
||||||
|
permissions/receive_mms=false
|
||||||
|
permissions/receive_sms=false
|
||||||
|
permissions/receive_wap_push=false
|
||||||
|
permissions/record_audio=false
|
||||||
|
permissions/reorder_tasks=false
|
||||||
|
permissions/restart_packages=false
|
||||||
|
permissions/send_respond_via_message=false
|
||||||
|
permissions/send_sms=false
|
||||||
|
permissions/set_activity_watcher=false
|
||||||
|
permissions/set_alarm=false
|
||||||
|
permissions/set_always_finish=false
|
||||||
|
permissions/set_animation_scale=false
|
||||||
|
permissions/set_debug_app=false
|
||||||
|
permissions/set_orientation=false
|
||||||
|
permissions/set_pointer_speed=false
|
||||||
|
permissions/set_preferred_applications=false
|
||||||
|
permissions/set_process_limit=false
|
||||||
|
permissions/set_time=false
|
||||||
|
permissions/set_time_zone=false
|
||||||
|
permissions/set_wallpaper=false
|
||||||
|
permissions/set_wallpaper_hints=false
|
||||||
|
permissions/signal_persistent_processes=false
|
||||||
|
permissions/status_bar=false
|
||||||
|
permissions/subscribed_feeds_read=false
|
||||||
|
permissions/subscribed_feeds_write=false
|
||||||
|
permissions/system_alert_window=false
|
||||||
|
permissions/transmit_ir=false
|
||||||
|
permissions/uninstall_shortcut=false
|
||||||
|
permissions/update_device_stats=false
|
||||||
|
permissions/use_credentials=false
|
||||||
|
permissions/use_sip=false
|
||||||
|
permissions/vibrate=false
|
||||||
|
permissions/wake_lock=false
|
||||||
|
permissions/write_apn_settings=false
|
||||||
|
permissions/write_calendar=false
|
||||||
|
permissions/write_call_log=false
|
||||||
|
permissions/write_contacts=false
|
||||||
|
permissions/write_external_storage=false
|
||||||
|
permissions/write_gservices=false
|
||||||
|
permissions/write_history_bookmarks=false
|
||||||
|
permissions/write_profile=false
|
||||||
|
permissions/write_secure_settings=false
|
||||||
|
permissions/write_settings=false
|
||||||
|
permissions/write_sms=false
|
||||||
|
permissions/write_social_stream=false
|
||||||
|
permissions/write_sync_settings=false
|
||||||
|
permissions/write_user_dictionary=false
|
||||||
|
|
||||||
|
[preset.1]
|
||||||
|
|
||||||
|
name="Android 2"
|
||||||
|
platform="Android"
|
||||||
|
runnable=false
|
||||||
|
dedicated_server=false
|
||||||
|
custom_features=""
|
||||||
|
export_filter="all_resources"
|
||||||
|
include_filter=""
|
||||||
|
exclude_filter=""
|
||||||
|
export_path=""
|
||||||
|
encryption_include_filters=""
|
||||||
|
encryption_exclude_filters=""
|
||||||
|
encrypt_pck=false
|
||||||
|
encrypt_directory=false
|
||||||
|
|
||||||
|
[preset.1.options]
|
||||||
|
|
||||||
|
custom_template/debug=""
|
||||||
|
custom_template/release=""
|
||||||
|
gradle_build/use_gradle_build=false
|
||||||
|
gradle_build/export_format=0
|
||||||
|
gradle_build/min_sdk=""
|
||||||
|
gradle_build/target_sdk=""
|
||||||
|
architectures/armeabi-v7a=false
|
||||||
|
architectures/arm64-v8a=true
|
||||||
|
architectures/x86=false
|
||||||
|
architectures/x86_64=false
|
||||||
|
version/code=1
|
||||||
|
version/name=""
|
||||||
|
package/unique_name="com.example.$genname"
|
||||||
|
package/name=""
|
||||||
|
package/signed=true
|
||||||
|
package/app_category=2
|
||||||
|
package/retain_data_on_uninstall=false
|
||||||
|
package/exclude_from_recents=false
|
||||||
|
package/show_in_android_tv=false
|
||||||
|
package/show_in_app_library=true
|
||||||
|
package/show_as_launcher_app=false
|
||||||
|
launcher_icons/main_192x192=""
|
||||||
|
launcher_icons/adaptive_foreground_432x432=""
|
||||||
|
launcher_icons/adaptive_background_432x432=""
|
||||||
|
graphics/opengl_debug=false
|
||||||
|
xr_features/xr_mode=0
|
||||||
|
screen/immersive_mode=true
|
||||||
|
screen/support_small=true
|
||||||
|
screen/support_normal=true
|
||||||
|
screen/support_large=true
|
||||||
|
screen/support_xlarge=true
|
||||||
|
user_data_backup/allow=false
|
||||||
|
command_line/extra_args=""
|
||||||
|
apk_expansion/enable=false
|
||||||
|
apk_expansion/SALT=""
|
||||||
|
apk_expansion/public_key=""
|
||||||
|
permissions/custom_permissions=PackedStringArray()
|
||||||
|
permissions/access_checkin_properties=false
|
||||||
|
permissions/access_coarse_location=false
|
||||||
|
permissions/access_fine_location=false
|
||||||
|
permissions/access_location_extra_commands=false
|
||||||
|
permissions/access_mock_location=false
|
||||||
|
permissions/access_network_state=false
|
||||||
|
permissions/access_surface_flinger=false
|
||||||
|
permissions/access_wifi_state=false
|
||||||
|
permissions/account_manager=false
|
||||||
|
permissions/add_voicemail=false
|
||||||
|
permissions/authenticate_accounts=false
|
||||||
|
permissions/battery_stats=false
|
||||||
|
permissions/bind_accessibility_service=false
|
||||||
|
permissions/bind_appwidget=false
|
||||||
|
permissions/bind_device_admin=false
|
||||||
|
permissions/bind_input_method=false
|
||||||
|
permissions/bind_nfc_service=false
|
||||||
|
permissions/bind_notification_listener_service=false
|
||||||
|
permissions/bind_print_service=false
|
||||||
|
permissions/bind_remoteviews=false
|
||||||
|
permissions/bind_text_service=false
|
||||||
|
permissions/bind_vpn_service=false
|
||||||
|
permissions/bind_wallpaper=false
|
||||||
|
permissions/bluetooth=false
|
||||||
|
permissions/bluetooth_admin=false
|
||||||
|
permissions/bluetooth_privileged=false
|
||||||
|
permissions/brick=false
|
||||||
|
permissions/broadcast_package_removed=false
|
||||||
|
permissions/broadcast_sms=false
|
||||||
|
permissions/broadcast_sticky=false
|
||||||
|
permissions/broadcast_wap_push=false
|
||||||
|
permissions/call_phone=false
|
||||||
|
permissions/call_privileged=false
|
||||||
|
permissions/camera=false
|
||||||
|
permissions/capture_audio_output=false
|
||||||
|
permissions/capture_secure_video_output=false
|
||||||
|
permissions/capture_video_output=false
|
||||||
|
permissions/change_component_enabled_state=false
|
||||||
|
permissions/change_configuration=false
|
||||||
|
permissions/change_network_state=false
|
||||||
|
permissions/change_wifi_multicast_state=false
|
||||||
|
permissions/change_wifi_state=false
|
||||||
|
permissions/clear_app_cache=false
|
||||||
|
permissions/clear_app_user_data=false
|
||||||
|
permissions/control_location_updates=false
|
||||||
|
permissions/delete_cache_files=false
|
||||||
|
permissions/delete_packages=false
|
||||||
|
permissions/device_power=false
|
||||||
|
permissions/diagnostic=false
|
||||||
|
permissions/disable_keyguard=false
|
||||||
|
permissions/dump=false
|
||||||
|
permissions/expand_status_bar=false
|
||||||
|
permissions/factory_test=false
|
||||||
|
permissions/flashlight=false
|
||||||
|
permissions/force_back=false
|
||||||
|
permissions/get_accounts=false
|
||||||
|
permissions/get_package_size=false
|
||||||
|
permissions/get_tasks=false
|
||||||
|
permissions/get_top_activity_info=false
|
||||||
|
permissions/global_search=false
|
||||||
|
permissions/hardware_test=false
|
||||||
|
permissions/inject_events=false
|
||||||
|
permissions/install_location_provider=false
|
||||||
|
permissions/install_packages=false
|
||||||
|
permissions/install_shortcut=false
|
||||||
|
permissions/internal_system_window=false
|
||||||
|
permissions/internet=false
|
||||||
|
permissions/kill_background_processes=false
|
||||||
|
permissions/location_hardware=false
|
||||||
|
permissions/manage_accounts=false
|
||||||
|
permissions/manage_app_tokens=false
|
||||||
|
permissions/manage_documents=false
|
||||||
|
permissions/manage_external_storage=false
|
||||||
|
permissions/master_clear=false
|
||||||
|
permissions/media_content_control=false
|
||||||
|
permissions/modify_audio_settings=false
|
||||||
|
permissions/modify_phone_state=false
|
||||||
|
permissions/mount_format_filesystems=false
|
||||||
|
permissions/mount_unmount_filesystems=false
|
||||||
|
permissions/nfc=false
|
||||||
|
permissions/persistent_activity=false
|
||||||
|
permissions/process_outgoing_calls=false
|
||||||
|
permissions/read_calendar=false
|
||||||
|
permissions/read_call_log=false
|
||||||
|
permissions/read_contacts=false
|
||||||
|
permissions/read_external_storage=false
|
||||||
|
permissions/read_frame_buffer=false
|
||||||
|
permissions/read_history_bookmarks=false
|
||||||
|
permissions/read_input_state=false
|
||||||
|
permissions/read_logs=false
|
||||||
|
permissions/read_phone_state=false
|
||||||
|
permissions/read_profile=false
|
||||||
|
permissions/read_sms=false
|
||||||
|
permissions/read_social_stream=false
|
||||||
|
permissions/read_sync_settings=false
|
||||||
|
permissions/read_sync_stats=false
|
||||||
|
permissions/read_user_dictionary=false
|
||||||
|
permissions/reboot=false
|
||||||
|
permissions/receive_boot_completed=false
|
||||||
|
permissions/receive_mms=false
|
||||||
|
permissions/receive_sms=false
|
||||||
|
permissions/receive_wap_push=false
|
||||||
|
permissions/record_audio=false
|
||||||
|
permissions/reorder_tasks=false
|
||||||
|
permissions/restart_packages=false
|
||||||
|
permissions/send_respond_via_message=false
|
||||||
|
permissions/send_sms=false
|
||||||
|
permissions/set_activity_watcher=false
|
||||||
|
permissions/set_alarm=false
|
||||||
|
permissions/set_always_finish=false
|
||||||
|
permissions/set_animation_scale=false
|
||||||
|
permissions/set_debug_app=false
|
||||||
|
permissions/set_orientation=false
|
||||||
|
permissions/set_pointer_speed=false
|
||||||
|
permissions/set_preferred_applications=false
|
||||||
|
permissions/set_process_limit=false
|
||||||
|
permissions/set_time=false
|
||||||
|
permissions/set_time_zone=false
|
||||||
|
permissions/set_wallpaper=false
|
||||||
|
permissions/set_wallpaper_hints=false
|
||||||
|
permissions/signal_persistent_processes=false
|
||||||
|
permissions/status_bar=false
|
||||||
|
permissions/subscribed_feeds_read=false
|
||||||
|
permissions/subscribed_feeds_write=false
|
||||||
|
permissions/system_alert_window=false
|
||||||
|
permissions/transmit_ir=false
|
||||||
|
permissions/uninstall_shortcut=false
|
||||||
|
permissions/update_device_stats=false
|
||||||
|
permissions/use_credentials=false
|
||||||
|
permissions/use_sip=false
|
||||||
|
permissions/vibrate=false
|
||||||
|
permissions/wake_lock=false
|
||||||
|
permissions/write_apn_settings=false
|
||||||
|
permissions/write_calendar=false
|
||||||
|
permissions/write_call_log=false
|
||||||
|
permissions/write_contacts=false
|
||||||
|
permissions/write_external_storage=false
|
||||||
|
permissions/write_gservices=false
|
||||||
|
permissions/write_history_bookmarks=false
|
||||||
|
permissions/write_profile=false
|
||||||
|
permissions/write_secure_settings=false
|
||||||
|
permissions/write_settings=false
|
||||||
|
permissions/write_sms=false
|
||||||
|
permissions/write_social_stream=false
|
||||||
|
permissions/write_sync_settings=false
|
||||||
|
permissions/write_user_dictionary=false
|
|
@ -0,0 +1,37 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://cfj2tfn3nn7w7"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://game/logic.gd" id="1_j5mub"]
|
||||||
|
|
||||||
|
[node name="game" type="Node"]
|
||||||
|
|
||||||
|
[node name="logic" type="Node" parent="."]
|
||||||
|
script = ExtResource("1_j5mub")
|
||||||
|
|
||||||
|
[node name="canvas" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="circles" type="Node2D" parent="canvas"]
|
||||||
|
|
||||||
|
[node name="lines" type="Node2D" parent="canvas"]
|
||||||
|
|
||||||
|
[node name="end_screen" type="Node2D" parent="canvas"]
|
||||||
|
visible = false
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="canvas/end_screen"]
|
||||||
|
visible = false
|
||||||
|
offset_left = 291.0
|
||||||
|
offset_top = 163.0
|
||||||
|
offset_right = 354.0
|
||||||
|
offset_bottom = 186.0
|
||||||
|
scale = Vector2(5, 5)
|
||||||
|
text = "Čestitke"
|
||||||
|
|
||||||
|
[node name="Button" type="Button" parent="canvas/end_screen"]
|
||||||
|
visible = false
|
||||||
|
offset_left = 331.0
|
||||||
|
offset_top = 278.0
|
||||||
|
offset_right = 450.0
|
||||||
|
offset_bottom = 309.0
|
||||||
|
scale = Vector2(2, 2)
|
||||||
|
text = "Igraj še enkrat"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="canvas/end_screen/Button" to="logic" method="_on_button_pressed"]
|
|
@ -0,0 +1,187 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
const number_of_circles = 10
|
||||||
|
|
||||||
|
var circle_node = preload("res://game/objects/circle/circle.tscn")
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
hide_end_screen()
|
||||||
|
new_game()
|
||||||
|
|
||||||
|
func new_game():
|
||||||
|
generate_knot()
|
||||||
|
check_all_lines()
|
||||||
|
|
||||||
|
func generate_knot():
|
||||||
|
#clrear previous
|
||||||
|
for child in $"../canvas/circles".get_children():
|
||||||
|
child.queue_free()
|
||||||
|
for child in $"../canvas/lines".get_children():
|
||||||
|
child.queue_free()
|
||||||
|
var grid = []
|
||||||
|
var grid_size = ceil(sqrt(number_of_circles))
|
||||||
|
for i in range(number_of_circles):
|
||||||
|
var circle = circle_node.instantiate()
|
||||||
|
circle.set_global_position(Vector2(randi_range(100, 1000), randi_range(100, 500)))
|
||||||
|
#circle.get_child(3).text = str(i)
|
||||||
|
grid.append(circle)
|
||||||
|
# make connection
|
||||||
|
var neighbour_indexes = [-grid_size+1, 1, grid_size] #, grid_size+1]
|
||||||
|
for i in range(grid_size):
|
||||||
|
for j in range(grid_size-1):
|
||||||
|
var index = i*grid_size+j
|
||||||
|
for offset in neighbour_indexes:
|
||||||
|
if index+offset >= 0 and index+offset < grid.size() and index < grid.size():
|
||||||
|
#print(index, index+offset, grid.size()-1)
|
||||||
|
#print("conenct ", index, " to ", index+offset)
|
||||||
|
connect_circles(grid[index], grid[index+offset])
|
||||||
|
for circle in grid:
|
||||||
|
$"../canvas/circles".add_child(circle)
|
||||||
|
circle.raised.connect(check_all_lines)
|
||||||
|
#return grid
|
||||||
|
|
||||||
|
#func place_circles():
|
||||||
|
#for circle in $"../canvas/circles".get_children():
|
||||||
|
|
||||||
|
|
||||||
|
func connect_circles(circle1, circle2):
|
||||||
|
#check already connected
|
||||||
|
for line in circle1.attached_lines.keys():
|
||||||
|
if line in circle2.attached_lines.keys():
|
||||||
|
return false
|
||||||
|
var new_line = Line2D.new()
|
||||||
|
new_line.width = 4
|
||||||
|
new_line.add_point(circle1.position)
|
||||||
|
new_line.add_point(circle2.position)
|
||||||
|
circle1.add_line(new_line, 0)
|
||||||
|
circle2.add_line(new_line, 1)
|
||||||
|
$"../canvas/lines".add_child(new_line)
|
||||||
|
return true
|
||||||
|
|
||||||
|
func check_all_lines():
|
||||||
|
var all_lines = $"../canvas/lines".get_children()
|
||||||
|
var redlist = []
|
||||||
|
for line in all_lines:
|
||||||
|
for other_line in all_lines:
|
||||||
|
if line != other_line and not line in redlist:
|
||||||
|
var intersection = detect_intersection(line, other_line)
|
||||||
|
if intersection:
|
||||||
|
line.set_default_color(Color.CRIMSON)
|
||||||
|
other_line.set_default_color(Color.CRIMSON)
|
||||||
|
redlist.append(line)
|
||||||
|
redlist.append(other_line)
|
||||||
|
else:
|
||||||
|
line.set_default_color(Color.WHITE)
|
||||||
|
if redlist.is_empty():
|
||||||
|
show_end_screen()
|
||||||
|
|
||||||
|
func detect_intersection(line1, line2):
|
||||||
|
var line1p1 = line1.get_point_position(0)
|
||||||
|
var line1p2 = line1.get_point_position(1)
|
||||||
|
var line2p1 = line2.get_point_position(0)
|
||||||
|
var line2p2 = line2.get_point_position(1)
|
||||||
|
var p0_x = line1p1.x
|
||||||
|
var p0_y = line1p1.y
|
||||||
|
var p1_x = line1p2.x
|
||||||
|
var p1_y = line1p2.y
|
||||||
|
var p2_x = line2p1.x
|
||||||
|
var p2_y = line2p1.y
|
||||||
|
var p3_x = line2p2.x
|
||||||
|
var p3_y = line2p2.y
|
||||||
|
if line1p1 != line2p1 and line1p1 != line2p2:
|
||||||
|
if line1p2 != line2p1 and line1p2 != line2p2:
|
||||||
|
var s1_x = p1_x - p0_x
|
||||||
|
var s1_y = p1_y - p0_y
|
||||||
|
var s2_x = p3_x - p2_x
|
||||||
|
var s2_y = p3_y - p2_y
|
||||||
|
var s = (-s1_y * (p0_x - p2_x) + s1_x * (p0_y - p2_y)) / (-s2_x * s1_y + s1_x * s2_y)
|
||||||
|
var t = (s2_x * (p0_y - p2_y) - s2_y * (p0_x - p2_x)) / (-s2_x * s1_y + s1_x * s2_y)
|
||||||
|
if s >= 0 and s <= 1 and t >= 0 and t <= 1:
|
||||||
|
#var debug_x = p0_x + (t * s1_x)
|
||||||
|
#var debug_y = p0_y + (t * s1_y)
|
||||||
|
#print( debug_x, debug_y )
|
||||||
|
#place_debug_marker(debug_x, debug_y)
|
||||||
|
return true
|
||||||
|
return false
|
||||||
|
|
||||||
|
func show_end_screen():
|
||||||
|
$"../canvas/end_screen".show()
|
||||||
|
for child in $"../canvas/end_screen".get_children():
|
||||||
|
child.show()
|
||||||
|
|
||||||
|
func hide_end_screen():
|
||||||
|
$"../canvas/end_screen".hide()
|
||||||
|
for child in $"../canvas/end_screen".get_children():
|
||||||
|
child.hide()
|
||||||
|
|
||||||
|
func _on_button_pressed():
|
||||||
|
hide_end_screen()
|
||||||
|
new_game()
|
||||||
|
|
||||||
|
#func place_debug_marker(x, y):
|
||||||
|
#var debug_marker = debug_marker_node.instantiate()
|
||||||
|
#debug_marker.set_global_position(Vector2(x, y))
|
||||||
|
#$"../canvas/debug_markers".add_child(debug_marker)
|
||||||
|
|
||||||
|
##stolen from
|
||||||
|
##https://code.whatever.social/questions/
|
||||||
|
##563198/how-do-you-detect-where-two-line-segments-intersect#15001181
|
||||||
|
#func detect_intersection(line1, line2):
|
||||||
|
#var x1 = line1.get_point_position(0).x
|
||||||
|
#var y1 = line1.get_point_position(0).y
|
||||||
|
#var x2 = line1.get_point_position(1).x
|
||||||
|
#var y2 = line1.get_point_position(1).y
|
||||||
|
#var x3 = line2.get_point_position(0).x
|
||||||
|
#var y3 = line2.get_point_position(0).y
|
||||||
|
#var x4 = line2.get_point_position(1).x
|
||||||
|
#var y4 = line2.get_point_position(1).y
|
||||||
|
#if x1 == x2:
|
||||||
|
#var x1x2 = (x3 == x4 and x1 != x3)
|
||||||
|
#print(x1x2)
|
||||||
|
#return x1x2
|
||||||
|
#elif x3 == x4:
|
||||||
|
#return true
|
||||||
|
#else:
|
||||||
|
#var m1 = (y1-y2)/(x1-x2)
|
||||||
|
#var m2 = (y3-y4)/(x3-x4)
|
||||||
|
#return m1 != m2
|
||||||
|
|
||||||
|
|
||||||
|
##stolen from https://gist.github.com/kylemcdonald/6132fc1c29fd3767691442ba4bc84018
|
||||||
|
## intersection between line(p1, p2) and line(p3, p4)
|
||||||
|
##func intersect(p1, p2, p3, p4):
|
||||||
|
#func detect_intersection(line1, line2):
|
||||||
|
#var line1point1 = line1.get_point_position(0)
|
||||||
|
#var line1point2 = line1.get_point_position(1)
|
||||||
|
#var line2point1 = line2.get_point_position(0)
|
||||||
|
#var line2point2 = line2.get_point_position(1)
|
||||||
|
#var x1 = line1point1.x
|
||||||
|
#var y1 = line1point1.y
|
||||||
|
#var x2 = line1point2.x
|
||||||
|
#var y2 = line1point2.y
|
||||||
|
#var x3 = line2point1.x
|
||||||
|
#var y3 = line2point1.y
|
||||||
|
#var x4 = line2point2.x
|
||||||
|
#var y4 = line2point2.y
|
||||||
|
#var denom = (y4-y3)*(x2-x1) - (x4-x3)*(y2-y1)
|
||||||
|
#print("denom: ", denom)
|
||||||
|
#if denom == 0: # parallel
|
||||||
|
#return false
|
||||||
|
#var ua = ((x4-x3)*(y1-y3) - (y4-y3)*(x1-x3)) / denom
|
||||||
|
#print("ua: ", ua)
|
||||||
|
#if ua < 0 or ua > 1: # out of range
|
||||||
|
#return false
|
||||||
|
#var ub = ((x2-x1)*(y1-y3) - (y2-y1)*(x1-x3)) / denom
|
||||||
|
#print("ub: ", ub)
|
||||||
|
#if ub < 0 or ub > 1: # out of range
|
||||||
|
#return false
|
||||||
|
#var x = x1 + ua * (x2-x1)
|
||||||
|
#var y = y1 + ua * (y2-y1)
|
||||||
|
#var result = [x, y]
|
||||||
|
#print("result: ", result)
|
||||||
|
#return result
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
signal raised
|
||||||
|
|
||||||
|
var attached_lines = {}
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
set_process_input(false)
|
||||||
|
|
||||||
|
func add_line(line, point_index):
|
||||||
|
attached_lines[line] = point_index
|
||||||
|
|
||||||
|
func _input(event):
|
||||||
|
if event is InputEventMouseMotion:
|
||||||
|
set_global_position(event.position)
|
||||||
|
move_lines()
|
||||||
|
|
||||||
|
func move_lines():
|
||||||
|
for line in attached_lines.keys():
|
||||||
|
line.set_point_position(attached_lines[line],self.position)
|
||||||
|
|
||||||
|
func _on_button_button_down():
|
||||||
|
#set_process(true)
|
||||||
|
set_process_input(true)
|
||||||
|
|
||||||
|
func _on_button_button_up():
|
||||||
|
emit_signal("raised")
|
||||||
|
set_process_input(false)
|
|
@ -0,0 +1,39 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://cgdxswph767d3"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://game/objects/circle/circle.gd" id="1_lyp2m"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_gmjcy"]
|
||||||
|
radius = 65.123
|
||||||
|
|
||||||
|
[node name="circle" type="Node2D"]
|
||||||
|
script = ExtResource("1_lyp2m")
|
||||||
|
|
||||||
|
[node name="Line2D" type="Line2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
scale = Vector2(0.515642, 0.515642)
|
||||||
|
points = PackedVector2Array(-1, -59, -39, -42, -59, 0, -39, 40, 0, 59, 42, 40, 58, 4, 43, -39, -1, -59)
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
scale = Vector2(0.508857, 0.508857)
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||||
|
shape = SubResource("CircleShape2D_gmjcy")
|
||||||
|
|
||||||
|
[node name="Button" type="Button" parent="."]
|
||||||
|
offset_left = -50.0
|
||||||
|
offset_top = -50.0
|
||||||
|
offset_right = 50.0
|
||||||
|
offset_bottom = 50.0
|
||||||
|
|
||||||
|
[node name="index_label" type="Label" parent="."]
|
||||||
|
visible = false
|
||||||
|
offset_left = -45.0
|
||||||
|
offset_top = -55.0
|
||||||
|
offset_right = -8.0
|
||||||
|
offset_bottom = -13.0
|
||||||
|
scale = Vector2(2.26087, 2.26087)
|
||||||
|
text = "1"
|
||||||
|
|
||||||
|
[connection signal="button_down" from="Button" to="." method="_on_button_button_down"]
|
||||||
|
[connection signal="button_up" from="Button" to="." method="_on_button_button_up"]
|
|
@ -0,0 +1,6 @@
|
||||||
|
extends Line2D
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
width = 3
|
||||||
|
set_process(false)
|
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://cy1nem1r8fpil"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://game/objects/line/line.gd" id="1_wjhxv"]
|
||||||
|
|
||||||
|
[node name="Line" type="Line2D"]
|
||||||
|
script = ExtResource("1_wjhxv")
|
|
@ -0,0 +1 @@
|
||||||
|
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>
|
After Width: | Height: | Size: 950 B |
|
@ -0,0 +1,37 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://rpjk1pevop63"
|
||||||
|
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://icon.svg"
|
||||||
|
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
svg/scale=1.0
|
||||||
|
editor/scale_with_editor_scale=false
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
Binary file not shown.
|
@ -0,0 +1,21 @@
|
||||||
|
; Engine configuration file.
|
||||||
|
; It's best edited using the editor UI and not directly,
|
||||||
|
; since the parameters that go here are not all obvious.
|
||||||
|
;
|
||||||
|
; Format:
|
||||||
|
; [section] ; section goes between []
|
||||||
|
; param=value ; assign values to parameters
|
||||||
|
|
||||||
|
config_version=5
|
||||||
|
|
||||||
|
[application]
|
||||||
|
|
||||||
|
config/name="Knot"
|
||||||
|
run/main_scene="res://game/game.tscn"
|
||||||
|
config/features=PackedStringArray("4.2", "Mobile")
|
||||||
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
renderer/rendering_method="mobile"
|
||||||
|
textures/vram_compression/import_etc2_astc=true
|
Loading…
Reference in New Issue