SlideShare una empresa de Scribd logo
Proyecto Integrador
Nave, mapa y obstáculos
Creación de nave
// se declara objeto Player_1
static final int VelocityPlayer_1 = 300;
private Player Player_1;
// Cargamos la carpeta de recursos gfx, donde estan las
imágenes que usaremos para la nave, mapa, enemigos y disparos.
BitmapTextureRegionFactory.setAssetBasePath("gfx/");
// asignamos un espacio para Player_1, su imagen, textura y
posición inicial
this.BitmapTexture_Player_1 = new BitmapTexture(128, 128,
TextureOptions.DEFAULT);
this.TextureRegion_Player1 = BitmapTextureRegionFactory
.createTiledFromAsset(this.BitmapTexture_Player_1, this,
"Player_1.png", 0, 0, 1, 1);
this.mEngine.getTextureManager().loadTexture(
this.BitmapTexture_Player_1);
Creación de mapa
// Cargamos el mapa a la Pantalla y el player al mapa
this.BackgroundTexture = new BitmapTexture(1024, 1024,
TextureOptions.DEFAULT);
this.BackgroundLayerBack =
BitmapTextureRegionFactory.createFromAsset(
this.BackgroundTexture, this, "background.png", 0, 0);
this.mEngine.getTextureManager().loadTextures(
this.BitmapTexture_Player_1, this.BackgroundTexture);
// Camara
static final int CAMERA_WIDTH = 800;
static final int CAMERA_HEIGHT = 480;al int CAMERA_HEIGHT
= 480;
// Margenes Pantalla
public Shape ground;
public Shape roof;
public Shape left;
public Shape right;
ground = new Rectangle(0, CAMERA_HEIGHT -
25, CAMERA_WIDTH, 25);
roof = new Rectangle(0, 0, CAMERA_WIDTH, 25);
left = new Rectangle(0, 0, 50, CAMERA_HEIGHT);
right = new Rectangle(CAMERA_WIDTH -
50, 0, 50, CAMERA_HEIGHT);
//Pondremos como no visibles los margenes ya que solo
se deben mostrar durante el juego
ground.setVisible(false);
roof.setVisible(false);
left.setVisible(false);
right.setVisible(false);
scene.attachChild(ground);
scene.attachChild(roof);
scene.attachChild(left);
scene.attachChild(right);
Creacion de enemigos
// Declaración de objeto enemigo, su bitmap , su
textura , cantidad de enemigos y una lista que nos
ayudara a enlistar la manera en que aparecerán.
private BitmapTexture BitmapTexture_EnemyUFO;
private TiledTextureRegion TextureRegion_EnemyUFO;
public int num_Enemy = 5;
private ArrayList<Enemy> listaEnemigos = new
ArrayList<Enemy>();
Creacion de enemigos
// Asignacion de espacio, textura, imagen y posicion
del enemigo
this.BitmapTexture_EnemyUFO = new
BitmapTexture(512, 512,
TextureOptions.DEFAULT);
this.TextureRegion_EnemyUFO =
BitmapTextureRegionFactory
.createTiledFromAsset(this.BitmapTexture_EnemyUFO, this
,
"EnemyUFO.png", 0, 0, 8, 5);
this.mEngine.getTextureManager().loadTexture(
this.BitmapTexture_EnemyUFO);
Control de movimiento
//Declaracion del Joystick, para el movimiento de
la nave
private DigitalOnScreenControl
mDigitalOnScreenControl;
private BitmapTexture mOnScreenControlTexture;
private TextureRegion
mOnScreenControlBaseTextureRegion;
private TextureRegion
mOnScreenControlKnobTextureRegion;
public float DigitalControlX = 0;
public float DigitalControlY = 0;
// Cargamos las imagenes del joystick, dandole un espacio, textura y
posicion dentro del mapa
this.mOnScreenControlTexture = new BitmapTexture(256, 128,
TextureOptions.BILINEAR_PREMULTIPLYALPHA);
this.mOnScreenControlBaseTextureRegion = BitmapTextureRegionFactory
.createFromAsset(this.mOnScreenControlTexture, this,
"onscreen_control_base.png", 0, 0);
//Cargamos el control de movimiento digital
this.mOnScreenControlKnobTextureRegion = BitmapTextureRegionFactory
.createFromAsset(this.mOnScreenControlTexture, this,
"onscreen_control_knob.png", 128, 0);
this.mEngine.getTextureManager().loadTextures(
this.BitmapTexture_Player_1, this.mOnScreenControlTexture);
Botón de Disparos
// Declaración de Boton disparar
private BitmapTexture BitmapTexture_boton_Disparo;
private TextureRegion TextureRegion_boton_Disparo;
// Cargamos la imagen Boton disparo, en un espacio, con textura y su
posicion
BitmapTexture_boton_Disparo = new BitmapTexture(128, 128,
TextureOptions.DEFAULT);
TextureRegion_boton_Disparo = BitmapTextureRegionFactory
.createFromAsset(BitmapTexture_boton_Disparo, this,
"botonDisparar.png", 0, 0);
mEngine.getTextureManager().loadTexture(
this.BitmapTexture_boton_Disparo);
Disparos
//Declaración del Disparo
private BitmapTexture BitmapTexture_Disparo;
public TiledTextureRegion TextureRegion_Disparo;
private ArrayList<Disparo> listaDisparos = new
ArrayList<Disparo>();
public boolean flag_disparo = false;
// Agregamos el Disparoa la pantalla en un espacio, con textura
y la posicion inicial
this.BitmapTexture_Disparo = new BitmapTexture(64, 64,
TextureOptions.DEFAULT);
this.TextureRegion_Disparo = BitmapTextureRegionFactory
.createTiledFromAsset(this.BitmapTexture_Disparo, this,
"disparo.png", 0, 0, 1, 2);
this.mEngine.getTextureManager()
.loadTexture(this.BitmapTexture_Disparo);
Barra de vida
// Level Live
public Rectangle level_life;
private BitmapTexture BitmapTexture_level_life_Background;
private TextureRegion TextureRegion_level_life_Background;
// Cargamos imagenes de la barra de vida con sus datos correspondientes
BitmapTexture_level_life_Background = new BitmapTexture(128, 32,
TextureOptions.DEFAULT);
TextureRegion_level_life_Background = BitmapTextureRegionFactory
.createFromAsset(this.BitmapTexture_level_life_Background,
this, "level_life_background.png", 0, 0);
mEngine.getTextureManager().loadTexture(
BitmapTexture_level_life_Background);
Mapa y obstaculos

Más contenido relacionado

Destacado

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Mapa y obstaculos

  • 2. Creación de nave // se declara objeto Player_1 static final int VelocityPlayer_1 = 300; private Player Player_1; // Cargamos la carpeta de recursos gfx, donde estan las imágenes que usaremos para la nave, mapa, enemigos y disparos. BitmapTextureRegionFactory.setAssetBasePath("gfx/"); // asignamos un espacio para Player_1, su imagen, textura y posición inicial this.BitmapTexture_Player_1 = new BitmapTexture(128, 128, TextureOptions.DEFAULT); this.TextureRegion_Player1 = BitmapTextureRegionFactory .createTiledFromAsset(this.BitmapTexture_Player_1, this, "Player_1.png", 0, 0, 1, 1); this.mEngine.getTextureManager().loadTexture( this.BitmapTexture_Player_1);
  • 3. Creación de mapa // Cargamos el mapa a la Pantalla y el player al mapa this.BackgroundTexture = new BitmapTexture(1024, 1024, TextureOptions.DEFAULT); this.BackgroundLayerBack = BitmapTextureRegionFactory.createFromAsset( this.BackgroundTexture, this, "background.png", 0, 0); this.mEngine.getTextureManager().loadTextures( this.BitmapTexture_Player_1, this.BackgroundTexture);
  • 4. // Camara static final int CAMERA_WIDTH = 800; static final int CAMERA_HEIGHT = 480;al int CAMERA_HEIGHT = 480; // Margenes Pantalla public Shape ground; public Shape roof; public Shape left; public Shape right; ground = new Rectangle(0, CAMERA_HEIGHT - 25, CAMERA_WIDTH, 25); roof = new Rectangle(0, 0, CAMERA_WIDTH, 25); left = new Rectangle(0, 0, 50, CAMERA_HEIGHT); right = new Rectangle(CAMERA_WIDTH - 50, 0, 50, CAMERA_HEIGHT);
  • 5. //Pondremos como no visibles los margenes ya que solo se deben mostrar durante el juego ground.setVisible(false); roof.setVisible(false); left.setVisible(false); right.setVisible(false); scene.attachChild(ground); scene.attachChild(roof); scene.attachChild(left); scene.attachChild(right);
  • 6. Creacion de enemigos // Declaración de objeto enemigo, su bitmap , su textura , cantidad de enemigos y una lista que nos ayudara a enlistar la manera en que aparecerán. private BitmapTexture BitmapTexture_EnemyUFO; private TiledTextureRegion TextureRegion_EnemyUFO; public int num_Enemy = 5; private ArrayList<Enemy> listaEnemigos = new ArrayList<Enemy>();
  • 7. Creacion de enemigos // Asignacion de espacio, textura, imagen y posicion del enemigo this.BitmapTexture_EnemyUFO = new BitmapTexture(512, 512, TextureOptions.DEFAULT); this.TextureRegion_EnemyUFO = BitmapTextureRegionFactory .createTiledFromAsset(this.BitmapTexture_EnemyUFO, this , "EnemyUFO.png", 0, 0, 8, 5); this.mEngine.getTextureManager().loadTexture( this.BitmapTexture_EnemyUFO);
  • 8. Control de movimiento //Declaracion del Joystick, para el movimiento de la nave private DigitalOnScreenControl mDigitalOnScreenControl; private BitmapTexture mOnScreenControlTexture; private TextureRegion mOnScreenControlBaseTextureRegion; private TextureRegion mOnScreenControlKnobTextureRegion; public float DigitalControlX = 0; public float DigitalControlY = 0;
  • 9. // Cargamos las imagenes del joystick, dandole un espacio, textura y posicion dentro del mapa this.mOnScreenControlTexture = new BitmapTexture(256, 128, TextureOptions.BILINEAR_PREMULTIPLYALPHA); this.mOnScreenControlBaseTextureRegion = BitmapTextureRegionFactory .createFromAsset(this.mOnScreenControlTexture, this, "onscreen_control_base.png", 0, 0); //Cargamos el control de movimiento digital this.mOnScreenControlKnobTextureRegion = BitmapTextureRegionFactory .createFromAsset(this.mOnScreenControlTexture, this, "onscreen_control_knob.png", 128, 0); this.mEngine.getTextureManager().loadTextures( this.BitmapTexture_Player_1, this.mOnScreenControlTexture);
  • 10. Botón de Disparos // Declaración de Boton disparar private BitmapTexture BitmapTexture_boton_Disparo; private TextureRegion TextureRegion_boton_Disparo; // Cargamos la imagen Boton disparo, en un espacio, con textura y su posicion BitmapTexture_boton_Disparo = new BitmapTexture(128, 128, TextureOptions.DEFAULT); TextureRegion_boton_Disparo = BitmapTextureRegionFactory .createFromAsset(BitmapTexture_boton_Disparo, this, "botonDisparar.png", 0, 0); mEngine.getTextureManager().loadTexture( this.BitmapTexture_boton_Disparo);
  • 11. Disparos //Declaración del Disparo private BitmapTexture BitmapTexture_Disparo; public TiledTextureRegion TextureRegion_Disparo; private ArrayList<Disparo> listaDisparos = new ArrayList<Disparo>(); public boolean flag_disparo = false; // Agregamos el Disparoa la pantalla en un espacio, con textura y la posicion inicial this.BitmapTexture_Disparo = new BitmapTexture(64, 64, TextureOptions.DEFAULT); this.TextureRegion_Disparo = BitmapTextureRegionFactory .createTiledFromAsset(this.BitmapTexture_Disparo, this, "disparo.png", 0, 0, 1, 2); this.mEngine.getTextureManager() .loadTexture(this.BitmapTexture_Disparo);
  • 12. Barra de vida // Level Live public Rectangle level_life; private BitmapTexture BitmapTexture_level_life_Background; private TextureRegion TextureRegion_level_life_Background; // Cargamos imagenes de la barra de vida con sus datos correspondientes BitmapTexture_level_life_Background = new BitmapTexture(128, 32, TextureOptions.DEFAULT); TextureRegion_level_life_Background = BitmapTextureRegionFactory .createFromAsset(this.BitmapTexture_level_life_Background, this, "level_life_background.png", 0, 0); mEngine.getTextureManager().loadTexture( BitmapTexture_level_life_Background);