| @@ -0,0 +1,3 @@ | |||
| source_md5="47313fa4c47a9963fddd764e1ec6e4a8" | |||
| dest_md5="2ded9e7f9060e2b530aab678b135fc5b" | |||
| @@ -0,0 +1,46 @@ | |||
| [gd_scene load_steps=8 format=2] | |||
| [ext_resource path="res://Data/Scripts/Controller.gd" type="Script" id=1] | |||
| [sub_resource type="CircleShape2D" id=1] | |||
| [sub_resource type="Gradient" id=2] | |||
| offsets = PoolRealArray( 0, 0.311111, 0.496296, 0.62963, 1 ) | |||
| colors = PoolColorArray( 0.420845, 0.474609, 0, 1, 0.419535, 0.525651, 0, 1, 0.474609, 0.399068, 0.157585, 1, 0.418193, 0.577908, 0, 1, 0.416634, 0.638672, 0, 1 ) | |||
| [sub_resource type="GradientTexture" id=3] | |||
| gradient = SubResource( 2 ) | |||
| [sub_resource type="Curve" id=4] | |||
| _data = [ Vector2( 0, 1 ), 0.0, 0.219234, 0, 0, Vector2( 1, 0.559091 ), -0.228985, 0.0, 0, 0 ] | |||
| [sub_resource type="CurveTexture" id=5] | |||
| curve = SubResource( 4 ) | |||
| [sub_resource type="ParticlesMaterial" id=6] | |||
| lifetime_randomness = 0.28 | |||
| emission_shape = 1 | |||
| emission_sphere_radius = 10.0 | |||
| flag_disable_z = true | |||
| gravity = Vector3( 0, 0, 0 ) | |||
| initial_velocity = 0.25 | |||
| initial_velocity_random = 1.0 | |||
| orbit_velocity = 0.0 | |||
| orbit_velocity_random = 0.0 | |||
| radial_accel = -10.0 | |||
| radial_accel_random = 0.54 | |||
| damping = 12.0 | |||
| damping_random = 0.41 | |||
| scale = 4.0 | |||
| scale_curve = SubResource( 5 ) | |||
| color_ramp = SubResource( 3 ) | |||
| [node name="Player" type="RigidBody2D"] | |||
| script = ExtResource( 1 ) | |||
| [node name="CollisionShape2D" type="CollisionShape2D" parent="."] | |||
| shape = SubResource( 1 ) | |||
| [node name="Particles" type="Particles2D" parent="."] | |||
| amount = 100 | |||
| process_material = SubResource( 6 ) | |||
| @@ -0,0 +1,66 @@ | |||
| [gd_scene load_steps=4 format=2] | |||
| [ext_resource path="res://icon.png" type="Texture" id=1] | |||
| [ext_resource path="res://Data/Objects/Player.tscn" type="PackedScene" id=2] | |||
| [sub_resource type="RectangleShape2D" id=1] | |||
| extents = Vector2( 32, 32 ) | |||
| [node name="World" type="Node2D"] | |||
| [node name="Ground" type="Node2D" parent="."] | |||
| [node name="StaticBody2D" type="StaticBody2D" parent="Ground"] | |||
| position = Vector2( 60.061, 218.684 ) | |||
| [node name="CollisionShape2D" type="CollisionShape2D" parent="Ground/StaticBody2D"] | |||
| shape = SubResource( 1 ) | |||
| [node name="Sprite" type="Sprite" parent="Ground/StaticBody2D"] | |||
| self_modulate = Color( 0, 0, 0, 1 ) | |||
| texture = ExtResource( 1 ) | |||
| [node name="StaticBody2D2" type="StaticBody2D" parent="Ground"] | |||
| position = Vector2( 117.555, 225.357 ) | |||
| [node name="CollisionShape2D" type="CollisionShape2D" parent="Ground/StaticBody2D2"] | |||
| shape = SubResource( 1 ) | |||
| [node name="Sprite" type="Sprite" parent="Ground/StaticBody2D2"] | |||
| self_modulate = Color( 0, 0, 0, 1 ) | |||
| texture = ExtResource( 1 ) | |||
| [node name="StaticBody2D3" type="StaticBody2D" parent="Ground"] | |||
| position = Vector2( 165.809, 209.444 ) | |||
| [node name="CollisionShape2D" type="CollisionShape2D" parent="Ground/StaticBody2D3"] | |||
| shape = SubResource( 1 ) | |||
| [node name="Sprite" type="Sprite" parent="Ground/StaticBody2D3"] | |||
| self_modulate = Color( 0, 0, 0, 1 ) | |||
| texture = ExtResource( 1 ) | |||
| [node name="StaticBody2D4" type="StaticBody2D" parent="Ground"] | |||
| position = Vector2( 352.586, 167.485 ) | |||
| [node name="CollisionShape2D" type="CollisionShape2D" parent="Ground/StaticBody2D4"] | |||
| shape = SubResource( 1 ) | |||
| [node name="Sprite" type="Sprite" parent="Ground/StaticBody2D4"] | |||
| self_modulate = Color( 0, 0, 0, 1 ) | |||
| texture = ExtResource( 1 ) | |||
| [node name="StaticBody2D5" type="StaticBody2D" parent="Ground"] | |||
| position = Vector2( 258.724, 168.376 ) | |||
| rotation = -0.303533 | |||
| scale = Vector2( 2.16, 0.400001 ) | |||
| [node name="CollisionShape2D" type="CollisionShape2D" parent="Ground/StaticBody2D5"] | |||
| shape = SubResource( 1 ) | |||
| [node name="Sprite" type="Sprite" parent="Ground/StaticBody2D5"] | |||
| self_modulate = Color( 0, 0, 0, 1 ) | |||
| texture = ExtResource( 1 ) | |||
| [node name="Player" parent="." instance=ExtResource( 2 )] | |||
| position = Vector2( 60.9594, 47.3045 ) | |||
| @@ -0,0 +1,68 @@ | |||
| extends RigidBody2D | |||
| export var max_distance = 64 | |||
| export var max_tangential_accel = 32 | |||
| export var max_travel_time = 2.0 | |||
| export var push_force = 128 | |||
| var body_radius = 0 | |||
| var mouse_position = Vector2.ZERO | |||
| var mouse_down = false | |||
| var push = false | |||
| var traveling = 0; | |||
| # Called when the node enters the scene tree for the first time. | |||
| func _ready(): | |||
| set_process(true) | |||
| set_physics_process(true) | |||
| set_process_input(true) | |||
| body_radius = $CollisionShape2D.shape.radius | |||
| func _input(event): | |||
| if event is InputEventMouseMotion: | |||
| mouse_position = event.position | |||
| if Input.is_action_just_pressed("ButtonA"): | |||
| mouse_down = true | |||
| elif Input.is_action_just_released("ButtonA"): | |||
| mouse_down = false | |||
| push = true | |||
| func _physics_process(delta): | |||
| if mouse_down: | |||
| return # We don't follow the mouse or move the squiq when mouse is down. | |||
| var distance = clamp(mouse_position.x - position.x, -max_distance, max_distance) | |||
| var dpercent = abs(distance / max_distance) | |||
| if push: | |||
| push = false | |||
| traveling = max_travel_time | |||
| var v_direction = (position - mouse_position).normalized() | |||
| apply_central_impulse(v_direction * dpercent * push_force) | |||
| elif traveling > 0: | |||
| traveling -= delta | |||
| else: | |||
| if abs(distance) > body_radius: | |||
| $Particles.process_material.tangential_accel = dpercent * max_tangential_accel; | |||
| apply_central_impulse(Vector2(distance * delta, 0)) | |||
| else: | |||
| $Particles.process_material.tangential_accel = 0 | |||
| func _process(delta): | |||
| update() | |||
| func _draw(): | |||
| if mouse_down: | |||
| var distance = min(position.distance_to(mouse_position), max_distance) | |||
| var v_direction = (position - mouse_position).normalized().rotated(-rotation) | |||
| var v_start = v_direction * body_radius | |||
| var v_end = v_direction * distance | |||
| var v_tipA = v_end - (v_direction.rotated(deg2rad(30)) * min(distance, 16)) | |||
| var v_tipB = v_end - (v_direction.rotated(-deg2rad(30)) * min(distance, 16)) | |||
| var c_line = Color(0.25, 1.0, 0.0) | |||
| draw_line(v_start, v_end, c_line) | |||
| draw_line(v_end, v_tipA, c_line) | |||
| draw_line(v_end, v_tipB, c_line) | |||
| @@ -0,0 +1,7 @@ | |||
| [gd_resource type="Environment" load_steps=2 format=2] | |||
| [sub_resource type="ProceduralSky" id=1] | |||
| [resource] | |||
| background_mode = 2 | |||
| background_sky = SubResource( 1 ) | |||
| @@ -0,0 +1,34 @@ | |||
| [remap] | |||
| importer="texture" | |||
| type="StreamTexture" | |||
| path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" | |||
| metadata={ | |||
| "vram_texture": false | |||
| } | |||
| [deps] | |||
| source_file="res://icon.png" | |||
| dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] | |||
| [params] | |||
| compress/mode=0 | |||
| compress/lossy_quality=0.7 | |||
| compress/hdr_mode=0 | |||
| compress/bptc_ldr=0 | |||
| compress/normal_map=0 | |||
| flags/repeat=0 | |||
| flags/filter=true | |||
| flags/mipmaps=false | |||
| flags/anisotropic=false | |||
| flags/srgb=2 | |||
| process/fix_alpha_border=true | |||
| process/premult_alpha=false | |||
| process/HDR_as_SRGB=false | |||
| process/invert_color=false | |||
| stream=false | |||
| size_limit=0 | |||
| detect_3d=true | |||
| svg/scale=1.0 | |||
| @@ -0,0 +1,45 @@ | |||
| ; 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=4 | |||
| _global_script_classes=[ ] | |||
| _global_script_class_icons={ | |||
| } | |||
| [application] | |||
| config/name="Anchored" | |||
| run/main_scene="res://Data/Scenes/World.tscn" | |||
| config/icon="res://icon.png" | |||
| [input] | |||
| ButtonA={ | |||
| "deadzone": 0.5, | |||
| "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"unicode":0,"echo":false,"script":null) | |||
| , Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null) | |||
| ] | |||
| } | |||
| ButtonB={ | |||
| "deadzone": 0.5, | |||
| "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":88,"unicode":0,"echo":false,"script":null) | |||
| , Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":2,"pressed":false,"doubleclick":false,"script":null) | |||
| ] | |||
| } | |||
| [layer_names] | |||
| 2d_physics/layer_1="Anchors" | |||
| 2d_physics/layer_2="Ground" | |||
| 2d_physics/layer_3="Tether" | |||
| [rendering] | |||
| environment/default_environment="res://default_env.tres" | |||