This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

enter image description here

(Sorry for my bad english)

I have this problem when im tring to create or delate a child item node, the entire frame seems to flicker for an instance before returning to normal, im using Node2D for items and slots, i notice is only when adding and fleeling , anyone know why?

Here is some of the script

func add_to_inventory(item_id:String,amount:int):
var on_inventory=false
for child in get_child_count():
    if(!get_child(child).is_empty):
        var item_amount=get_child(child).get_child(get_child(child).get_child_count()-1).amount
        var item_max_amount=get_child(child).get_child(get_child(child).get_child_count()-1).max_stack
        if(item_id==get_child(child).item_id&&item_amount<item_max_amount):
            if(item_amount+amount>item_max_amount):
                var overload=item_amount+amount
                overload-=item_max_amount
                var to_add=amount-overload
                amount=to_add
                fix_overload=overload
                add_overload=true
                overload_id=item_id
            on_inventory=true
            get_child(child).get_child(get_child(child).get_child_count()-1).change_amount(amount)
            break
if(!on_inventory):
    for child in get_child_count():
        if(get_child(child).is_empty):
            var item=item_template.instance()
            item.init(item_id,amount)
            item.position=get_child(child).get_child(get_child(child).get_child_count()-1).position
            get_child(child).is_empty=false
            get_child(child).item_id=item_id
            get_child(child).add_child(item)
            break
if(add_overload):
    add_overload=false
    add_to_inventory(overload_id,fix_overload)
in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.