|   FORUM      |     Tutoriales    |     KIO4 |      
   Start B4A (Basic4Android) App inventor 2 Arduino
   Elastix - VoIP Things of Windows Interesting Webs  Telecomunications

 


Nuevo concurso para España, Argentina, Brasil, Chile, Colombia, Ecuador, México, Perú y Portugal.

App Inventor 2
Programming mobile phones with Android 
by App Inventor 2 - Juan Antonio Villalpando

- Initiation Tutorial App Inventor 2 -

Return to tutorial index

____________________________

 

3.- Guess the number.

p3_adivina.aia (Este es el archivo del código fuente, para ser consultado, modificado, depurado... en App inventor 2 ) ip3_guess.aia (This is the source code file to be consulted, modified, debug ... App Inventor 2)

p3_adivina.apk (Este es el archivo definitivo de instalación. Lo copiamos en nuestro móvil y lo instalamos) p3_adivina.apk (This is the definitive installation file. The copy in our mobile and installed)

(Mediante este código QR también podemos instalar esta aplicación en un móvil. Esta forma de instalación es más sencilla) (By this QR code can also install this application on a mobile. This installation is simpler)

Ahora se trata de hacer un programa llamado Adivina. - Now it is making a program called Guess.

- Pulsamos un Botón , en ese momento el móvil crea un número aleatorio comprendido entre el 1 y el 100 que debemos adivinar. - We press a Button, then the mobile creates a random number between 1 and 100 that we guess.

- Luego introducimos un número en el CampoDeTexto y pulsamos el botón ¿Es este? - Then we introduce a number in the TextBox and press the Button Is This?

- El programa nos responderá si el número creado es igual, mayor o menor que el que hemos introducido. - The program will answer us if the number is created equal, greater or lesser than we have introduced.

_________________ _________________
Diseño Design

Introducimos en la pantalla Screen1 los siguientes elementos: Screen1 enter into the screen the following elements:
Botón1, Etiqueta, CampoDeTexto, DisposiciónHorizontal, Botón2, Etiqueta2 y Etiqueta3 Button1, Label, TextBox, HorizontalArragement, Button2, Label2 and Label3

_________________ _________________
Bloques Blocks

NOTA: NOTE:

Para obtener las condiciones >, <,... For conditions>, <, ...

Pulsamos el desplegable y elegimos la condición. We press the drop-down and choose the condition.

_________________ _________________
Explicación: Explanation:

- Definimos la variable ordenador como numérica - We define the variable as numerical computer

- Definimos la variable mio como numérica. - We define the variable as numerical mine.

- Cuando hacemos Click en el Botón1: - When we click on Button1:

- Se asigna a la variable ordenador un número aleatorio comprendido entre el 1 y el 100 - Variable computer to a random number between 1 and 100 is assigned

- En la Etiqueta3.Text aparece el número creado. - In the Label3.Text the number created appears.

- Cuando hacemos Click en el Botón2 : - When we click on Button2:

- Se le asigna a la variable mio el valor que el usuario del juego ponga en el CampoDeTexto1 - Assigned to the mine variable to the user of the game put the TextBox1

- Si el número del ordenador es mayor que el mio , aparece en la Etiqueta2.Texto la frase Mi número es mayor - If the number of the computer is higher than mine, the phrase appears in the Label2.Text My number is greater.

- Si el número del ordenador es menor que el mio , aparece en la Etiqueta2.Texto la frase Mi número es menor. - If the number is less computer than mine, the phrase appears in the Label2.Text My number is lower.

- Si el número del ordenador es igual que el mio , aparece en la Etiqueta2.Texto t la frase HAS ACERTADO. - If the number of the computer is the same as mine, SUCCESSFUL phrase appears in the Label2.Text

- NOTA: La Etiqueta3 es solo para comprobar el funcionamiento de la aplicación. - NOTE: Label3 is only to check the operation of the application. Cuando comprobemos su buen funcionamiento, borraremos o inhabilitaremos esta Etiqueta3 para no ver el número que debemos acertar. When we ensure its smooth operation, delete or will disable this Label3 not see the number we need to hit.

_________________________________________________________________________________________________ _________________________________________________________________________________________________

IMPORTANTE: ampliar las características de un bloque. IMPORTANT: extend the features of a block.

Hay algunos bloques que tienen un cuadradito azul . There are some blocks that have a blue square. Pulsando éste podemos conseguir una ampliación de las características del bloque. Pressing it can get an extension of the block features.

Fíjate en el dibujo animado de abajo la manera de añadir elementos al bloque. Look at the lively below how to add elements to block drawing. Pulsamos y luegos arrastramos los subbloques hasta insertarlos. Then press and drag the sub - blocks to insert them .
Esto lo puedes hacer con otros bloques que tenga el cuadradito azul. This can be done with other blocks having the blue square.

________________________________________________________

 

 

- My e-mail:
juana1991@yahoo.com
- Who I am. - Cookies. Texts and images propierty autor:
© Juan A. Villalpando
Not copy texts neither images.
We use our own cookies and third-party cookies on our websites to maintain the session and your preferences, customize your user experience and obtain website use statistics.
Si continúa navegando consideramos que acepta su uso. OK    Más información