Skip to main content
2 of 2
Grammar and punctuation, removed redundancy
Gnemlock
  • 5.3k
  • 5
  • 28
  • 59

How do I decrease the scale of an instanced node or scene?

I'm trying to decrease size of instanced RigidBody2D scene, through code. With scale(), I'm trying to decrease the size of the image/sprite that's attached to the RigidBody2D. The problem is, it's not working.

No matter how much I try to scale down, the size of the blood drop circle remains the same.


const blood_druple_scn = preload("res://Scenes/blood.tscn")

func spawnBlood():
    var newBlood = Blood_druple_scn.instance()
    
    rotationAdd = rotationAdd + 30
    
    if(switchBloodSize == 0):
        set_scale(Vector2(2,1)) //This part is my problem
        print("blood size: ", newBlood.get_scale())
        add_child(newBlood)
        switchBloodSize = 1
    
    elif(switchBloodSize == 1):
        newBlood.scale(Vector2(0.5,0.5)) //This part is my problem
        print("Blood size: ", newBlood.get_scale())
        add_child(newBlood)
        switchBloodSize = 0
    
    newBlood.set_pos(Vector2(100,100))
    rotate(rotationAdd)

As you can see, I have two different if conditions, each with a different scale() and size. Sadly, both remain the same size. The strange part is that it does display the scale values as been altered, yet the newBlood instance is not visually changing. Why is this?

Kil'jaeden
  • 141
  • 1
  • 3