SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Downloaden Sie, um offline zu lesen
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Game Development with AndEngine GLES2
Daniela da Cruz

Computação Móvel
Licenciatura em Engenharia de Jogos Digitais
Instituto Politécnico do Cávado e do Ave
October 28, 2013

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Introduction
Basic Elements
Camera
Engine
Scene
Entity
Texture  TextureRegion
Creating the rst scene with AndEngine
Handling Scene touches

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Introduction

AndEngine is a free open source OpenGL Android game engine,
developed by Nicolas Gramlich.
AndEngine is currently available in two avors: GLES1 and GLES2.
GLES2, as you might guess, supports OpenGL ES 2.0.

https://github.com/nicolasgramlich
http://www.matim-dev.com/

Latest version:
Tutorials:

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Introduction
AndEngine Advantages:

It has a complete 2-D scene graph, with a very easy-to-use
API.
It works great with the Android activity lifecycle.
It has a number of extensions that can be added as plugins.
It has multi-touch support.
It's free and open-source.
AndEngine Disadvantages:

The API is undocumented.
Sometimes slower in comparison to other engines.

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Basic Elements

To create a scene we need 3 basic elements:
Camera
Engine
Scene

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Camera

Camera

Since all is based in a game scene we need to setup a camera:

Camera(pX, pY, pWidth, pHeight);
pX and pY are the coordinates for the origin of the camera
pWidth and pHeight are the dimensions, in pixels, of the
camera

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Engine

Engine
In the engine we dene which camera will be used on the scene:

EngineOptions(pFullscreen, pScreenOrientation,
pResolutionPolicy(pWidth, pHeight), pCamera)
pFullscreen determines whether the game will be play full
screen or not
pScreenOrientation, here we can choose between
LANDSCAPE and PORTRAIT
pResolutionPolicy is the ratio of our Engine (same values as in
Camera)
pCamera is the camera object

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Scene

Scene
The Scene class is the root container for all objects to be drawn on
the screen.
A Scene has a specic amount of Layers, which themselves can
contain a (xed or dynamic) amount of Entities.
There are subclasses, like the CameraScene/HUD/MenuScene that
are drawing themselves to the same position of the Scene no
matter where the camera is positioned to.
HUD (heads-up display)  usage for example for score (it has

to be all the time in the same position, follow camera
changes).

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Entity

Entity
An

Entitiy is an object that can be drawn, like Sprites, Rectangles,

Text or Lines.
An Entity has a position/rotation/scale/color/etc.
Sprite - entity with texture
TiledSprite - entity with tiled texture, you may switch between
tiles.
AnimatedSprite - extension of the TiledSprite, you may
animate tiles in specied intervals.

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Texture  TextureRegion

Texture  TextureRegion

A Texture is a 'image' in the memory of the graphics chip.
A TextureRegion denes a rectangle on the Texture. A
TextureRegion is used by Sprites to let the system know what part
of the big Texture the Sprite is showing.

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Creating the rst scene with AndEngine

The rst le created by the project is an

Activity.

And the rst thing to do in our project is to change the class that
this Activity extends.
Instead of extending the Activity class, we want to make it extend a
class called SimpleBaseGameActivity.

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Creating the rst scene with AndEngine

The SimpleBaseActivity class provides additional callbacks and
contains the code to make AndEngine work with the Activity life
cycle.
Each callback that it provides is used for a specic purpose. As
soon as you extend this class, we will have to override three
functions.

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Extending SimpleBaseGameActivity
onCreateEngineOptions  this function is where you create

an instance of the engine. Every activity that the game uses
will have its own instance of the engine that will run within the
activity lifecycle.
onCreateResources  this is the function where we load all

the resources that the activity requires into the the VRAM.
onCreateScene  this function is called after the above two

callbacks are executed. This is where we create the scene for
our game and use all the textures that we previously loaded
into memory.

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Extending SimpleBaseGameActivity

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Creating a Sprite
When creating a Sprite object, we pass four parameters:
xCoordinate: Denes the X-position of the sprite.
yCoordinate: Denes the Y-position of the sprite.
TextureRegion: Denes what part of the texture the sprite will
use to draw itself.
VertexBuerObjectManager: Think of a vertex buer as an
array holding the coordinates of a texture. These coordinates
are passed to the OpenGL ES pipeline and ultimately dene
what will be drawn. A VertexBuerObjectManager holds all
the vertices of all the textures that need to be drawn on the
scene.

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Attaching a Sprite to a Scene

To attach a sprite, to a dierent entity, for example to the Scene,
we have to simply call

attachChild

method:

anyEntity.attachChild(yourSprite);

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Handling Scene touches
Lets say we want to execute a certain action, every time the player
touches the screen.
We have to implement

IOnSceneTouchListener

interface.

Add unimplemented method.

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Handling Scene touches

The methods that identify if an event occurred or not are:

isActionDown(), isActionMove(), isActionUp().
Now all you have to do is to register this touch listener in a certain
scene:

scene.setOnSceneTouchListener(this);

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
Introduction

Basic Elements

Creating the rst scene with AndEngine

Handling Scene touches

Handling Entity touches
The problem of this approach is that it will handle every event that
occurs in the whole scene.
If we want to handle touch events of specic entities, we will need
to implement the method

onAreaTouch()

(the parameters are the

event and its coordinates).

Game Development with AndEngine GLES2
Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave

Weitere ähnliche Inhalte

Was ist angesagt?

Forest assassin 2 d platformer game
Forest assassin 2 d platformer gameForest assassin 2 d platformer game
Forest assassin 2 d platformer gameAnshuman Pattnaik
 
Introduction to Game Programming: Using C# and Unity 3D - Chapter 3 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 3 (Preview)Introduction to Game Programming: Using C# and Unity 3D - Chapter 3 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 3 (Preview)noorcon
 
The Basics of Unity - The Game Engine
The Basics of Unity - The Game EngineThe Basics of Unity - The Game Engine
The Basics of Unity - The Game EngineOrisysIndia
 
Introduction to Unity3D Game Engine
Introduction to Unity3D Game EngineIntroduction to Unity3D Game Engine
Introduction to Unity3D Game EngineMohsen Mirhoseini
 
Game Project / Working with Unity
Game Project / Working with UnityGame Project / Working with Unity
Game Project / Working with UnityPetri Lankoski
 
Unity Programming
Unity Programming Unity Programming
Unity Programming Sperasoft
 
The Ring programming language version 1.2 book - Part 36 of 84
The Ring programming language version 1.2 book - Part 36 of 84The Ring programming language version 1.2 book - Part 36 of 84
The Ring programming language version 1.2 book - Part 36 of 84Mahmoud Samir Fayed
 
Unity 3D game engine seminar
Unity 3D game engine  seminarUnity 3D game engine  seminar
Unity 3D game engine seminarNikhilThorat15
 
Y1 gd level_designworkflow
Y1 gd level_designworkflowY1 gd level_designworkflow
Y1 gd level_designworkflowcrisgalliano
 
Unity Introduction
Unity IntroductionUnity Introduction
Unity IntroductionJuwal Bose
 
The Ring programming language version 1.8 book - Part 55 of 202
The Ring programming language version 1.8 book - Part 55 of 202The Ring programming language version 1.8 book - Part 55 of 202
The Ring programming language version 1.8 book - Part 55 of 202Mahmoud Samir Fayed
 
Game Development with Unity
Game Development with UnityGame Development with Unity
Game Development with Unitydavidluzgouveia
 
Academy PRO: Unity 3D. Scripting
Academy PRO: Unity 3D. ScriptingAcademy PRO: Unity 3D. Scripting
Academy PRO: Unity 3D. ScriptingBinary Studio
 
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)noorcon
 
Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)noorcon
 
Game Engine Overview
Game Engine OverviewGame Engine Overview
Game Engine OverviewSharad Mitra
 

Was ist angesagt? (20)

Forest assassin 2 d platformer game
Forest assassin 2 d platformer gameForest assassin 2 d platformer game
Forest assassin 2 d platformer game
 
Introduction to Game Programming: Using C# and Unity 3D - Chapter 3 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 3 (Preview)Introduction to Game Programming: Using C# and Unity 3D - Chapter 3 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 3 (Preview)
 
The Basics of Unity - The Game Engine
The Basics of Unity - The Game EngineThe Basics of Unity - The Game Engine
The Basics of Unity - The Game Engine
 
Introduction to Unity3D Game Engine
Introduction to Unity3D Game EngineIntroduction to Unity3D Game Engine
Introduction to Unity3D Game Engine
 
Unity 3D, A game engine
Unity 3D, A game engineUnity 3D, A game engine
Unity 3D, A game engine
 
Game Project / Working with Unity
Game Project / Working with UnityGame Project / Working with Unity
Game Project / Working with Unity
 
WP7 HUB_XNA
WP7 HUB_XNAWP7 HUB_XNA
WP7 HUB_XNA
 
GameMaker Workflow
GameMaker WorkflowGameMaker Workflow
GameMaker Workflow
 
Unity Programming
Unity Programming Unity Programming
Unity Programming
 
The Ring programming language version 1.2 book - Part 36 of 84
The Ring programming language version 1.2 book - Part 36 of 84The Ring programming language version 1.2 book - Part 36 of 84
The Ring programming language version 1.2 book - Part 36 of 84
 
Unity 3D game engine seminar
Unity 3D game engine  seminarUnity 3D game engine  seminar
Unity 3D game engine seminar
 
Y1 gd level_designworkflow
Y1 gd level_designworkflowY1 gd level_designworkflow
Y1 gd level_designworkflow
 
Unity 3d
Unity 3dUnity 3d
Unity 3d
 
Unity Introduction
Unity IntroductionUnity Introduction
Unity Introduction
 
The Ring programming language version 1.8 book - Part 55 of 202
The Ring programming language version 1.8 book - Part 55 of 202The Ring programming language version 1.8 book - Part 55 of 202
The Ring programming language version 1.8 book - Part 55 of 202
 
Game Development with Unity
Game Development with UnityGame Development with Unity
Game Development with Unity
 
Academy PRO: Unity 3D. Scripting
Academy PRO: Unity 3D. ScriptingAcademy PRO: Unity 3D. Scripting
Academy PRO: Unity 3D. Scripting
 
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
 
Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)
 
Game Engine Overview
Game Engine OverviewGame Engine Overview
Game Engine Overview
 

Andere mochten auch

Programming android game using and engine
Programming android game using and engineProgramming android game using and engine
Programming android game using and engineNGUYEN VAN LUONG
 
Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAhsanul Karim
 
Intent in android
Intent in androidIntent in android
Intent in androidDurai S
 
Android: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversAndroid: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversCodeAndroid
 
Android Lesson 3 - Intent
Android Lesson 3 - IntentAndroid Lesson 3 - Intent
Android Lesson 3 - IntentDaniela Da Cruz
 

Andere mochten auch (7)

Android Lesson 2
Android Lesson 2Android Lesson 2
Android Lesson 2
 
Programming android game using and engine
Programming android game using and engineProgramming android game using and engine
Programming android game using and engine
 
Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver Tutorial
 
Intent in android
Intent in androidIntent in android
Intent in android
 
Android intents
Android intentsAndroid intents
Android intents
 
Android: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversAndroid: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast Receivers
 
Android Lesson 3 - Intent
Android Lesson 3 - IntentAndroid Lesson 3 - Intent
Android Lesson 3 - Intent
 

Ähnlich wie AndEngine Game Dev Guide

Game Development Session - 3 | Introduction to Unity
Game Development Session - 3 | Introduction to  UnityGame Development Session - 3 | Introduction to  Unity
Game Development Session - 3 | Introduction to UnityKoderunners
 
Android Game Minisyonize
Android Game MinisyonizeAndroid Game Minisyonize
Android Game Minisyonizesavvy
 
Galactic Wars XNA Game
Galactic Wars XNA GameGalactic Wars XNA Game
Galactic Wars XNA GameSohil Gupta
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminologyLuke Summers
 
Introduction to Game Development
Introduction to Game DevelopmentIntroduction to Game Development
Introduction to Game DevelopmentShaan Alam
 
AiRaid: Rise of the Undead
AiRaid: Rise of the UndeadAiRaid: Rise of the Undead
AiRaid: Rise of the Undead3scale.net
 
mooc course presentation.pptx
mooc course presentation.pptxmooc course presentation.pptx
mooc course presentation.pptxAkshaySingh657739
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminologyJordanianmc
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminologyJaket123
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminologyJordanianmc
 
Game engine terminology/glossary
Game engine terminology/glossaryGame engine terminology/glossary
Game engine terminology/glossarygordonpj96
 
Kinect v1+Processing workshot fabcafe_taipei
Kinect v1+Processing workshot fabcafe_taipeiKinect v1+Processing workshot fabcafe_taipei
Kinect v1+Processing workshot fabcafe_taipeiMao Wu
 
Game optimization techniques - Most Commons
Game optimization techniques - Most CommonsGame optimization techniques - Most Commons
Game optimization techniques - Most Commonsniraj vishwakarma
 
Unity3d scripting tutorial
Unity3d scripting tutorialUnity3d scripting tutorial
Unity3d scripting tutorialhungnttg
 
Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4) Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4) TomCrook
 
WP7 HUB_XNA overview
WP7 HUB_XNA overviewWP7 HUB_XNA overview
WP7 HUB_XNA overviewMICTT Palma
 

Ähnlich wie AndEngine Game Dev Guide (20)

Game Development Session - 3 | Introduction to Unity
Game Development Session - 3 | Introduction to  UnityGame Development Session - 3 | Introduction to  Unity
Game Development Session - 3 | Introduction to Unity
 
Android Game Minisyonize
Android Game MinisyonizeAndroid Game Minisyonize
Android Game Minisyonize
 
Galactic Wars XNA Game
Galactic Wars XNA GameGalactic Wars XNA Game
Galactic Wars XNA Game
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminology
 
Introduction to Game Development
Introduction to Game DevelopmentIntroduction to Game Development
Introduction to Game Development
 
AiRaid: Rise of the Undead
AiRaid: Rise of the UndeadAiRaid: Rise of the Undead
AiRaid: Rise of the Undead
 
mooc course presentation.pptx
mooc course presentation.pptxmooc course presentation.pptx
mooc course presentation.pptx
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminology
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminology
 
intern.pdf
intern.pdfintern.pdf
intern.pdf
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminology
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminology
 
Game engine terminology/glossary
Game engine terminology/glossaryGame engine terminology/glossary
Game engine terminology/glossary
 
Kinect v1+Processing workshot fabcafe_taipei
Kinect v1+Processing workshot fabcafe_taipeiKinect v1+Processing workshot fabcafe_taipei
Kinect v1+Processing workshot fabcafe_taipei
 
Game optimization techniques - Most Commons
Game optimization techniques - Most CommonsGame optimization techniques - Most Commons
Game optimization techniques - Most Commons
 
Unity3d scripting tutorial
Unity3d scripting tutorialUnity3d scripting tutorial
Unity3d scripting tutorial
 
Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4) Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4)
 
WP7 HUB_XNA overview
WP7 HUB_XNA overviewWP7 HUB_XNA overview
WP7 HUB_XNA overview
 
Engine terminology
Engine terminologyEngine terminology
Engine terminology
 
Alexey Savchenko, Unreal Engine
Alexey Savchenko, Unreal EngineAlexey Savchenko, Unreal Engine
Alexey Savchenko, Unreal Engine
 

Mehr von Daniela Da Cruz

Introduction to iOS and Objective-C
Introduction to iOS and Objective-CIntroduction to iOS and Objective-C
Introduction to iOS and Objective-CDaniela Da Cruz
 
Interactive Verification of Safety-Critical Systems
Interactive Verification of Safety-Critical SystemsInteractive Verification of Safety-Critical Systems
Interactive Verification of Safety-Critical SystemsDaniela Da Cruz
 
Comment Analysis approach for Program Comprehension (Software Engineering Wor...
Comment Analysis approach for Program Comprehension (Software Engineering Wor...Comment Analysis approach for Program Comprehension (Software Engineering Wor...
Comment Analysis approach for Program Comprehension (Software Engineering Wor...Daniela Da Cruz
 
Android Introduction - Lesson 1
Android Introduction - Lesson 1Android Introduction - Lesson 1
Android Introduction - Lesson 1Daniela Da Cruz
 

Mehr von Daniela Da Cruz (7)

Introduction to iOS and Objective-C
Introduction to iOS and Objective-CIntroduction to iOS and Objective-C
Introduction to iOS and Objective-C
 
Games Concepts
Games ConceptsGames Concepts
Games Concepts
 
C basics
C basicsC basics
C basics
 
Interactive Verification of Safety-Critical Systems
Interactive Verification of Safety-Critical SystemsInteractive Verification of Safety-Critical Systems
Interactive Verification of Safety-Critical Systems
 
Android Introduction
Android IntroductionAndroid Introduction
Android Introduction
 
Comment Analysis approach for Program Comprehension (Software Engineering Wor...
Comment Analysis approach for Program Comprehension (Software Engineering Wor...Comment Analysis approach for Program Comprehension (Software Engineering Wor...
Comment Analysis approach for Program Comprehension (Software Engineering Wor...
 
Android Introduction - Lesson 1
Android Introduction - Lesson 1Android Introduction - Lesson 1
Android Introduction - Lesson 1
 

Kürzlich hochgeladen

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 

Kürzlich hochgeladen (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

AndEngine Game Dev Guide

  • 1. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Game Development with AndEngine GLES2 Daniela da Cruz Computação Móvel Licenciatura em Engenharia de Jogos Digitais Instituto Politécnico do Cávado e do Ave October 28, 2013 Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 2. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Introduction Basic Elements Camera Engine Scene Entity Texture TextureRegion Creating the rst scene with AndEngine Handling Scene touches Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 3. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Introduction AndEngine is a free open source OpenGL Android game engine, developed by Nicolas Gramlich. AndEngine is currently available in two avors: GLES1 and GLES2. GLES2, as you might guess, supports OpenGL ES 2.0. https://github.com/nicolasgramlich http://www.matim-dev.com/ Latest version: Tutorials: Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 4. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Introduction AndEngine Advantages: It has a complete 2-D scene graph, with a very easy-to-use API. It works great with the Android activity lifecycle. It has a number of extensions that can be added as plugins. It has multi-touch support. It's free and open-source. AndEngine Disadvantages: The API is undocumented. Sometimes slower in comparison to other engines. Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 5. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Basic Elements To create a scene we need 3 basic elements: Camera Engine Scene Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 6. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Camera Camera Since all is based in a game scene we need to setup a camera: Camera(pX, pY, pWidth, pHeight); pX and pY are the coordinates for the origin of the camera pWidth and pHeight are the dimensions, in pixels, of the camera Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 7. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Engine Engine In the engine we dene which camera will be used on the scene: EngineOptions(pFullscreen, pScreenOrientation, pResolutionPolicy(pWidth, pHeight), pCamera) pFullscreen determines whether the game will be play full screen or not pScreenOrientation, here we can choose between LANDSCAPE and PORTRAIT pResolutionPolicy is the ratio of our Engine (same values as in Camera) pCamera is the camera object Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 8. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Scene Scene The Scene class is the root container for all objects to be drawn on the screen. A Scene has a specic amount of Layers, which themselves can contain a (xed or dynamic) amount of Entities. There are subclasses, like the CameraScene/HUD/MenuScene that are drawing themselves to the same position of the Scene no matter where the camera is positioned to. HUD (heads-up display) usage for example for score (it has to be all the time in the same position, follow camera changes). Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 9. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Entity Entity An Entitiy is an object that can be drawn, like Sprites, Rectangles, Text or Lines. An Entity has a position/rotation/scale/color/etc. Sprite - entity with texture TiledSprite - entity with tiled texture, you may switch between tiles. AnimatedSprite - extension of the TiledSprite, you may animate tiles in specied intervals. Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 10. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Texture TextureRegion Texture TextureRegion A Texture is a 'image' in the memory of the graphics chip. A TextureRegion denes a rectangle on the Texture. A TextureRegion is used by Sprites to let the system know what part of the big Texture the Sprite is showing. Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 11. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Creating the rst scene with AndEngine The rst le created by the project is an Activity. And the rst thing to do in our project is to change the class that this Activity extends. Instead of extending the Activity class, we want to make it extend a class called SimpleBaseGameActivity. Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 12. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Creating the rst scene with AndEngine The SimpleBaseActivity class provides additional callbacks and contains the code to make AndEngine work with the Activity life cycle. Each callback that it provides is used for a specic purpose. As soon as you extend this class, we will have to override three functions. Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 13. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Extending SimpleBaseGameActivity onCreateEngineOptions this function is where you create an instance of the engine. Every activity that the game uses will have its own instance of the engine that will run within the activity lifecycle. onCreateResources this is the function where we load all the resources that the activity requires into the the VRAM. onCreateScene this function is called after the above two callbacks are executed. This is where we create the scene for our game and use all the textures that we previously loaded into memory. Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 14. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Extending SimpleBaseGameActivity Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 15. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Creating a Sprite When creating a Sprite object, we pass four parameters: xCoordinate: Denes the X-position of the sprite. yCoordinate: Denes the Y-position of the sprite. TextureRegion: Denes what part of the texture the sprite will use to draw itself. VertexBuerObjectManager: Think of a vertex buer as an array holding the coordinates of a texture. These coordinates are passed to the OpenGL ES pipeline and ultimately dene what will be drawn. A VertexBuerObjectManager holds all the vertices of all the textures that need to be drawn on the scene. Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 16. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Attaching a Sprite to a Scene To attach a sprite, to a dierent entity, for example to the Scene, we have to simply call attachChild method: anyEntity.attachChild(yourSprite); Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 17. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Handling Scene touches Lets say we want to execute a certain action, every time the player touches the screen. We have to implement IOnSceneTouchListener interface. Add unimplemented method. Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 18. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Handling Scene touches The methods that identify if an event occurred or not are: isActionDown(), isActionMove(), isActionUp(). Now all you have to do is to register this touch listener in a certain scene: scene.setOnSceneTouchListener(this); Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave
  • 19. Introduction Basic Elements Creating the rst scene with AndEngine Handling Scene touches Handling Entity touches The problem of this approach is that it will handle every event that occurs in the whole scene. If we want to handle touch events of specic entities, we will need to implement the method onAreaTouch() (the parameters are the event and its coordinates). Game Development with AndEngine GLES2 Computação MóvelLicenciatura em Engenharia de Jogos DigitaisInstituto Politécnico do Cávado e do Ave