All,
What is considered the best practice when handling events that have parameters?
My use case is handling the event when a player breaks a block in Minecraft. The event has the player and the block supplied as parameters.
I imagine a (hypothetical via Photoshop) block that looks like the following image that allows the user to drag the "Player" and "Block" supply blocks from their supply containers into their program
This would generate code akin to this:
events.onBlockBreak(function(player, block) {
});
One might imagine code eventually looking like this:
events.onBlockBreak(function(player, block) {
if (block.type == "dirt") {
block.location = new Block('TNT');
}
});
I know i could add new blockly field which could act as the"supply" area but is there a better way to handle events that have parameters?
Thanks,
Blake