Events Blocks
Event Handlers
{"func":"registerFlagTrigger"}
On Start
"On Start" is an event block that will activate when the start button is clicked.
Parameters:
None.
Related Blocks:
{"func":"registerKeyTrigger"},
{"func":"registerSpriteTrigger"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockLooksSetBubble","values":[{"type":"choice","value":"rectangular"}],"next":{"func":"blockLooksSayFor","values":[{"type":"string","value":"hello world"},{"type":"number","value":"2"}]}}}
Add to my Backpack
{"func":"registerSpriteTrigger"}
When Actor Clicked
"When Actor Clicked" is an event block that activates when the Actor is clicked on with the mouse.
Parameters:
None.
Related Blocks:
{"func":"registerFlagTrigger"},
{"func":"registerKeyTrigger"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteTrigger","next":{"func":"blockSoundPlayUntilDone","values":[{"type":"string","value":"female laugh"}]}}
Add to my Backpack
{"func":"registerKeyTrigger"}
When Key Pressed
"When Key Pressed" is an event block that activates when the selected key is pressed.
Parameters:
Key: This parameter indicates the key that this method will listen for (up arrow, down arrow, etc).
Related Blocks:
{"func":"registerFlagTrigger"},
{"func":"registerSpriteTrigger"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerKeyTrigger","values":[{"type":"choice","value":"right arrow"}],"next":{"func":"blockMotionPointTowards","values":[{"type":"string","value":"right edge"}],"next":{"func":"blockMotionMove","values":[{"type":"number","value":"5"}]}}}
Add to my Backpack
{"func":"registerBroadcastTrigger"}
When I Receive
"When I Receive" is an event block that listens for a broadcast or message from other scripts before activating.
Parameters:
Message: This parameter should be the name of some message that is broadcasted in a "broadcast" block or "send message" block. When either of those blocks send the message, this block will activate.
Related Blocks:
{"func":"blockControlPostMessage"},
{"func":"blockControlPostMessageAndWait"},
{"func":"valueControlMessageValue"},
{"func":"valueControlMessageSource"},
{"func":"blockControlBroadcast"}
Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"game over"}],"next":{"func":"blockLooksHide"}}
Add to my Backpack
{"func":"registerBackgroundChange"}
When Background Switches
"When Background Switches" is an event block that activates when scene switches to the indicated scene.
Parameters:
Background: When your background switches to this scene, this code block will activate. You can choose "any" as the parameter if you want the code block to activate whenever the scene changes, regardless of the new scene.
Related Blocks:
{"func":"blockLooksSwitchBackground"},
{"func":"blockLooksNextBackground"},
{"func":"blockLooksFirstBackgroundInGroup"}
Sample Code:
{"func":"registerBackgroundChange","values":[{"type":"string","value":"game over"}],"next":{"func":"blockSoundPlay","values":[{"type":"string","value":"gamesound8"}]}}
Add to my Backpack
{"func":"registerFlagTrigger"}
Inicio
"Inicio" es un bloque de eventos que se activa cuando se presiona el botón de inicio.
Parameters:
Ninguno.
Related Blocks:
{"func":"registerKeyTrigger"},
{"func":"registerSpriteTrigger"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockLooksSetBubble","values":[{"type":"choice","value":"rectangular"}],"next":{"func":"blockLooksSayFor","values":[{"type":"string","value":"hello world"},{"type":"number","value":"2"}]}}}
Add to my Backpack
{"func":"registerSpriteTrigger"}
Al tocar al actor
"Al tocar al actor" es un bloque de eventos que se activa cuando se toca al actor.
Parameters:
Ninguno.
Related Blocks:
{"func":"registerFlagTrigger"},
{"func":"registerKeyTrigger"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteTrigger","next":{"func":"blockSoundPlayUntilDone","values":[{"type":"string","value":"female laugh"}]}}
Add to my Backpack
{"func":"registerKeyTrigger"}
Al presionar
"Al presionar" es un bloque de eventos que se activa cuando se presiona la tecla seleccionada.
Parameters:
Tecla: este parámetro indica la tecla que este parámetro espera que se presione (flecha arriba, flecha abajo, etc.)
Related Blocks:
{"func":"registerFlagTrigger"},
{"func":"registerSpriteTrigger"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerKeyTrigger","values":[{"type":"choice","value":"right arrow"}],"next":{"func":"blockMotionPointTowards","values":[{"type":"string","value":"right edge"}],"next":{"func":"blockMotionMove","values":[{"type":"number","value":"5"}]}}}
Add to my Backpack
{"func":"registerBroadcastTrigger"}
Cuando yo reciba
"Cuando yo reciba" es un bloque de eventos que espera hasta recibir una transmisión o mensaje de otras secuencias de comandos antes de activarse.
Parameters:
Mensaje: este parámetro es el nombre de un mensaje transmitido en un bloque "transmitir" o en un bloque "enviar mensaje". Cuando uno de esos bloques envíe el mensaje, se activará este bloque.
Related Blocks:
{"func":"blockControlPostMessage"},
{"func":"blockControlPostMessageAndWait"},
{"func":"valueControlMessageValue"},
{"func":"valueControlMessageSource"},
{"func":"blockControlBroadcast"}
Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"game over"}],"next":{"func":"blockLooksHide"}}
Add to my Backpack
{"func":"registerTrigger"}
When Condition Occurs
"When Condition Occurs" is an event block that activates when the specified condition changes from the false state to the true state.
Parameters:
Condition: This parameter indicates the condition that will trigger this script.
Related Blocks:
{"func":"registerFlagTrigger"},
{"func":"registerSpriteTrigger"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"next":{"func":"blockLooksSayFor","values":[{"type":"string","value":"Click!"},{"type":"number","value":1}]}}
Add to my Backpack
{"func":"registerCloned"}
Clone Startup
"Clone Startup" runs the script after an Actor has been cloned.
Parameters:
None.
Related Blocks:
{"func":"blockControlCloneActor"},
{"func":"valueControlLastClonedActor"},
{"func":"blockControlDeleteActor"}
Sample Code:
{"func":"registerCloned","next":{"func":"blockControlForeverIf","values":[{"type":"wrapper","func":"valuevar","name":"playing"}],"containers":[{"func":"blockMotionMove","values":[{"type":"number","value":"10"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":"1"}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueOpRandom","values":[{"type":"number","value":"1"},{"type":"number","value":"10"}]},{"type":"string","value":"5"}]}],"containers":[{"func":"blockMotionTurnCW","values":[{"type":"string","value":"15"}]}]}}}]}}
Add to my Backpack
{"func":"registerBackgroundChange"}
Cuando el fondo cambie a
"Cuando el fondo cambie a" es un bloque de eventos que se activa cuando la escena cambia a la escena indicada.
Parameters:
Fondo: cuando el fondo cambie a esta escena, se activará este bloque de código. Si quieres que el bloque de código se active cada vez que cambie la escena, puedes elegir "cualquiera" como parámetro, sin importar cuál sea la nueva escena.
Related Blocks:
{"func":"blockLooksSwitchBackground"},
{"func":"blockLooksNextBackground"},
{"func":"blockLooksFirstBackgroundInGroup"}
Sample Code:
{"func":"registerBackgroundChange","values":[{"type":"string","value":"game over"}],"next":{"func":"blockSoundPlay","values":[{"type":"string","value":"gamesound8"}]}}
Add to my Backpack
{"func":"registerTrigger"}
Al ocurrir
"Al ocurrir" es un bloque de eventos que se activa cuando la condición especificada pasa del estado falso al estado verdadero.
Parameters:
Condición: este parámetro indica la condición que disparará esta secuencia de comandos.
Related Blocks:
{"func":"registerFlagTrigger"},
{"func":"registerSpriteTrigger"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"next":{"func":"blockLooksSayFor","values":[{"type":"string","value":"Click!"},{"type":"number","value":1}]}}
Add to my Backpack
{"func":"registerBroadcastTrigger"}
Cuando yo reciba
"Cuando yo reciba" es un bloque de eventos que espera hasta recibir una transmisión o mensaje de otras secuencias de comandos antes de activarse.
Parameters:
Mensaje: este parámetro es el nombre de un mensaje transmitido en un bloque "transmitir" o en un bloque "enviar mensaje". Cuando uno de esos bloques envíe el mensaje, se activará este bloque.
Related Blocks:
{"func":"blockControlPostMessage"},
{"func":"blockControlPostMessageAndWait"},
{"func":"valueControlMessageValue"},
{"func":"valueControlMessageSource"},
{"func":"blockControlBroadcast"}
Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"game over"}],"next":{"func":"blockLooksHide"}}
Add to my Backpack
{"func":"registerTrigger"}
Al ocurrir
"Al ocurrir" es un bloque de eventos que se activa cuando la condición especificada pasa del estado falso al estado verdadero.
Parameters:
Condición: este parámetro indica la condición que disparará esta secuencia de comandos.
Related Blocks:
{"func":"registerFlagTrigger"},
{"func":"registerSpriteTrigger"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"next":{"func":"blockLooksSayFor","values":[{"type":"string","value":"Click!"},{"type":"number","value":1}]}}
Add to my Backpack
{"func":"registerCloned"}
Comenzar luego del clonado
"Comenzar luego del clonado" ejecuta la secuencia de comandos una vez que el actor fue clonado.
Parameters:
Ninguno.
Related Blocks:
{"func":"blockControlCloneActor"},
{"func":"valueControlLastClonedActor"},
{"func":"blockControlDeleteActor"}
Sample Code:
{"func":"registerCloned","next":{"func":"blockControlForeverIf","values":[{"type":"wrapper","func":"valuevar","name":"playing"}],"containers":[{"func":"blockMotionMove","values":[{"type":"number","value":"10"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":"1"}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueOpRandom","values":[{"type":"number","value":"1"},{"type":"number","value":"10"}]},{"type":"string","value":"5"}]}],"containers":[{"func":"blockMotionTurnCW","values":[{"type":"string","value":"15"}]}]}}}]}}
Add to my Backpack
{"func":"registerBackgroundChange"}
Cuando el fondo cambie a
"Cuando el fondo cambie a" es un bloque de eventos que se activa cuando la escena cambia a la escena indicada.
Parameters:
Fondo: cuando el fondo cambie a esta escena, se activará este bloque de código. Si quieres que el bloque de código se active cada vez que cambie la escena, puedes elegir "cualquiera" como parámetro, sin importar cuál sea la nueva escena.
Related Blocks:
{"func":"blockLooksSwitchBackground"},
{"func":"blockLooksNextBackground"},
{"func":"blockLooksFirstBackgroundInGroup"}
Sample Code:
{"func":"registerBackgroundChange","values":[{"type":"string","value":"game over"}],"next":{"func":"blockSoundPlay","values":[{"type":"string","value":"gamesound8"}]}}
Add to my Backpack
{"func":"registerFlagTrigger"}
Inicio
"Inicio" es un bloque de eventos que se activa cuando se presiona el botón de inicio.
Parameters:
Ninguno.
Related Blocks:
{"func":"registerKeyTrigger"},
{"func":"registerSpriteTrigger"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockLooksSetBubble","values":[{"type":"choice","value":"rectangular"}],"next":{"func":"blockLooksSayFor","values":[{"type":"string","value":"hello world"},{"type":"number","value":"2"}]}}}
Add to my Backpack
{"func":"registerSpriteTrigger"}
Al tocar al actor
"Al tocar al actor" es un bloque de eventos que se activa cuando se toca al actor.
Parameters:
Ninguno.
Related Blocks:
{"func":"registerFlagTrigger"},
{"func":"registerKeyTrigger"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteTrigger","next":{"func":"blockSoundPlayUntilDone","values":[{"type":"string","value":"female laugh"}]}}
Add to my Backpack
{"func":"registerKeyTrigger"}
Al presionar
"Al presionar" es un bloque de eventos que se activa cuando se presiona la tecla seleccionada.
Parameters:
Tecla: este parámetro indica la tecla que este parámetro espera que se presione (flecha arriba, flecha abajo, etc.)
Related Blocks:
{"func":"registerFlagTrigger"},
{"func":"registerSpriteTrigger"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerKeyTrigger","values":[{"type":"choice","value":"right arrow"}],"next":{"func":"blockMotionPointTowards","values":[{"type":"string","value":"right edge"}],"next":{"func":"blockMotionMove","values":[{"type":"number","value":"5"}]}}}
Add to my Backpack
{"func":"registerCloned"}
Comenzar luego del clonado
"Comenzar luego del clonado" ejecuta la secuencia de comandos una vez que el actor fue clonado.
Parameters:
Ninguno.
Related Blocks:
{"func":"blockControlCloneActor"},
{"func":"valueControlLastClonedActor"},
{"func":"blockControlDeleteActor"}
Sample Code:
{"func":"registerCloned","next":{"func":"blockControlForeverIf","values":[{"type":"wrapper","func":"valuevar","name":"playing"}],"containers":[{"func":"blockMotionMove","values":[{"type":"number","value":"10"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":"1"}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueOpRandom","values":[{"type":"number","value":"1"},{"type":"number","value":"10"}]},{"type":"string","value":"5"}]}],"containers":[{"func":"blockMotionTurnCW","values":[{"type":"string","value":"15"}]}]}}}]}}
Add to my Backpack
Events
{"func":"blockControlBroadcastWait"}
Broadcast And Wait
"Broadcast and Wait" is an event block that will broadcast a given message to entire program and wait until all activated scripts finish running.
Parameters:
Message: This is the message that this code block will broadcast. Name it anything you want, depending on what action you want it to activate.
Related Blocks:
{"func":"blockControlBroadcast"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"bottom edge"}]}],"containers":[{"func":"blockControlBroadcastWait","values":[{"type":"string","value":"game over"}]}]}}
Add to my Backpack
{"func":"blockControlPostMessage"}
Send Message
"Send Message" block sends an event message to specified Actors with an optional parameter.
Parameters:
Message: This is the message that this code block will broadcast. Name it anything you want, depending on what action you want it to activate.
Actor: This is the Actor that will listen for your message. You can also choose "any" or "self."
Optional: You can use this parameter to pass in additional data, like a variable or list.
Related Blocks:
{"func":"blockControlPostMessageAndWait"},
{"func":"valueControlMessageValue"},
{"func":"valueControlMessageSource"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"Ball"}]}],"containers":[{"func":"blockControlPostMessageAndWait","values":[{"type":"string","value":"Add Point"},{"type":"string","value":"any"},{"type":"wrapper","func":"valueVar","name":"CurrentScore"}]},{"func":"blockControlPostMessage","values":[{"type":"string","value":"Subtract Point"},{"type":"string","value":"stage"},{"type":"wrapper","func":"valueVar","name":"CurrentScore"}]}]}}
Add to my Backpack
{"func":"blockControlPostMessageAndWait"}
Send Message And Wait
"Send Message And Wait" is an event block that works the same as "Send Message," but waits until the activated scripts finish running before returning to code beneath this block.
Parameters:
Message: This is the message that this code block will broadcast. Name it anything you want, depending on what action you want it to activate.
Actor: This is the Actor that will listen for your message. You can also choose "any" or "self."
Optional: You can use this parameter to pass in additional data, like a variable or list.
Related Blocks:
{"func":"blockControlPostMessage"},
{"func":"valueControlMessageValue"},
{"func":"valueControlMessageSource"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"ball"}]}],"containers":[{"func":"blockControlPostMessageAndWait","values":[{"type":"string","value":"add point"},{"type":"string","value":"any"},{"type":"wrapper","func":"valuevar","name":"currentscore"}]},{"func":"blockControlPostMessage","values":[{"type":"string","value":"subtract point"},{"type":"string","value":"stage"},{"type":"wrapper","func":"valuevar","name":"currentscore"}]}]}}
Add to my Backpack
{"func":"valueControlMessageValue"}
Received Value
"Received Value" block returns the value of the received message.
Parameters:
None.
Related Blocks:
{"func":"blockControlPostMessage"},
{"func":"blockControlPostMessageAndWait"},
{"func":"valueControlMessageSource"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"AddPoint"}],"next":{"func":"blockLooksSay","values":[{"type":"wrapper","func":"valueControlMessageSource"},{"type":"string","value":"has"},{"type":"wrapper","func":"valueOpAdd","values":[{"type":"wrapper","func":"valueControlMessageValue"},{"type":"number","value":"1"}]},{"type":"string","value":"points!"}]}}
Add to my Backpack
{"func":"valueControlMessageSource"}
Received Source
"Received Source" block returns the source of the received message.
Parameters:
None.
Related Blocks:
{"func":"blockControlPostMessage"},
{"func":"blockControlPostMessageAndWait"},
{"func":"valueControlMessageValue"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"AddPoint"}],"next":{"func":"blockLooksSay","values":[{"type":"wrapper","func":"valueControlMessageSource"},{"type":"string","value":"has"},{"type":"wrapper","func":"valueOpAdd","values":[{"type":"wrapper","func":"valueControlMessageValue"},{"type":"number","value":"1"}]},{"type":"string","value":"points!"}]}}
Add to my Backpack
{"func":"valueControlMessageSource"}
Recibido desde origen
El bloque "recibido desde origen" devuelve el origen del mensaje recibido.
Parameters:
Ninguno.
Related Blocks:
{"func":"blockControlPostMessage"},
{"func":"blockControlPostMessageAndWait"},
{"func":"valueControlMessageValue"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"AddPoint"}],"next":{"func":"blockLooksSay","values":[{"type":"wrapper","func":"valueControlMessageSource"},{"type":"string","value":"has"},{"type":"wrapper","func":"valueOpAdd","values":[{"type":"wrapper","func":"valueControlMessageValue"},{"type":"number","value":"1"}]},{"type":"string","value":"points!"}]}}
Add to my Backpack
{"func":"blockControlBroadcast"}
Broadcast
"Broadcast" is an event block that will broadcast a given message to the entire program while continuing to run the script.
Parameters:
Message: This is the message that this code block will broadcast. Name it anything you want, depending on what action you want it to activate.
Related Blocks:
{"func":"blockControlBroadcastWait"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"bottom edge"}]}],"containers":[{"func":"blockControlBroadcast","values":[{"type":"string","value":"game over"}]}]}}
Add to my Backpack
{"func":"blockControlBroadcast"}
Transmitir
"Transmitir" es un bloque de eventos que transmite un mensaje determinado a todo el programa, mientras continúa ejecutando la secuencia de comandos.
Parameters:
Mensaje: este es el mensaje que el bloque de código transmitirá. Puedes ponerle el nombre que quieras, de acuerdo con la acción que desees que active.
Related Blocks:
{"func":"blockControlBroadcastWait"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"bottom edge"}]}],"containers":[{"func":"blockControlBroadcast","values":[{"type":"string","value":"game over"}]}]}}
Add to my Backpack
{"func":"blockControlBroadcastWait"}
Transmitir y esperar
"Transmitir y esperar" es un bloque de eventos que transmite un mensaje determinado a todo el programa y espera hasta que todas las secuencias de comandos terminen de ejecutarse.
Parameters:
Mensaje: este es el mensaje que este bloque de código va a transmitir. Puedes ponerle el nombre que quieras, de acuerdo con la acción que desees que se active.
Related Blocks:
{"func":"blockControlBroadcast"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"bottom edge"}]}],"containers":[{"func":"blockControlBroadcastWait","values":[{"type":"string","value":"game over"}]}]}}
Add to my Backpack
{"func":"blockControlPostMessageAndWait"}
Enviar mensaje y esperar
"Enviar mensaje y esperar" es un bloque de eventos que funciona igual que "enviar mensaje", pero espera hasta que las secuencias de comando activas terminen de ejecutarse antes de regresar al código que está por debajo de este bloque.
Parameters:
Mensaje: este es el mensaje que este bloque de código va a transmitir. Puedes ponerle el nombre que quieras, de acuerdo con la acción que desees que se active.
Actor: éste es el Actor que recibirá el mensaje. También puedes seleccionar "cualquiera" o "sí mismo".
Opcional: puedes utilizar este parámetro para añadir datos opcionales, como una variable o una lista.
Related Blocks:
{"func":"blockControlPostMessage"},
{"func":"valueControlMessageValue"},
{"func":"valueControlMessageSource"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"ball"}]}],"containers":[{"func":"blockControlPostMessageAndWait","values":[{"type":"string","value":"add point"},{"type":"string","value":"any"},{"type":"wrapper","func":"valuevar","name":"currentscore"}]},{"func":"blockControlPostMessage","values":[{"type":"string","value":"subtract point"},{"type":"string","value":"stage"},{"type":"wrapper","func":"valuevar","name":"currentscore"}]}]}}
Add to my Backpack
{"func":"blockControlPostMessage"}
Enviar mensaje
El bloque "enviar mensaje" envía un mensaje a los actores especificados con un parámetro opcional.
Parameters:
Mensaje: este es el mensaje que este bloque de código va a transmitir. Puedes ponerle el nombre que quieras, de acuerdo con la acción que desees que se active.
Actor: éste es el Actor que recibirá el mensaje. También puedes seleccionar "cualquiera" o "sí mismo".
Opcional: puedes utilizar este parámetro para añadir datos opcionales, como una variable o una lista.
Related Blocks:
{"func":"blockControlPostMessageAndWait"},
{"func":"valueControlMessageValue"},
{"func":"valueControlMessageSource"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"Ball"}]}],"containers":[{"func":"blockControlPostMessageAndWait","values":[{"type":"string","value":"Add Point"},{"type":"string","value":"any"},{"type":"wrapper","func":"valueVar","name":"CurrentScore"}]},{"func":"blockControlPostMessage","values":[{"type":"string","value":"Subtract Point"},{"type":"string","value":"stage"},{"type":"wrapper","func":"valueVar","name":"CurrentScore"}]}]}}
Add to my Backpack
{"func":"valueControlMessageValue"}
Valor recibido
"Valor recibido" devuelve el valor del mensaje recibido.
Parameters:
Ninguno.
Related Blocks:
{"func":"blockControlPostMessage"},
{"func":"blockControlPostMessageAndWait"},
{"func":"valueControlMessageSource"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"AddPoint"}],"next":{"func":"blockLooksSay","values":[{"type":"wrapper","func":"valueControlMessageSource"},{"type":"string","value":"has"},{"type":"wrapper","func":"valueOpAdd","values":[{"type":"wrapper","func":"valueControlMessageValue"},{"type":"number","value":"1"}]},{"type":"string","value":"points!"}]}}
Add to my Backpack
{"func":"valueControlMessageSource"}
Recibido desde origen
El bloque "recibido desde origen" devuelve el origen del mensaje recibido.
Parameters:
Ninguno.
Related Blocks:
{"func":"blockControlPostMessage"},
{"func":"blockControlPostMessageAndWait"},
{"func":"valueControlMessageValue"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"AddPoint"}],"next":{"func":"blockLooksSay","values":[{"type":"wrapper","func":"valueControlMessageSource"},{"type":"string","value":"has"},{"type":"wrapper","func":"valueOpAdd","values":[{"type":"wrapper","func":"valueControlMessageValue"},{"type":"number","value":"1"}]},{"type":"string","value":"points!"}]}}
Add to my Backpack
{"func":"blockControlBroadcast"}
Transmitir
"Transmitir" es un bloque de eventos que transmite un mensaje determinado a todo el programa, mientras continúa ejecutando la secuencia de comandos.
Parameters:
Mensaje: este es el mensaje que el bloque de código transmitirá. Puedes ponerle el nombre que quieras, de acuerdo con la acción que desees que active.
Related Blocks:
{"func":"blockControlBroadcastWait"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"bottom edge"}]}],"containers":[{"func":"blockControlBroadcast","values":[{"type":"string","value":"game over"}]}]}}
Add to my Backpack
{"func":"blockControlBroadcastWait"}
Transmitir y esperar
"Transmitir y esperar" es un bloque de eventos que transmite un mensaje determinado a todo el programa y espera hasta que todas las secuencias de comandos terminen de ejecutarse.
Parameters:
Mensaje: este es el mensaje que este bloque de código va a transmitir. Puedes ponerle el nombre que quieras, de acuerdo con la acción que desees que se active.
Related Blocks:
{"func":"blockControlBroadcast"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"bottom edge"}]}],"containers":[{"func":"blockControlBroadcastWait","values":[{"type":"string","value":"game over"}]}]}}
Add to my Backpack
{"func":"blockControlPostMessage"}
Enviar mensaje
El bloque "enviar mensaje" envía un mensaje a los actores especificados con un parámetro opcional.
Parameters:
Mensaje: este es el mensaje que este bloque de código va a transmitir. Puedes ponerle el nombre que quieras, de acuerdo con la acción que desees que se active.
Actor: éste es el Actor que recibirá el mensaje. También puedes seleccionar "cualquiera" o "sí mismo".
Opcional: puedes utilizar este parámetro para añadir datos opcionales, como una variable o una lista.
Related Blocks:
{"func":"blockControlPostMessageAndWait"},
{"func":"valueControlMessageValue"},
{"func":"valueControlMessageSource"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"Ball"}]}],"containers":[{"func":"blockControlPostMessageAndWait","values":[{"type":"string","value":"Add Point"},{"type":"string","value":"any"},{"type":"wrapper","func":"valueVar","name":"CurrentScore"}]},{"func":"blockControlPostMessage","values":[{"type":"string","value":"Subtract Point"},{"type":"string","value":"stage"},{"type":"wrapper","func":"valueVar","name":"CurrentScore"}]}]}}
Add to my Backpack
{"func":"blockControlPostMessageAndWait"}
Enviar mensaje y esperar
"Enviar mensaje y esperar" es un bloque de eventos que funciona igual que "enviar mensaje", pero espera hasta que las secuencias de comando activas terminen de ejecutarse antes de regresar al código que está por debajo de este bloque.
Parameters:
Mensaje: este es el mensaje que este bloque de código va a transmitir. Puedes ponerle el nombre que quieras, de acuerdo con la acción que desees que se active.
Actor: éste es el Actor que recibirá el mensaje. También puedes seleccionar "cualquiera" o "sí mismo".
Opcional: puedes utilizar este parámetro para añadir datos opcionales, como una variable o una lista.
Related Blocks:
{"func":"blockControlPostMessage"},
{"func":"valueControlMessageValue"},
{"func":"valueControlMessageSource"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"ball"}]}],"containers":[{"func":"blockControlPostMessageAndWait","values":[{"type":"string","value":"add point"},{"type":"string","value":"any"},{"type":"wrapper","func":"valuevar","name":"currentscore"}]},{"func":"blockControlPostMessage","values":[{"type":"string","value":"subtract point"},{"type":"string","value":"stage"},{"type":"wrapper","func":"valuevar","name":"currentscore"}]}]}}
Add to my Backpack
{"func":"valueControlMessageValue"}
Valor recibido
"Valor recibido" devuelve el valor del mensaje recibido.
Parameters:
Ninguno.
Related Blocks:
{"func":"blockControlPostMessage"},
{"func":"blockControlPostMessageAndWait"},
{"func":"valueControlMessageSource"},
{"func":"registerBroadcastTrigger"}
Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"AddPoint"}],"next":{"func":"blockLooksSay","values":[{"type":"wrapper","func":"valueControlMessageSource"},{"type":"string","value":"has"},{"type":"wrapper","func":"valueOpAdd","values":[{"type":"wrapper","func":"valueControlMessageValue"},{"type":"number","value":"1"}]},{"type":"string","value":"points!"}]}}
Add to my Backpack
Documentation
{"func":"blockInlineComment"}
Comment
"Comment" performs no action but is useful for documenting your code.
Parameters:
None.
Related Blocks:
{"func":"blockComment"}
Sample Code:
{"func":"blockInlineComment","values":[{"type":"string","value":"point left"}],"next":{"func":"blockMotionPointDirection","values":[{"type":"string","value":-90}]}}
Add to my Backpack
{"func":"blockComment","width":100,"height":24,"label":"code notes"}
Code Notes
"Code Notes" performs no action but is useful for documenting and explaining your code.
Parameters:
None.
Related Blocks:
{"func":"blockInlineComment"}
Sample Code:
{"func":"blockComment","width":192.0028419494629,"height":34.821044921875,"label":"Map keys 'a', 's', 'd' and 'f' to control the Actor."}
Add to my Backpack
{"func":"blockInlineComment"}
Comentario
"Comentario" no realiza ninguna acción, pero es útil para documentar tu código.
Parameters:
Ninguno.
Sample Code:
{"func":"blockInlineComment","values":[{"type":"string","value":"point left"}],"next":{"func":"blockMotionPointDirection","values":[{"type":"string","value":-90}]}}
Add to my Backpack
{"func":"blockComment","width":100,"height":24,"label":"code notes"}
Notas de código.
"Notas de código" no realiza ninguna acción, pero es útil para documentar y explicar tu código.
Parameters:
Ninguno.
Sample Code:
{"func":"blockComment","width":192.0028419494629,"height":34.821044921875,"label":"Map keys 'a', 's', 'd' and 'f' to control the Actor."}
Add to my Backpack
{"func":"blockInlineComment"}
Comentario
"Comentario" no realiza ninguna acción, pero es útil para documentar tu código.
Parameters:
Ninguno.
Sample Code:
{"func":"blockInlineComment","values":[{"type":"string","value":"point left"}],"next":{"func":"blockMotionPointDirection","values":[{"type":"string","value":-90}]}}
Add to my Backpack
{"func":"blockComment","width":100,"height":24,"label":"code notes"}
Notas de código.
"Notas de código" no realiza ninguna acción, pero es útil para documentar y explicar tu código.
Parameters:
Ninguno.
Sample Code:
{"func":"blockComment","width":192.0028419494629,"height":34.821044921875,"label":"Map keys 'a', 's', 'd' and 'f' to control the Actor."}
Add to my Backpack
Advanced
{"func":"registerExternalTrigger"}
When External Condition Occurs
"When External Condition Occurs" is an event block that activates when the specified external condition changes from the false state to the true state.
Parameters:
Condition: This parameter indicates the external condition - loudness, video motion or timer - that will trigger this script.
Value: Set to the value to trigger this script.
Related Blocks:
{"func":"registerTrigger"}
{"func":"registerExternalTrigger"}
Cuando ocurra la condición externa
"Cuando ocurra la condición externa" es un bloque de eventos que se activa cuando la condición externa específica cambia del estado falso al estado verdadero.
Parameters:
Condición: este parámetro indica la condición externa (volumen, movimiento de video o temporizador) que activará esta secuencia de comandos.
Valor: fija el valor para activar esta secuencia de comandos.
Related Blocks:
{"func":"registerTrigger"}
{"func":"registerExternalTrigger"}
Cuando ocurra la condición externa
"Cuando ocurra la condición externa" es un bloque de eventos que se activa cuando la condición externa específica cambia del estado falso al estado verdadero.
Parameters:
Condición: este parámetro indica la condición externa (volumen, movimiento de video o temporizador) que activará esta secuencia de comandos.
Valor: fija el valor para activar esta secuencia de comandos.
Related Blocks:
{"func":"registerTrigger"}
Mobile Event Handlers
{"func":"registerTiltTrigger"}
Al inclinar
"Al inclinar" es un bloque de eventos que se activa cuando se inclina el dispositivo. Se activa repetidamente hasta que el dispositivo deja de estar inclinado. La tasa de activación puede variar de un dispositivo a otro. También puede variar dependiendo del código del proyecto.
Parameters:
Dirección: este parámetro indica la dirección que detectará este método (izquierda, derecha, hacia adelante o hacia atrás).
Related Blocks:
{"func":"registerScreenTrigger"},
{"func":"valueSensingAccelerometerX"},
{"func":"valueSensingAccelerometerY"}
Sample Code:
{"func":"registerTiltTrigger","values":[{"type":"choice","value":"right"}],"next":{"func":"blockMotionChangeXBy","values":[{"type":"number","value":"10"}]}}
Add to my Backpack
{"func":"registerTiltTrigger"}
When Tilting
"When Tilting" is an event block that activates when the device is tilted in the specified direction.
Parameters:
Direction: When the device is tilted in this direction, this code block will activate.
Related Blocks:
{"func":"registerScreenTrigger"},
{"func":"valueSensingAccelerometerX"},
{"func":"valueSensingAccelerometerY"}
Sample Code:
{"func":"registerTiltTrigger","values":[{"type":"choice","value":"right"}],"next":{"func":"blockMotionChangeXBy","values":[{"type":"number","value":"10"}]}}
Add to my Backpack
{"func":"registerScreenTrigger"}
When Screen Activity
"When Screen Activity" is an event block that activates when the user interacts with the device in the specified way.
Parameters:
Activity: When the device is used in this way, this code block will activate.
Related Blocks:
{"func":"registerTiltTrigger"},
{"func":"registerTrigger"}
Sample Code:
{"func":"registerScreenTrigger","values":[{"type":"choice","value":"clicked"}],"next":{"func":"blockLooksSayFor","values":[{"type":"string","value":"Tap!"},{"type":"number","value":1}]}}
Add to my Backpack
{"func":"registerScreenTrigger"}
Parameters:
Related Blocks:
{"func":"registerTiltTrigger"},
{"func":"registerTrigger"}
Sample Code:
{"func":"registerScreenTrigger","values":[{"type":"choice","value":"clicked"}],"next":{"func":"blockLooksSayFor","values":[{"type":"string","value":"Tap!"},{"type":"number","value":1}]}}
Add to my Backpack
{"func":"registerScreenTrigger"}
Parameters:
Related Blocks:
{"func":"registerTiltTrigger"},
{"func":"registerTrigger"}
Sample Code:
{"func":"registerScreenTrigger","values":[{"type":"choice","value":"clicked"}],"next":{"func":"blockLooksSayFor","values":[{"type":"string","value":"Tap!"},{"type":"number","value":1}]}}
Add to my Backpack
{"func":"registerTiltTrigger"}
Al inclinar
"Al inclinar" es un bloque de eventos que se activa cuando se inclina el dispositivo. Se activa repetidamente hasta que el dispositivo deja de estar inclinado. La tasa de activación puede variar de un dispositivo a otro. También puede variar dependiendo del código del proyecto.
Parameters:
Dirección: este parámetro indica la dirección que detectará este método (izquierda, derecha, hacia adelante o hacia atrás).
Related Blocks:
{"func":"registerScreenTrigger"},
{"func":"valueSensingAccelerometerX"},
{"func":"valueSensingAccelerometerY"}
Sample Code:
{"func":"registerTiltTrigger","values":[{"type":"choice","value":"right"}],"next":{"func":"blockMotionChangeXBy","values":[{"type":"number","value":"10"}]}}
Add to my Backpack
- Getting Started
- Welcome to Tynker
- Minecraft Guide
- Tools
- Workshop
- Character Creator
- Level Editor
- Backpack
- Debugger
- Sharing
- LEGO WeDo
- Tips & Tricks
- Video Tutorials
- Working with Actors
- Music and Drawing
- Physics Engine
- Game Design
- Other Topics
- Tech Setup
- Glossary
- Blocks Reference
- Events
- Control
- Motion
- Animation
- Looks
- Sensing
- Sound
- Operator
- Pen
- Physics
- Variables
- Lists
- Functions
- Level Design
- Hardware
- Library Reference
- Platformer
- Top Down