Code to use later
func _ready():
# Create the CollisionShape2D node
collisionShape = CollisionShape2D.new()
collisionShape.name = "CollisionShape2D"
add_child(collisionShape)
# Create a RectangleShape2D for the collision shape
var shape = RectangleShape2D.new()
shape.extents = collisionBoxSize / 2
# Assign the shape to the CollisionShape2D
collisionShape.shape = shape
# Set the initial position of the CollisionShape2D
collisionShape.position = Vector2(0, 0) # Adjust the initial position as needed
animated_sprite_2d.position = Vector2(0,-20)
# Set the material color of the CollisionShape2D
# Set the color of the ColorRect
var colorRect = ColorRect.new()
colorRect.color = collisionBoxColor
Comments
Post a Comment