Coding a created object


Sorry if this has been answered in a tutorial or on the forum … I have
searched but could not find the answer !

I am working with a class who want to create a “jungle” so they want
to add elephants, etc using code. We added an elephant using the Blockly
“create” block and gave him a name of “Fred”. But we cannot then use
“Fred” in any of the other blocks … for example “transitions” if we
wanted to make him walk around.

Thanks for any help you can give …


Hi focusedu,

Create block (second one in the list) returns new created item. Store that item in a variable (see “Variables” section) and then, when you want to apply a transition to this item, attach this variable block to your transition.


Thank you. Worked perfectly ! We have a herd of elephants beginning to appear. For some reason one of them rises in the air when you activate him … I must ask the class why :slight_smile: