SlideShare a Scribd company logo
1 of 15
ROME 11-12 april 2014ROME 11-12 april 2014
Avete avuto l’idea per il nuovo Flappy Birds?
Introduzione a libGDX
E-Mail: matteo.anelli@nttdata.com
Twitter: @matteoanelli
Xbox Live, PSN, Steam: Ziggybee
Matteo Anelli (NTT DATA)
ROME 11-12 april 2014
Perché usare libgdx?
 Oltre l’1.5% dei titoli Play Store la usa (è il primo framework per giochi)
 Standardizza lo sviluppo e minimizza i costi di start-up indie
 Permette una prototipazione molto rapida perché offre funzionalità di base per:
 Grafica 2D e 3D
 Audio
 Astrazione degli input
 Primitive matematiche (vettori, operatori 3D)
 Networking (TCP, HTTP)
 File System
 User Interface
 E’ ampiamente testata, con centinaia di app e giochi distribuiti con questa tecnologia
 E’ Open Source!
Requisiti:
 PC/Mac: JVM e supporto OpenGL
 Android: Supporto OpenGL ES 2.x o superiore
 iOS: RoboVM
 BlackBerry: ci interessa davvero?
ROME 11-12 april 2014 - Speaker’s name
Architettura di libGDX
ROME 11-12 april 2014
Architettura di libGDX
ROME 11-12 april 2014
 One-Button Game
 Tappando lo schermo il
passerotto si libra
 Se tocca i tubi muore
 I tubi scorrono a sinistra
 Se il passerotto non batte le
ali la gravità lo fa schiantare
TAP!
Il prototipo
ROME 11-12 april 2014
Game Cover!
ROME 11-12 april 2014
FlappyGame
GameScreenGameWorld GameRenderer
AssetLoader
ScrollHandler
Componenti
ROME 11-12 april 2014
public class FlappyGame extends Game {
@Override
public void create() {
AssetLoader.load();
setScreen(new GameScreen());
}
@Override
public void dispose() {
super.dispose();
AssetLoader.dispose();
}
}
La main class di un progetto libgdx
è la classe Game.
Possiede solo due metodi:
 Create per l’inizializzazione
dell’app.
 Dispose per la liberazione delle
risorse prima della chiusura
dell’app.
Nel nostro caso all’avvio vengono
caricati gli asset di gioco
(immagini, suoni, etc) e viene
definito il GameScreen di partenza
FlappyGame
ROME 11-12 april 2014
Uno Screen è qualcosa di molto
simile ad una classe Activity in
Android. Rappresenta uno stato
dell’App che svolge una
funzione. Per semplicità
l’esempio usa un singolo Screen.
Un gioco è come un film, ad ogni
ciclo se ne calcola un
fotogramma. Lo screen, tramite il
metodo render permette di
controllare il disegno di un
fotogramma.
public class GameScreen implements Screen {
private GameWorld world;
private GameRenderer renderer;
public GameScreen() {
float screenWidth = Gdx.graphics.getWidth();
float screenHeight = Gdx.graphics.getHeight();
float gameWidth = 136;
float gameHeight =
screenHeight / (screenWidth / gameWidth);
int midPointY = (int) (gameHeight / 2);
world = new GameWorld(midPointY);
renderer = new GameRenderer(world,
(int) gameHeight, midPointY);
Gdx.input.setInputProcessor(
new InputHandler(world));
}
@Override
public void render(float delta) {
runTime += delta;
world.update(delta);
renderer.render(runTime);
}
GameScreen
ROME 11-12 april 2014
La classe principale del gioco,
non è un oggetto libgdx ma
rappresenta il core del gioco, il
centro di controllo dell’intera
logica dell’applicazione
public void updateRunning(float delta) {
if (delta > .15f) {
delta = .15f;
}
bird.update(delta);
scroller.update(delta);
if (scroller.collides(bird) && bird.isAlive()) {
scroller.stop();
bird.die();
AssetLoader.dead.play();
}
if (Intersector.overlaps(
bird.getBoundingCircle(), ground)
&& currentState == GameState.RUNNING) {
scroller.stop();
bird.die();
bird.decelerate();
currentState = GameState.GAMEOVER;
if (score > AssetLoader.getHighScore()) {
AssetLoader.setHighScore(score);
currentState = GameState.HIGHSCORE;
}
}
}
GameWorld
ROME 11-12 april 2014
public void update(float delta){
frontGrass.update(delta);
backGrass.update(delta);
pipe1.update(delta);
pipe2.update(delta);
pipe3.update(delta);
if (pipe1.isScrolledLeft()){
pipe1.reset(pipe3.getTailX() + PIPE_GAP);
} else if (pipe2.isScrolledLeft()) {
pipe2.reset(pipe1.getTailX() + PIPE_GAP);
} else if (pipe3.isScrolledLeft()) {
pipe3.reset(pipe2.getTailX() + PIPE_GAP);
}
if (frontGrass.isScrolledLeft()) {
frontGrass.reset(backGrass.getTailX());
} else if (backGrass.isScrolledLeft())
{
backGrass.reset(frontGrass.getTailX());
}
}
Lo scrolling non fa altro che
«aggiornare» gli elementi del
nostro mondo.
Lo scroller controlla anche
che i tubi non siano usciti
fuori dallo schermo. In quel
caso li resetta, accodandoli
alla destra dell’ultimo tubo a
schermo.
ScrollHandler
ROME 11-12 april 2014
La fisica è molto semplice:
c’è un’accelerazione
costante che spinge l’uccello
verso il basso.
In realtà l’uccello si muove
solo in verticale, l’effetto
proiettile è dato dagli altri
elementi che scorrono!
public void update(float delta) {
velocity.add(acceleration.cpy().scl(delta));
if (velocity.y > 200) {
velocity.y = 200;
}
// CEILING CHECK
if (position.y < -13) {
position.y = -13;
velocity.y = 0;
}
position.add(velocity.cpy().scl(delta));
boundingCircle.set(position.x + 9, position.y
+ 6, 6.5f);
// Rotate counterclockwise
if (velocity.y < 0) {
rotation -= 600 * delta;
if (rotation < -20) {
rotation = -20;
}
}
// Rotate clockwise
if (isFalling() || !isAlive) {
rotation += 480 * delta;
if (rotation > 90) {
rotation = 90;
}
}
}
public void onClick() {
if (isAlive) {
AssetLoader.flap.play();
velocity.y = -140;
}
}
Fisica
ROME 11-12 april 2014
Il rendering avviene tramite il
wrapping delle funzioni
OpenGL ES con il
componente Gdx.gl
Nei giochi 2D ogni sprite è
una Texture. Per evitare di
sovraccaricare la GPU la
libreria effettua un buffering
delle operazioni.
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
shapeRenderer.begin(ShapeType.Filled);
// Draw Background color
shapeRenderer.setColor(30 / 255.0f, 125 / 255.0f, 205 /
255.0f, 1);
shapeRenderer.rect(0, 0, 136, midPointY + 66);
. . .
shapeRenderer.end();
batcher.begin();
batcher.disableBlending();
batcher.draw(bg, 0, midPointY + 23, 136, 43);
drawGrass();
drawPipes();
batcher.enableBlending();
if (bird.shouldntFlap()) {
batcher.draw(birdMid, bird.getX(), bird.getY(),
bird.getWidth() / 2.0f, bird.getHeight() / 2.0f,
bird.getWidth(), bird.getHeight(), 1, 1,
bird.getRotation());
} else {
batcher.draw(birdAnimation.getKeyFrame(runTime),
bird.getX(),
bird.getY(), bird.getWidth() / 2.0f,
bird.getHeight() / 2.0f, bird.getWidth(),
bird.getHeight(),
1, 1, bird.getRotation());
}
batcher.end();
Rendering
ROME 11-12 april 2014
Domande?
ROME 11-12 april 2014
Tutorial completo di Kilobolt:
http://www.kilobolt.com/zombie-bird-tutorial-flappy-bird-remake.html
Sito ufficiale libGDX:
http://libgdx.badlogicgames.com/
Android Development Tools:
http://developer.android.com/sdk/index.html
RoboVM:
http://www.robovm.org/
Codice sorgente:
https://drive.google.com/file/d/0B9LBtD2_WpFcVTgzLWZuRkxfVW8
Ottimi Screencast:
https://www.youtube.com/user/dermetfan/playlists?sort=dd&shelf_id=3&view=50

More Related Content

Viewers also liked

Web Api 2.X - Lattanzi
Web Api 2.X - LattanziWeb Api 2.X - Lattanzi
Web Api 2.X - LattanziCodemotion
 
Domain Driven Design + Command Query Responsibility Segregation + Event Sourc...
Domain Driven Design + Command Query Responsibility Segregation + Event Sourc...Domain Driven Design + Command Query Responsibility Segregation + Event Sourc...
Domain Driven Design + Command Query Responsibility Segregation + Event Sourc...Codemotion
 
Cara cloud, ha chiamato l’utente, rivuole la sicurezza by Alessandro Manfredi
Cara cloud, ha chiamato l’utente, rivuole la sicurezza by Alessandro ManfrediCara cloud, ha chiamato l’utente, rivuole la sicurezza by Alessandro Manfredi
Cara cloud, ha chiamato l’utente, rivuole la sicurezza by Alessandro ManfrediCodemotion
 
Empowering the Mobile Web - Mills
Empowering the Mobile Web - MillsEmpowering the Mobile Web - Mills
Empowering the Mobile Web - MillsCodemotion
 
Drag, drop, play and party. How you can run your own radio station in 90 seco...
Drag, drop, play and party. How you can run your own radio station in 90 seco...Drag, drop, play and party. How you can run your own radio station in 90 seco...
Drag, drop, play and party. How you can run your own radio station in 90 seco...Codemotion
 
Introduction to the hadoop ecosystem by Uwe Seiler
Introduction to the hadoop ecosystem by Uwe SeilerIntroduction to the hadoop ecosystem by Uwe Seiler
Introduction to the hadoop ecosystem by Uwe SeilerCodemotion
 
Release Responsibly
Release ResponsiblyRelease Responsibly
Release ResponsiblyCodemotion
 
Past, Present and Future of Data Processing in Apache Hadoop
Past, Present and Future of Data Processing in Apache HadoopPast, Present and Future of Data Processing in Apache Hadoop
Past, Present and Future of Data Processing in Apache HadoopCodemotion
 
HTML5 Up and Running
HTML5 Up and RunningHTML5 Up and Running
HTML5 Up and RunningCodemotion
 
Crea il tuo ecosistema - Francesco Fullone - Codemotion Milan 2014
Crea il tuo ecosistema - Francesco Fullone - Codemotion Milan 2014Crea il tuo ecosistema - Francesco Fullone - Codemotion Milan 2014
Crea il tuo ecosistema - Francesco Fullone - Codemotion Milan 2014Codemotion
 
Sviluppare Indie Games su Xbox360 con C# e XNA Game Studio
Sviluppare Indie Games su Xbox360 con C# e XNA Game StudioSviluppare Indie Games su Xbox360 con C# e XNA Game Studio
Sviluppare Indie Games su Xbox360 con C# e XNA Game StudioCodemotion
 
Speed up your Django apps with Jython and SPDY by Emanuele Palazzetti
Speed up your Django apps with Jython and SPDY by Emanuele PalazzettiSpeed up your Django apps with Jython and SPDY by Emanuele Palazzetti
Speed up your Django apps with Jython and SPDY by Emanuele PalazzettiCodemotion
 
Startup in Action - Makoo pitch
Startup in Action - Makoo pitchStartup in Action - Makoo pitch
Startup in Action - Makoo pitchCodemotion
 
L'approccio Open Source di Top-Network
L'approccio Open Source di Top-NetworkL'approccio Open Source di Top-Network
L'approccio Open Source di Top-NetworkCodemotion
 
Cercando il cigno giusto by Jacopo Romei
Cercando il cigno giusto by Jacopo RomeiCercando il cigno giusto by Jacopo Romei
Cercando il cigno giusto by Jacopo RomeiCodemotion
 
AngularJS: How to code today with tomorrow tools
AngularJS: How to code today with tomorrow toolsAngularJS: How to code today with tomorrow tools
AngularJS: How to code today with tomorrow toolsCodemotion
 

Viewers also liked (17)

Web Api 2.X - Lattanzi
Web Api 2.X - LattanziWeb Api 2.X - Lattanzi
Web Api 2.X - Lattanzi
 
Domain Driven Design + Command Query Responsibility Segregation + Event Sourc...
Domain Driven Design + Command Query Responsibility Segregation + Event Sourc...Domain Driven Design + Command Query Responsibility Segregation + Event Sourc...
Domain Driven Design + Command Query Responsibility Segregation + Event Sourc...
 
Cara cloud, ha chiamato l’utente, rivuole la sicurezza by Alessandro Manfredi
Cara cloud, ha chiamato l’utente, rivuole la sicurezza by Alessandro ManfrediCara cloud, ha chiamato l’utente, rivuole la sicurezza by Alessandro Manfredi
Cara cloud, ha chiamato l’utente, rivuole la sicurezza by Alessandro Manfredi
 
Empowering the Mobile Web - Mills
Empowering the Mobile Web - MillsEmpowering the Mobile Web - Mills
Empowering the Mobile Web - Mills
 
Drag, drop, play and party. How you can run your own radio station in 90 seco...
Drag, drop, play and party. How you can run your own radio station in 90 seco...Drag, drop, play and party. How you can run your own radio station in 90 seco...
Drag, drop, play and party. How you can run your own radio station in 90 seco...
 
Introduction to the hadoop ecosystem by Uwe Seiler
Introduction to the hadoop ecosystem by Uwe SeilerIntroduction to the hadoop ecosystem by Uwe Seiler
Introduction to the hadoop ecosystem by Uwe Seiler
 
Release Responsibly
Release ResponsiblyRelease Responsibly
Release Responsibly
 
Past, Present and Future of Data Processing in Apache Hadoop
Past, Present and Future of Data Processing in Apache HadoopPast, Present and Future of Data Processing in Apache Hadoop
Past, Present and Future of Data Processing in Apache Hadoop
 
HTML5 Up and Running
HTML5 Up and RunningHTML5 Up and Running
HTML5 Up and Running
 
Crea il tuo ecosistema - Francesco Fullone - Codemotion Milan 2014
Crea il tuo ecosistema - Francesco Fullone - Codemotion Milan 2014Crea il tuo ecosistema - Francesco Fullone - Codemotion Milan 2014
Crea il tuo ecosistema - Francesco Fullone - Codemotion Milan 2014
 
Curricoolum
CurricoolumCurricoolum
Curricoolum
 
Sviluppare Indie Games su Xbox360 con C# e XNA Game Studio
Sviluppare Indie Games su Xbox360 con C# e XNA Game StudioSviluppare Indie Games su Xbox360 con C# e XNA Game Studio
Sviluppare Indie Games su Xbox360 con C# e XNA Game Studio
 
Speed up your Django apps with Jython and SPDY by Emanuele Palazzetti
Speed up your Django apps with Jython and SPDY by Emanuele PalazzettiSpeed up your Django apps with Jython and SPDY by Emanuele Palazzetti
Speed up your Django apps with Jython and SPDY by Emanuele Palazzetti
 
Startup in Action - Makoo pitch
Startup in Action - Makoo pitchStartup in Action - Makoo pitch
Startup in Action - Makoo pitch
 
L'approccio Open Source di Top-Network
L'approccio Open Source di Top-NetworkL'approccio Open Source di Top-Network
L'approccio Open Source di Top-Network
 
Cercando il cigno giusto by Jacopo Romei
Cercando il cigno giusto by Jacopo RomeiCercando il cigno giusto by Jacopo Romei
Cercando il cigno giusto by Jacopo Romei
 
AngularJS: How to code today with tomorrow tools
AngularJS: How to code today with tomorrow toolsAngularJS: How to code today with tomorrow tools
AngularJS: How to code today with tomorrow tools
 

Similar to Avete avuto l'idea per il nuovo Flappy Birds? - Anelli

Non Conventional Android Programming (Italiano)
Non Conventional Android Programming (Italiano)Non Conventional Android Programming (Italiano)
Non Conventional Android Programming (Italiano)Davide Cerbo
 
Raspberry pi per tutti (workshop presso Warehouse Coworking Pesaro)
Raspberry pi per tutti (workshop presso Warehouse Coworking Pesaro)Raspberry pi per tutti (workshop presso Warehouse Coworking Pesaro)
Raspberry pi per tutti (workshop presso Warehouse Coworking Pesaro)Gabriele Guizzardi
 
Jug Roma - Wii Remote
Jug Roma - Wii RemoteJug Roma - Wii Remote
Jug Roma - Wii Remotedecabyte
 
Sviluppo e deployment cross-platform: Dal mobile alla Tv
Sviluppo e deployment cross-platform: Dal mobile alla Tv Sviluppo e deployment cross-platform: Dal mobile alla Tv
Sviluppo e deployment cross-platform: Dal mobile alla Tv Codemotion
 
Go reactive with Realm and Xamarin Forms - Andrea Ceroni - Codemotion Rome 2018
Go reactive with Realm and Xamarin Forms - Andrea Ceroni - Codemotion Rome 2018Go reactive with Realm and Xamarin Forms - Andrea Ceroni - Codemotion Rome 2018
Go reactive with Realm and Xamarin Forms - Andrea Ceroni - Codemotion Rome 2018Codemotion
 
Applicazione JavaFX – CORSA DI AUTO SU TRACCIATI REALI
Applicazione JavaFX – CORSA DI AUTO SU TRACCIATI REALIApplicazione JavaFX – CORSA DI AUTO SU TRACCIATI REALI
Applicazione JavaFX – CORSA DI AUTO SU TRACCIATI REALIbenfante
 
01 Android - Introduction
01   Android - Introduction01   Android - Introduction
01 Android - Introductionspawn150
 
Introduzione ad ubuntu core - Qt day 2017
Introduzione ad ubuntu core  - Qt day 2017Introduzione ad ubuntu core  - Qt day 2017
Introduzione ad ubuntu core - Qt day 2017Marco Trevisan
 
Having fun with Adobe AIR 2013
Having fun with Adobe AIR 2013Having fun with Adobe AIR 2013
Having fun with Adobe AIR 2013luca mezzalira
 
Alessandro Forte - Piattaforma Android
Alessandro Forte - Piattaforma AndroidAlessandro Forte - Piattaforma Android
Alessandro Forte - Piattaforma AndroidAlessandro Forte
 
Smau padova 2013 gianfranco tonello
Smau padova 2013 gianfranco tonelloSmau padova 2013 gianfranco tonello
Smau padova 2013 gianfranco tonelloSMAU
 
Al telefono con Adhearsion e Ruby
Al telefono con Adhearsion e RubyAl telefono con Adhearsion e Ruby
Al telefono con Adhearsion e RubyLuca Pradovera
 
CodingGym - Lezione 3 - Corso Linux, Android e Internet of Things
CodingGym - Lezione 3 - Corso Linux, Android e Internet of ThingsCodingGym - Lezione 3 - Corso Linux, Android e Internet of Things
CodingGym - Lezione 3 - Corso Linux, Android e Internet of ThingsMirko Mancin
 
Introduzione alla programmazione Android - Android@tulug
Introduzione alla programmazione Android - Android@tulugIntroduzione alla programmazione Android - Android@tulug
Introduzione alla programmazione Android - Android@tulugIvan Gualandri
 

Similar to Avete avuto l'idea per il nuovo Flappy Birds? - Anelli (20)

Non Conventional Android Programming (Italiano)
Non Conventional Android Programming (Italiano)Non Conventional Android Programming (Italiano)
Non Conventional Android Programming (Italiano)
 
Raspberry pi per tutti (workshop presso Warehouse Coworking Pesaro)
Raspberry pi per tutti (workshop presso Warehouse Coworking Pesaro)Raspberry pi per tutti (workshop presso Warehouse Coworking Pesaro)
Raspberry pi per tutti (workshop presso Warehouse Coworking Pesaro)
 
Jug Roma - Wii Remote
Jug Roma - Wii RemoteJug Roma - Wii Remote
Jug Roma - Wii Remote
 
Sviluppo e deployment cross-platform: Dal mobile alla Tv
Sviluppo e deployment cross-platform: Dal mobile alla Tv Sviluppo e deployment cross-platform: Dal mobile alla Tv
Sviluppo e deployment cross-platform: Dal mobile alla Tv
 
XPages Tips & Tricks, #dd13
XPages Tips & Tricks, #dd13XPages Tips & Tricks, #dd13
XPages Tips & Tricks, #dd13
 
Flutter
FlutterFlutter
Flutter
 
Go reactive with Realm and Xamarin Forms - Andrea Ceroni - Codemotion Rome 2018
Go reactive with Realm and Xamarin Forms - Andrea Ceroni - Codemotion Rome 2018Go reactive with Realm and Xamarin Forms - Andrea Ceroni - Codemotion Rome 2018
Go reactive with Realm and Xamarin Forms - Andrea Ceroni - Codemotion Rome 2018
 
Applicazione JavaFX – CORSA DI AUTO SU TRACCIATI REALI
Applicazione JavaFX – CORSA DI AUTO SU TRACCIATI REALIApplicazione JavaFX – CORSA DI AUTO SU TRACCIATI REALI
Applicazione JavaFX – CORSA DI AUTO SU TRACCIATI REALI
 
01 Android - Introduction
01   Android - Introduction01   Android - Introduction
01 Android - Introduction
 
Io, Android
Io, AndroidIo, Android
Io, Android
 
Introduzione ad ubuntu core - Qt day 2017
Introduzione ad ubuntu core  - Qt day 2017Introduzione ad ubuntu core  - Qt day 2017
Introduzione ad ubuntu core - Qt day 2017
 
Having fun with Adobe AIR 2013
Having fun with Adobe AIR 2013Having fun with Adobe AIR 2013
Having fun with Adobe AIR 2013
 
Alessandro Forte - Piattaforma Android
Alessandro Forte - Piattaforma AndroidAlessandro Forte - Piattaforma Android
Alessandro Forte - Piattaforma Android
 
Smau padova 2013 gianfranco tonello
Smau padova 2013 gianfranco tonelloSmau padova 2013 gianfranco tonello
Smau padova 2013 gianfranco tonello
 
Al telefono con Adhearsion e Ruby
Al telefono con Adhearsion e RubyAl telefono con Adhearsion e Ruby
Al telefono con Adhearsion e Ruby
 
Openmoko
OpenmokoOpenmoko
Openmoko
 
Unit testing 101
Unit testing 101Unit testing 101
Unit testing 101
 
TuxIsAlive
TuxIsAliveTuxIsAlive
TuxIsAlive
 
CodingGym - Lezione 3 - Corso Linux, Android e Internet of Things
CodingGym - Lezione 3 - Corso Linux, Android e Internet of ThingsCodingGym - Lezione 3 - Corso Linux, Android e Internet of Things
CodingGym - Lezione 3 - Corso Linux, Android e Internet of Things
 
Introduzione alla programmazione Android - Android@tulug
Introduzione alla programmazione Android - Android@tulugIntroduzione alla programmazione Android - Android@tulug
Introduzione alla programmazione Android - Android@tulug
 

More from Codemotion

Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...Codemotion
 
Pompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending storyPompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending storyCodemotion
 
Pastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storiaPastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storiaCodemotion
 
Pennisi - Essere Richard Altwasser
Pennisi - Essere Richard AltwasserPennisi - Essere Richard Altwasser
Pennisi - Essere Richard AltwasserCodemotion
 
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...Codemotion
 
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019Codemotion
 
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019Codemotion
 
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 - Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 - Codemotion
 
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...Codemotion
 
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...Codemotion
 
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...Codemotion
 
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...Codemotion
 
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019Codemotion
 
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019Codemotion
 
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019Codemotion
 
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...Codemotion
 
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...Codemotion
 
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019Codemotion
 
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019Codemotion
 
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019Codemotion
 

More from Codemotion (20)

Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
 
Pompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending storyPompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending story
 
Pastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storiaPastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storia
 
Pennisi - Essere Richard Altwasser
Pennisi - Essere Richard AltwasserPennisi - Essere Richard Altwasser
Pennisi - Essere Richard Altwasser
 
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
 
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
 
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
 
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 - Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
 
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
 
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
 
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
 
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
 
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
 
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
 
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
 
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
 
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
 
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
 
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
 
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
 

Recently uploaded

Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...
Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...
Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...Associazione Digital Days
 
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...Associazione Digital Days
 
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...Associazione Digital Days
 
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...Associazione Digital Days
 
Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...
Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...
Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...Associazione Digital Days
 
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...Associazione Digital Days
 
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”Associazione Digital Days
 
Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...
Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...
Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...Associazione Digital Days
 
Programma Biennale Tecnologia 2024 Torino
Programma Biennale Tecnologia 2024 TorinoProgramma Biennale Tecnologia 2024 Torino
Programma Biennale Tecnologia 2024 TorinoQuotidiano Piemontese
 

Recently uploaded (9)

Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...
Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...
Gabriele Mittica, CEO @Corley Cloud – “Come creare un’azienda “nativa in clou...
 
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
 
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
 
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
 
Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...
Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...
Mael Chiabrera, Software Developer; Viola Bongini, Digital Experience Designe...
 
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
 
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
 
Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...
Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...
Alessandro Nasi, COO @Djungle Studio – “Cosa delegheresti alla copia di te st...
 
Programma Biennale Tecnologia 2024 Torino
Programma Biennale Tecnologia 2024 TorinoProgramma Biennale Tecnologia 2024 Torino
Programma Biennale Tecnologia 2024 Torino
 

Avete avuto l'idea per il nuovo Flappy Birds? - Anelli

  • 1. ROME 11-12 april 2014ROME 11-12 april 2014 Avete avuto l’idea per il nuovo Flappy Birds? Introduzione a libGDX E-Mail: matteo.anelli@nttdata.com Twitter: @matteoanelli Xbox Live, PSN, Steam: Ziggybee Matteo Anelli (NTT DATA)
  • 2. ROME 11-12 april 2014 Perché usare libgdx?  Oltre l’1.5% dei titoli Play Store la usa (è il primo framework per giochi)  Standardizza lo sviluppo e minimizza i costi di start-up indie  Permette una prototipazione molto rapida perché offre funzionalità di base per:  Grafica 2D e 3D  Audio  Astrazione degli input  Primitive matematiche (vettori, operatori 3D)  Networking (TCP, HTTP)  File System  User Interface  E’ ampiamente testata, con centinaia di app e giochi distribuiti con questa tecnologia  E’ Open Source! Requisiti:  PC/Mac: JVM e supporto OpenGL  Android: Supporto OpenGL ES 2.x o superiore  iOS: RoboVM  BlackBerry: ci interessa davvero?
  • 3. ROME 11-12 april 2014 - Speaker’s name Architettura di libGDX
  • 4. ROME 11-12 april 2014 Architettura di libGDX
  • 5. ROME 11-12 april 2014  One-Button Game  Tappando lo schermo il passerotto si libra  Se tocca i tubi muore  I tubi scorrono a sinistra  Se il passerotto non batte le ali la gravità lo fa schiantare TAP! Il prototipo
  • 6. ROME 11-12 april 2014 Game Cover!
  • 7. ROME 11-12 april 2014 FlappyGame GameScreenGameWorld GameRenderer AssetLoader ScrollHandler Componenti
  • 8. ROME 11-12 april 2014 public class FlappyGame extends Game { @Override public void create() { AssetLoader.load(); setScreen(new GameScreen()); } @Override public void dispose() { super.dispose(); AssetLoader.dispose(); } } La main class di un progetto libgdx è la classe Game. Possiede solo due metodi:  Create per l’inizializzazione dell’app.  Dispose per la liberazione delle risorse prima della chiusura dell’app. Nel nostro caso all’avvio vengono caricati gli asset di gioco (immagini, suoni, etc) e viene definito il GameScreen di partenza FlappyGame
  • 9. ROME 11-12 april 2014 Uno Screen è qualcosa di molto simile ad una classe Activity in Android. Rappresenta uno stato dell’App che svolge una funzione. Per semplicità l’esempio usa un singolo Screen. Un gioco è come un film, ad ogni ciclo se ne calcola un fotogramma. Lo screen, tramite il metodo render permette di controllare il disegno di un fotogramma. public class GameScreen implements Screen { private GameWorld world; private GameRenderer renderer; public GameScreen() { float screenWidth = Gdx.graphics.getWidth(); float screenHeight = Gdx.graphics.getHeight(); float gameWidth = 136; float gameHeight = screenHeight / (screenWidth / gameWidth); int midPointY = (int) (gameHeight / 2); world = new GameWorld(midPointY); renderer = new GameRenderer(world, (int) gameHeight, midPointY); Gdx.input.setInputProcessor( new InputHandler(world)); } @Override public void render(float delta) { runTime += delta; world.update(delta); renderer.render(runTime); } GameScreen
  • 10. ROME 11-12 april 2014 La classe principale del gioco, non è un oggetto libgdx ma rappresenta il core del gioco, il centro di controllo dell’intera logica dell’applicazione public void updateRunning(float delta) { if (delta > .15f) { delta = .15f; } bird.update(delta); scroller.update(delta); if (scroller.collides(bird) && bird.isAlive()) { scroller.stop(); bird.die(); AssetLoader.dead.play(); } if (Intersector.overlaps( bird.getBoundingCircle(), ground) && currentState == GameState.RUNNING) { scroller.stop(); bird.die(); bird.decelerate(); currentState = GameState.GAMEOVER; if (score > AssetLoader.getHighScore()) { AssetLoader.setHighScore(score); currentState = GameState.HIGHSCORE; } } } GameWorld
  • 11. ROME 11-12 april 2014 public void update(float delta){ frontGrass.update(delta); backGrass.update(delta); pipe1.update(delta); pipe2.update(delta); pipe3.update(delta); if (pipe1.isScrolledLeft()){ pipe1.reset(pipe3.getTailX() + PIPE_GAP); } else if (pipe2.isScrolledLeft()) { pipe2.reset(pipe1.getTailX() + PIPE_GAP); } else if (pipe3.isScrolledLeft()) { pipe3.reset(pipe2.getTailX() + PIPE_GAP); } if (frontGrass.isScrolledLeft()) { frontGrass.reset(backGrass.getTailX()); } else if (backGrass.isScrolledLeft()) { backGrass.reset(frontGrass.getTailX()); } } Lo scrolling non fa altro che «aggiornare» gli elementi del nostro mondo. Lo scroller controlla anche che i tubi non siano usciti fuori dallo schermo. In quel caso li resetta, accodandoli alla destra dell’ultimo tubo a schermo. ScrollHandler
  • 12. ROME 11-12 april 2014 La fisica è molto semplice: c’è un’accelerazione costante che spinge l’uccello verso il basso. In realtà l’uccello si muove solo in verticale, l’effetto proiettile è dato dagli altri elementi che scorrono! public void update(float delta) { velocity.add(acceleration.cpy().scl(delta)); if (velocity.y > 200) { velocity.y = 200; } // CEILING CHECK if (position.y < -13) { position.y = -13; velocity.y = 0; } position.add(velocity.cpy().scl(delta)); boundingCircle.set(position.x + 9, position.y + 6, 6.5f); // Rotate counterclockwise if (velocity.y < 0) { rotation -= 600 * delta; if (rotation < -20) { rotation = -20; } } // Rotate clockwise if (isFalling() || !isAlive) { rotation += 480 * delta; if (rotation > 90) { rotation = 90; } } } public void onClick() { if (isAlive) { AssetLoader.flap.play(); velocity.y = -140; } } Fisica
  • 13. ROME 11-12 april 2014 Il rendering avviene tramite il wrapping delle funzioni OpenGL ES con il componente Gdx.gl Nei giochi 2D ogni sprite è una Texture. Per evitare di sovraccaricare la GPU la libreria effettua un buffering delle operazioni. Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); shapeRenderer.begin(ShapeType.Filled); // Draw Background color shapeRenderer.setColor(30 / 255.0f, 125 / 255.0f, 205 / 255.0f, 1); shapeRenderer.rect(0, 0, 136, midPointY + 66); . . . shapeRenderer.end(); batcher.begin(); batcher.disableBlending(); batcher.draw(bg, 0, midPointY + 23, 136, 43); drawGrass(); drawPipes(); batcher.enableBlending(); if (bird.shouldntFlap()) { batcher.draw(birdMid, bird.getX(), bird.getY(), bird.getWidth() / 2.0f, bird.getHeight() / 2.0f, bird.getWidth(), bird.getHeight(), 1, 1, bird.getRotation()); } else { batcher.draw(birdAnimation.getKeyFrame(runTime), bird.getX(), bird.getY(), bird.getWidth() / 2.0f, bird.getHeight() / 2.0f, bird.getWidth(), bird.getHeight(), 1, 1, bird.getRotation()); } batcher.end(); Rendering
  • 14. ROME 11-12 april 2014 Domande?
  • 15. ROME 11-12 april 2014 Tutorial completo di Kilobolt: http://www.kilobolt.com/zombie-bird-tutorial-flappy-bird-remake.html Sito ufficiale libGDX: http://libgdx.badlogicgames.com/ Android Development Tools: http://developer.android.com/sdk/index.html RoboVM: http://www.robovm.org/ Codice sorgente: https://drive.google.com/file/d/0B9LBtD2_WpFcVTgzLWZuRkxfVW8 Ottimi Screencast: https://www.youtube.com/user/dermetfan/playlists?sort=dd&shelf_id=3&view=50