Differences

This shows you the differences between the selected revision and the current
version of the page.


es:kbase:inside_the_brain_and_body_of_your_game 2010/03/18 12:08 es:kbase:inside_the_brain_and_body_of_your_game 2010/03/18 21:38 current
Line 139: Line 139:
Si pinchamos en un objeto sin haber seleccionado otro objeto del inventario, entonces enviaremos un evento "LeftClick" al script vinculado a la región (es de esperar que tenga definido el evento **on "LeftClick" {}** para poder hacer algo). Si pinchamos en un objeto sin haber seleccionado otro objeto del inventario, entonces enviaremos un evento "LeftClick" al script vinculado a la región (es de esperar que tenga definido el evento **on "LeftClick" {}** para poder hacer algo).
- 
<code script> <code script>
Line 188: Line 187:
</code> </code>
-This is so well commented that again I am just stating the obvious. First we deselect potentional Inventory Item when we issue a right click. Then we check if our Right Click  menu is not visible. If it is, it gets hidden. If we didn't click on any assigned regions on screen, we just forward the right click to the scene (as we did with the left click before). The biggest code portion is that if we actually can do anything with the region (it supports some of the handlers like Take, Talk or LookAt) we show the menu. There is some obvious positioning of the menu on the screen and lastly it stops the actor.+El código está comentado y es bastante claro. Primero, deseleccionamos el objeto del inventario cuando pulsamos el botón derecho del ratón. Comprobamos si el menú del botón derecho es visible. Si lo es, lo oculta. Si no hemos pinchado en alguna región asignada, enviamos el evento a la escena (como hicimos con el botón izquierdo). La parte más grande de código comprueba que si hay algo que podamos hacer con la región en la que hemos pinchado (soporta algunas acciones como Coger, Hablar o Mirar a), entonces mostramos el menú. También se posiciona el menú en la pantalla y, por último, detiene al actor.
<code script> <code script>
Line 206: Line 205:
</code> </code>
-Another handler handles all keystrokes (see our handy key symbolic names?). We just (upon escape or F1) load the Main Menu (load, save, exit etc), center it on the screen and switch to exclusive mode which means, that everything else is stopped until this window  ends. When we close the menu window, it gets unloaded again.+Esta función controla las pulsaciones de teclado (¿has visto nuestros útiles nombres para las teclas?). Lo que hacemos (pulsando Escape o F1) es cargar el Menú Principal (cargar, guardar, salir, etc.), centrarlo en la pantalla y cambiar al modo exclusivo. Esto significa que todo se detiene hasta que se cierre la ventana. Cuando se cierra el menú, se descarga de la memoria.
-Last handler (phewwww) of the **game.script** is just handling the quit dialog and game quitting.+La última función de eventos de **game.script** sirve para controlar el menú de salida y cerrar el juego.
<code script> <code script>
Line 231: Line 230:
</code> </code>
-As you can see, it works similary to Main Menu window and when we clicked on yes, it sets xResult to true so **Game.QuitGame();** is called. Not exactly a rocket science.+Como puedes ver, funciona igual que la ventana del Menú Principal. Si seleccionamos Si, xResult se marca como True y llama a **Game.QuitGame();**. No es física cuántica.
---- ----
-Ok... Still don't have enough? In the second part of this tutorial we will have a look at **game_daemon.script** file. +Bien... ¿todavía no tenéis suficiente? En la segunda parte de este tutorial vamos a echarle un vistazo al archivo **game_daemon.script**.
-You can see that after some declaration it starts with infinite loop. It means that it will just go and on until the game is ended or you Detach the script. Funny part about infinite loops is, that you should end them with some little **Sleep();** or it will take the whole control over the game end results in freezing. Not nice experience... +Puedes comprobar que, después de algunas declaraciones, comienza un bucle infinito. Eso quiere decir que se ejecutará hasta que el juego acabe o se desvincule el script. La parte más divertida de los bucles infinitos es que debes detenerlos con la instrucción **Sleep();** o tomarán el control del juego que se acabará colgando. No es una experiencia agradable...
<code script> <code script>
Line 261: Line 260:
</code> </code>
-First portion of the daemon handles with the Captions when you hover with a mouse over some defined regions with no inventory item attached. It positions it, assign a caption according to caption defined in Scene Edit, scales it and prepares it. +La primera parte del código controla los rótulos que aparecen cuando pasas el ratón sobre algunas regiones sin tener seleccionado un objeto del inventario. Se posiciona, asigna el rótulo que esté definido en Scene Edit, lo escala y lo prepara.
<code script> <code script>
Line 279: Line 278:
</code> </code>
-If you on the other hand have some item assigned, the caption is prepared in a manner of **Use knife with apple**. Again it is pretty obvious from the code itself. Common denominator is that Caption is displayed and gets focus. If we are over empty space with no inventory item in hand we hide the caption with **WinCaption.Visible = false;**. So much for captions.+Si, por otro lado, tienes un objeto asignado, el rótulo es preparado de la siguiente manera: **Usar cuchillo con manzana**. De nuevo, el código es bastante explicativo. El común denominador es que el rótulo es mostrado y consigue el foco. Si estamos sobre un lugar vacío y no tenemos un objeto de inventario en la mano, ocultamos el rótulo con la instrucción **WinCaption.Visible = false;**. Ya es bastante para los rótulos.
-Last portion of the daemon is to handle the inventory behavior. +La última parte controla el inventario.
<code script> <code script>
Line 290: Line 289:
</code> </code>
-If we position mouse into upper part of the screen, we show the inventory (provided the game is in interactive mode, main menu is not visible, and we are not in dialogue mode). When we get out of the inventory box or we are in the dialogue mode or game is not interactive, we hide it. It's a bit crude and you should look at **faq** on some inventory handling tips. +Si movemos el ratón a la parte superior de la pantalla, mostramos el inventario (mientras el juego no esté en modo interactivo, el menú principal no sea visible y no estemos en modo diálogo). Cuando salimos del inventario, entramos en modo diálogo o el juego no es interactivo, lo ocultamos. Es un poco lioso y deberías mirar en [[es:FAQ|Preguntas y respuestas]] para conocer algunos trucos al manejar el inventario.
-Lastly the aformentioned Sleep is issued and we are set.+Finalmente, ejecutamos la instrucción Sleep que mencionamos antes.
-That concludes it for this tutorial and I hope you'll find it at least a bit useful.+El tutorial finaliza aquí y espero que lo encuentres útil.
 
es/kbase/inside_the_brain_and_body_of_your_game.1268910484.txt.gz · Last modified: 2010/03/18 12:08 by saboteur
Recent changes RSS feed Creative Commons License Driven by DokuWiki