first commit
This commit is contained in:
19
Balls/Ball.gd
Normal file
19
Balls/Ball.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
extends RigidBody2D
|
||||
|
||||
var held = false
|
||||
|
||||
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
if held:
|
||||
global_transform.origin = get_global_mouse_position()
|
||||
|
||||
|
||||
|
||||
|
||||
func drop(impulse=Vector2.ZERO):
|
||||
if held:
|
||||
mode = RigidBody2D.MODE_RIGID
|
||||
apply_central_impulse(impulse)
|
||||
held = false
|
||||
27
Balls/Ball.tscn
Normal file
27
Balls/Ball.tscn
Normal file
@@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://Art/Extra02.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Balls/Ball.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id=2]
|
||||
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 9.5
|
||||
|
||||
[node name="Ball" type="RigidBody2D" groups=[
|
||||
"Balls",
|
||||
]]
|
||||
collision_layer = 15
|
||||
collision_mask = 4
|
||||
physics_material_override = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
scale = Vector2( 0.560606, 0.560606 )
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
scale = Vector2( 2, 2 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[connection signal="input_event" from="." to="." method="_on_Ball_input_event"]
|
||||
Reference in New Issue
Block a user