
Componenti
Componenti | Proprietà | Valore | |
---|---|---|---|
Screen | Screen1 | Title | Android Mash 1 |
Draw and Animation > Canvas | Canvas1 | BackgroundImage | androidblock2.png |
Height | 400 | ||
Width | Fill parent | ||
Draw and Animation > ImageSprite | ImageSprite_Android | Picture | Android_teacher.svg.png |
Sensors > Clock | Clock1 | ||
Media > Sound | Sound1 |
Blocchi
La procedura moveRandom sposta l’immagine di Android sullo schermo in modo casuale

La procedura viene chiamata quando parte l’applicazione e ad ogni segnale del timer (1000 ms = 1 s)


Quando l’immagine viene colpita si ottiene una vibrazione (500 ms = 0.5 s)


Gestione del punteggio, fine del gioco, nuovo gioco
Componenti
Componenti | Proprietà | Valore | |
---|---|---|---|
Screen | Screen1 | AlignHorizontal | Center |
BackgroundColor | Black | ||
Title | Android Mash 2 | ||
Draw and Animation > Canvas | Canvas1 | BackgroundImage | androidblock2.png |
Height | 400 | ||
Width | Fill parent | ||
Draw and Animation > ImageSprite | ImageSprite_Android | Picture | Android_teacher.svg.png |
Layout > HorizontalArrangement | HorizontalArrangement1 | ||
User Interface > Label | Label_Score1 | Text | Score: |
User Interface > Label | Label_Score2 | Text | 0 |
User Interface > Button | Button_Reset | Shape | rounded |
Text | New Game | ||
TextColor | Blue | ||
Sensors > Clock | Clock1 | ||
Media > Sound | Sound1 | ||
Media > TextToSpeech | TextToSpeech1 |
Blocchi
Con il pulsante New Game si fa ripartire il gioco: punteggio a zero e timer attivato
Quando viene colpito il robot: vibrazione, il punteggio aumenta di 1, se il punteggio è arrivato a 5 si ferma il timer (e il robot…) e si sente un messaggio di vittoria
Vedi: http://www.appinventor.org/content/ai2apps/simpleApps/androidMash