![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | codelyoko373 |
I’m fairly new to GDScript so I apologize if this is something super obvious that I’ve missed haha.
I’m basically working on a system where a player can mine a block. Each block has a Block script that has a function to “mine” itself. I’m wanting to call that from the players script when they presses a button but I can’t figure out a way to pass a object (being the block) as a parameter to a function. Can’t figure out as in I don’t know which variable I should be declaring the parameter as when writing the side function.
func MineBlock(direction : Vector2, block : Block <--- ?????):
if direction.x == -1:
ChangeAnimation("Mine", true);
else:
ChangeAnimation("Mine", false);
pass