0 votes
func place():
print("place")
$Sprite/AnimationPlayer.current_animation="idle"
placing = false
Level.set_grid_position(("pad" if Pad else "plant"),tile_pos.y,tile_pos.x,ObjectIndex,Plant,null)
GlobalScript.emit_signal("_on_plant_planted",tile_pos.x,tile_pos.y,origin_button)

This i supposed to print place, it is called by

func _input(event: InputEvent) -> void:
if event.is_action_pressed("lmb"):
    if placing:
        if get_tile_access(tile_pos.y,tile_pos.x):
            print("We're calling the function place but yet it's isn't printing 'place'. Why could that be?")
            place()
        else:
            GlobalScript.emit_signal("_failed_plant_placement")
            queue_free()

Since it also should calls this, shouldn't this print too?

func set_grid_position(type:String,row:int,collumn:int,value:int,id:String,data: Dictionary):
print("aha!",type," ",value," ",id)
if type=="pad":
    spgrid[row][collumn]=value
    padgrid[row][collumn]=id
elif type=="plant":
    objgrid[row][collumn]=value
    plantgrid[row][collumn]=id
    print(objgrid[row][collumn]," ",plantgrid[row][collumn])
elif type=="griditem":
    objgrid[row][collumn]=value
    itemgrid[row][collumn]=id
    itemgriddata[row][collumn]=data

None of these, except the input(), print anything. However i do know that the place() function is called because the animation does change to idle and the placing does disable. I, however, am unsure whether setgrid_position() is being called.
*Functions have been slightly adjusted but nothing is printed.
fixed don't answer im extremely dumb

Godot version 3.2.3 stable
in Engine by (40 points)

Please prevent others from making the same mistake.
How did you solve your problem?

1 Answer

0 votes
Best answer

Problem was my carelessness. Script inherited from this script had a separate place function, which i didn't change, and thus it didn't execute setgridposition. Sorry about that.

by (40 points)
selected by

Always check inhrited objects if you have "make sub resources unique" enabled :)

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 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 webmaster@godotengine.org with your username.