many small changes, and few big ones

This commit is contained in:
ChaoticByte 2024-10-16 20:23:53 +02:00
parent e8985f4e79
commit a3ca623258
No known key found for this signature in database
32 changed files with 391 additions and 247 deletions

View file

@ -0,0 +1,14 @@
extends RigidBody2D
@export var demolition_minmax: float = 0.1
func _ready() -> void:
var p: P = $P
for i in range(len(p.polygon)):
p.polygon[i].x = p.polygon[i].x * randf_range(1.0-demolition_minmax, 1.0+demolition_minmax)
p.polygon[i].y = p.polygon[i].y * randf_range(1.0-demolition_minmax, 1.0+demolition_minmax)
p.update_polygon()
# make visible polygon a bit bigger than collision polygon
for i in range(len(p.polygon_2d.polygon)):
p.polygon_2d.polygon[i].x += sign(p.polygon[i].x) # make bigger by 1 pixel
p.polygon_2d.polygon[i].y += sign(p.polygon[i].y)

View file

@ -0,0 +1,11 @@
[gd_scene load_steps=3 format=3 uid="uid://cylmgbhvpdexh"]
[ext_resource type="Script" path="res://core/polygon/polygon.gd" id="1_m3p7r"]
[ext_resource type="Script" path="res://reusable/aged_box/aged_box.gd" id="1_ul3hr"]
[node name="AgedBox" type="RigidBody2D"]
script = ExtResource("1_ul3hr")
[node name="P" type="CollisionPolygon2D" parent="."]
polygon = PackedVector2Array(-8, -8, -8, 8, 8, 8, 8, -8)
script = ExtResource("1_m3p7r")