Fixed Item Alignment
This commit is contained in:
parent
5fe2772097
commit
bb0fda15d4
5 changed files with 11 additions and 4 deletions
|
|
@ -14,7 +14,7 @@ void vertex()
|
|||
location = ivec2(128. * COLOR.xy);
|
||||
dimension = ivec2(128. * COLOR.zw);
|
||||
|
||||
vec2 myloc = vec2(location) + UV * (vec2(dimension) + vec2(0., .5));
|
||||
vec2 myloc = vec2(location) + UV * (vec2(dimension) + vec2(0., .7)) - vec2(0, .2);
|
||||
float angle = float(myloc.x) * TAU / 60.;
|
||||
float height = float(myloc.y) * cell_height + ground_height;
|
||||
VERTEX = vec2(cos(angle), sin(angle)) * height;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://b00185vygcka1"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://b00185vygcka1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b43fudwi47qfd" path="res://items/heal_item.gd" id="1_3vbv8"]
|
||||
[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="2_48lih"]
|
||||
[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="2_evqwq"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_hvhjo"]
|
||||
|
||||
[node name="HealItem" type="Area2D"]
|
||||
script = ExtResource("1_3vbv8")
|
||||
|
||||
[node name="EarthAligner" parent="." instance=ExtResource("2_evqwq")]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
scale = Vector2(7, 7)
|
||||
shape = SubResource("CircleShape2D_hvhjo")
|
||||
|
|
|
|||
|
|
@ -34,5 +34,5 @@ func _ready():
|
|||
pool.remove_at(index)
|
||||
var object = packed_scene.instantiate()
|
||||
add_child.call_deferred(object)
|
||||
object.reparent(get_parent())
|
||||
object.reparent.call_deferred(get_parent())
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,12 @@ var angle = 0
|
|||
|
||||
func _ready() -> void:
|
||||
parent = get_parent()
|
||||
align()
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
align()
|
||||
|
||||
func align():
|
||||
angle = -(parent.position - center).angle_to(Vector2.UP)
|
||||
parent.rotation = angle;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://chs0u61f45nau"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ciehyjlxjvrvb" path="res://earth_aligner.gd" id="1_sx2xq"]
|
||||
[ext_resource type="Script" uid="uid://ciehyjlxjvrvb" path="res://utils/earth_aligner.gd" id="1_sx2xq"]
|
||||
|
||||
[node name="EarthAligner" type="Node2D"]
|
||||
script = ExtResource("1_sx2xq")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue