mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-12-22 20:32:38 +01:00
Set center of gravity correctly when shrinking Nodes Control
This commit is contained in:
parent
47f412d3d8
commit
a083e6a1da
3 changed files with 7 additions and 6 deletions
2
arrow.gd
2
arrow.gd
|
@ -15,7 +15,7 @@ func _process(_delta):
|
|||
position = Vector2(0,0)
|
||||
|
||||
var start = repository.objects[source].position
|
||||
var end = start + Vector2(0, 30)
|
||||
var end = start + Vector2(0, 60)
|
||||
|
||||
if repository and repository.objects.has(target) and repository.objects[target].visible:
|
||||
var t = repository.objects[target]
|
||||
|
|
|
@ -47,10 +47,10 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="Target" type="Label" parent="."]
|
||||
margin_left = -229.024
|
||||
margin_top = 63.3118
|
||||
margin_right = 232.976
|
||||
margin_bottom = 89.3118
|
||||
margin_left = -230.84
|
||||
margin_top = 42.1225
|
||||
margin_right = 231.16
|
||||
margin_bottom = 68.1225
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
custom_colors/font_color = Color( 0.356863, 0.356863, 0.356863, 1 )
|
||||
text = "label"
|
||||
|
|
|
@ -142,7 +142,8 @@ func apply_forces():
|
|||
var f = 2000/pow(d+0.00001,1.5)
|
||||
o.position += dir*f
|
||||
o2.position -= dir*f
|
||||
var center_of_gravity = rect_size/2
|
||||
var center_of_gravity = nodes.rect_size/2
|
||||
print(center_of_gravity)
|
||||
var d = o.position.distance_to(center_of_gravity)
|
||||
var dir = (o.position - center_of_gravity).normalized()
|
||||
var f = (d+0.00001)*Vector2(0.03, 0.01)
|
||||
|
|
Loading…
Reference in a new issue