SlideShare a Scribd company logo
Easy coding a multi-device
game with FireMonkey
Patrick Prémartin
Twitter : @premartinpatric
Email : patrick.premartin@olfsoft.com
www.embarcaderoacademy.com/p/coderage-2018
Agenda
• Introduction
• Setting the project
• Creating sprites and buttons
• Creating the screens
• Do some (simple) code
• Testing on devices
• Conclusion
• Q&A
Introduction
What is FireMonkey ?
• FireMonkey (FMX) is a multi-device framework based on graphic
libraries.
• The same program can be compiled for iOS, Android, macOS and
Windows.
• FireMonkey has RAD capabilities.
It’s simple to use, simple to understand and simple to learn.
• And of course it’s included for free in RAD Studio, Delphi and
C++Builder even in the free Community Edition.
What sort of games can we create ?
• FireMonkey includes 2D and 3D components, Box2D and libraries
usually used by game creators.
• With no programming skills you can create simple games like today.
• With programming skills you can do what ever you want and benefit
from multi-device FMX capabilities.
What will we do today ?
• For Halloween I’ve created the game Pumpkin Killer available on
https://pumpkinkiller.gamolf.fr and the app stores.
• Today we’ll create a game for Christmas based on the same idea :
=> objects move on the screen
=> the player have to touch some of them
• We’ll start the game with 3 lives and no score.
It will end after the lost of last life.
• You can download this game project and use it as a template :
https://vasur.fr/coderage2018src
Setting the project
Setting the project
• Design your game on paper
• Choose, buy or create your assets (images, sounds, musics) :
• title and background image for your game
• an app icon for Windows, macOS, iOS and Android
• a splash screen for iOS and Android
• user interface buttons, sprites and other elements
• Arrange them in a folder tree
• Add a text to remember what you can do with each file and where
they come from.
Setting the project
• Open Delphi or C++Builder
• Create a new multi-device blank application
• Put your icons in “Project / Options / Application / Icons”
• Fill the “Project / Options / Application / Version Info” forms
• Save the project
Creating sprites and buttons
Creating sprites and buttons
• Creating a button component
Creating sprites and buttons
• Creating a button component
• Creating the sprite base
Creating sprites and buttons
• Creating a button component
• Creating the sprite base
• Creating the “good” sprite
Creating sprites and buttons
• Creating a button component
• Creating the sprite base
• Creating the “good” sprite
• Creating the ”bad” sprite
Creating the screens
Creating the screens
• For a simple game we need 6 screens : home, game, game over, hall
of fame, options and credits.
Creating the screens
• For a simple game we need 6 screens : home, game, game over, hall
of fame, options and credits.
• The simple way is to use a TLayout for each screen on the same
TForm.
• The background of the game will be the background bitmap on the
TForm. It can stretch to the good size.
• In our game we put the title image on the TForm.
If you prefer you can put it on some TLayout or change it’s visible
property depending on the screen displayed.
Do some (simple) code
Do some (simple) code
• The first thing to do is to add link between the screens. We use
onClick event on the buttons.
Do some (simple) code
• The first thing to do is to add link between the screens. We use
onClick event on the buttons.
• On Android we need to intercept the “back” button of the phone or
tablet. We use onKeyDown event on the TForm.
For Windows and Mac we intercept the ESC key in the same event.
Do some (simple) code
• The first thing to do is to add link between the screens. We use
onClick event on the buttons.
• On Android we need to intercept the “back” button of the phone or
tablet. We use onKeyDown event on the TForm.
For Windows and Mac we intercept the ESC key in the same event.
• To store and display the scores we add a TDataModule unit with
some properties and a TFDMemTable.
We add a link between it and the Hall of Fame screen with Live
Bindings.
Do some (simple) code
• Now we can animate the sprites :
• Initialize their properties on create
• Fill the onClick event (increase score, decrease life, enable the animation)
• Move the sprites and test when they exit the screen
Do some (simple) code
• Now we can animate the sprites :
• Initialize their properties on create
• Fill the onClick event (increase score, decrease life, enable the animation)
• Move the sprites and test when they exit the screen
• Working on the game screen :
• Initialize the game properties
• Add the code needed when the score changes
• Add the code needed when the number of lifes changes
• Add the game loop (add, kill and move the sprites)
Do some (simple) code
• And we finish with the game over screen :
• Store the score if the user wants it
• Display the hall of fame
Testing on devices
Testing on devices
• Compile and run the game on Windows
Testing on devices
• Compile and run the game on Windows
• Compile and run the game on Android
Testing on devices
• Compile and run the game on Windows
• Compile and run the game on Android
• Compile and run the game on macOS
Testing on devices
• Compile and run the game on Windows
• Compile and run the game on Android
• Compile and run the game on macOS
• Compile and run the game on iOS
Conclusion
Conclusion
• Now you have a simple game template you can modify as you want.
• As you can see FireMonkey is a simple framework to play with. J
• We are waiting for your games…
Recap
• Introduction
• Setting the project
• Creating sprites and buttons
• Creating the screens
• Do some (simple) code
• Testing on devices
• Conclusion
• Q&A
• Patrick Prémartin
Twitter : @premartinpatric
patrick.premartin@olfsoft.com
• My blog :
https://developpeur-pascal.fr
• Download this project on:
https://vasur.fr/coderage2018src
www.embarcaderoacademy.com/p/coderage-2018

More Related Content

Similar to Easy coding a multi device game with FireMonkey

Deploy All The Games
Deploy All The GamesDeploy All The Games
Deploy All The Games
Adam Hill
 
Presentación Unity
Presentación UnityPresentación Unity
Presentación Unity
Laura Milena Parra Navarro
 
Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...
Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...
Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...
SanaChoudary
 
Unity 3 d
Unity 3 dUnity 3 d
Creating great Unity games for Windows 10 - Part 1
Creating great Unity games for Windows 10 - Part 1Creating great Unity games for Windows 10 - Part 1
Creating great Unity games for Windows 10 - Part 1
Jiri Danihelka
 
Brass Monkey Couch Multiplayer
Brass Monkey Couch MultiplayerBrass Monkey Couch Multiplayer
Brass Monkey Couch Multiplayer
Francois Laberge
 
Windows 7
Windows 7Windows 7
Windows 7
Nav Preet
 
Absolute Beginners Guide to iPhone dev
Absolute Beginners Guide to iPhone devAbsolute Beginners Guide to iPhone dev
Absolute Beginners Guide to iPhone dev
Barry Ezell
 
Cmd unity withc
Cmd unity withcCmd unity withc
Cmd unity withc
umairnoora
 
Let's make a game unity
Let's make a game   unityLet's make a game   unity
Let's make a game unity
Saija Ketola
 
Python games
Python gamesPython games
Python games
dxbeeh
 
An Introduction to Unity
An Introduction to UnityAn Introduction to Unity
An Introduction to Unity
fesuffolk
 
Kodu Together: Video Game Programming & Publishing
Kodu Together: Video Game Programming & PublishingKodu Together: Video Game Programming & Publishing
Kodu Together: Video Game Programming & Publishing
Nick Tanzi
 
Ios - Intorduction to view controller
Ios - Intorduction to view controllerIos - Intorduction to view controller
Ios - Intorduction to view controller
Vibrant Technologies & Computers
 
Project presentation
Project presentationProject presentation
Project presentation
Harsh Sharma
 
Making A Game Engine Is Easier Than You Think
Making A Game Engine Is Easier Than You ThinkMaking A Game Engine Is Easier Than You Think
Making A Game Engine Is Easier Than You Think
Gorm Lai
 
Unity 3d Basics
Unity 3d BasicsUnity 3d Basics
Unity 3d Basics
Chaudhry Talha Waseem
 
ICS3211 lecture 08
ICS3211 lecture 08ICS3211 lecture 08
ICS3211 lecture 08
Vanessa Camilleri
 
Video game development for everybody
Video game development for everybodyVideo game development for everybody
Video game development for everybody
Sarah Sexton
 
Developing for consoles as an indie in 2019
Developing for consoles as an indie in 2019Developing for consoles as an indie in 2019
Developing for consoles as an indie in 2019
David Voyles
 

Similar to Easy coding a multi device game with FireMonkey (20)

Deploy All The Games
Deploy All The GamesDeploy All The Games
Deploy All The Games
 
Presentación Unity
Presentación UnityPresentación Unity
Presentación Unity
 
Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...
Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...
Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...
 
Unity 3 d
Unity 3 dUnity 3 d
Unity 3 d
 
Creating great Unity games for Windows 10 - Part 1
Creating great Unity games for Windows 10 - Part 1Creating great Unity games for Windows 10 - Part 1
Creating great Unity games for Windows 10 - Part 1
 
Brass Monkey Couch Multiplayer
Brass Monkey Couch MultiplayerBrass Monkey Couch Multiplayer
Brass Monkey Couch Multiplayer
 
Windows 7
Windows 7Windows 7
Windows 7
 
Absolute Beginners Guide to iPhone dev
Absolute Beginners Guide to iPhone devAbsolute Beginners Guide to iPhone dev
Absolute Beginners Guide to iPhone dev
 
Cmd unity withc
Cmd unity withcCmd unity withc
Cmd unity withc
 
Let's make a game unity
Let's make a game   unityLet's make a game   unity
Let's make a game unity
 
Python games
Python gamesPython games
Python games
 
An Introduction to Unity
An Introduction to UnityAn Introduction to Unity
An Introduction to Unity
 
Kodu Together: Video Game Programming & Publishing
Kodu Together: Video Game Programming & PublishingKodu Together: Video Game Programming & Publishing
Kodu Together: Video Game Programming & Publishing
 
Ios - Intorduction to view controller
Ios - Intorduction to view controllerIos - Intorduction to view controller
Ios - Intorduction to view controller
 
Project presentation
Project presentationProject presentation
Project presentation
 
Making A Game Engine Is Easier Than You Think
Making A Game Engine Is Easier Than You ThinkMaking A Game Engine Is Easier Than You Think
Making A Game Engine Is Easier Than You Think
 
Unity 3d Basics
Unity 3d BasicsUnity 3d Basics
Unity 3d Basics
 
ICS3211 lecture 08
ICS3211 lecture 08ICS3211 lecture 08
ICS3211 lecture 08
 
Video game development for everybody
Video game development for everybodyVideo game development for everybody
Video game development for everybody
 
Developing for consoles as an indie in 2019
Developing for consoles as an indie in 2019Developing for consoles as an indie in 2019
Developing for consoles as an indie in 2019
 

More from pprem

Using FireMonkey as a game engine
Using FireMonkey as a game engineUsing FireMonkey as a game engine
Using FireMonkey as a game engine
pprem
 
Using Delphi as a no code development environment
Using Delphi as a no code development environmentUsing Delphi as a no code development environment
Using Delphi as a no code development environment
pprem
 
Utiliser FireMonkey comme moteur de jeux vidéo
Utiliser FireMonkey comme moteur de jeux vidéoUtiliser FireMonkey comme moteur de jeux vidéo
Utiliser FireMonkey comme moteur de jeux vidéo
pprem
 
Coder sans coder : Delphi en mode no code !
Coder sans coder : Delphi en mode no code !Coder sans coder : Delphi en mode no code !
Coder sans coder : Delphi en mode no code !
pprem
 
Quoi de neuf dans la version 11 Alexandria ?
Quoi de neuf dans la version 11 Alexandria ?Quoi de neuf dans la version 11 Alexandria ?
Quoi de neuf dans la version 11 Alexandria ?
pprem
 
Faire des applications web avec Delphi
Faire des applications web avec DelphiFaire des applications web avec Delphi
Faire des applications web avec Delphi
pprem
 
Utilisation de git avec Delphi
Utilisation de git avec DelphiUtilisation de git avec Delphi
Utilisation de git avec Delphi
pprem
 
Diffuser nos logiciels et leurs mises à jour
Diffuser nos logiciels et leurs mises à jourDiffuser nos logiciels et leurs mises à jour
Diffuser nos logiciels et leurs mises à jour
pprem
 
Delphi et les tests unitaires
Delphi et les tests unitairesDelphi et les tests unitaires
Delphi et les tests unitaires
pprem
 
Développer une application pour Android TV avec Delphi
Développer une application pour Android TV avec DelphiDévelopper une application pour Android TV avec Delphi
Développer une application pour Android TV avec Delphi
pprem
 
Sauvegarder et restaurer l'état des applications mobiles
Sauvegarder et restaurer l'état des applications mobilesSauvegarder et restaurer l'état des applications mobiles
Sauvegarder et restaurer l'état des applications mobiles
pprem
 
Gérer le clavier virtuel sous iOS et Android
Gérer le clavier virtuel sous iOS et AndroidGérer le clavier virtuel sous iOS et Android
Gérer le clavier virtuel sous iOS et Android
pprem
 
Internationaliser les projets VCL / FMX
Internationaliser les projets VCL / FMXInternationaliser les projets VCL / FMX
Internationaliser les projets VCL / FMX
pprem
 
Comment développer pour Linux avec Delphi
Comment développer pour Linux avec DelphiComment développer pour Linux avec Delphi
Comment développer pour Linux avec Delphi
pprem
 
Utiliser des dessins vectoriels à la place d'images
Utiliser des dessins vectoriels à la place d'imagesUtiliser des dessins vectoriels à la place d'images
Utiliser des dessins vectoriels à la place d'images
pprem
 
Embarquer une base de données locale dans vos logiciels et applications mobiles
Embarquer une base de données locale dans vos logiciels et applications mobilesEmbarquer une base de données locale dans vos logiciels et applications mobiles
Embarquer une base de données locale dans vos logiciels et applications mobiles
pprem
 
Déploiement et débogage à distance
Déploiement et débogage à distanceDéploiement et débogage à distance
Déploiement et débogage à distance
pprem
 
Utiliser l'EDI pour développer en multiplateforme
Utiliser l'EDI pour développer en multiplateformeUtiliser l'EDI pour développer en multiplateforme
Utiliser l'EDI pour développer en multiplateforme
pprem
 
Faire une interface adaptive avec la VCL
Faire une interface adaptive avec la VCLFaire une interface adaptive avec la VCL
Faire une interface adaptive avec la VCL
pprem
 
Faire une interface adaptive avec FireMonkey
Faire une interface adaptive avec FireMonkeyFaire une interface adaptive avec FireMonkey
Faire une interface adaptive avec FireMonkey
pprem
 

More from pprem (20)

Using FireMonkey as a game engine
Using FireMonkey as a game engineUsing FireMonkey as a game engine
Using FireMonkey as a game engine
 
Using Delphi as a no code development environment
Using Delphi as a no code development environmentUsing Delphi as a no code development environment
Using Delphi as a no code development environment
 
Utiliser FireMonkey comme moteur de jeux vidéo
Utiliser FireMonkey comme moteur de jeux vidéoUtiliser FireMonkey comme moteur de jeux vidéo
Utiliser FireMonkey comme moteur de jeux vidéo
 
Coder sans coder : Delphi en mode no code !
Coder sans coder : Delphi en mode no code !Coder sans coder : Delphi en mode no code !
Coder sans coder : Delphi en mode no code !
 
Quoi de neuf dans la version 11 Alexandria ?
Quoi de neuf dans la version 11 Alexandria ?Quoi de neuf dans la version 11 Alexandria ?
Quoi de neuf dans la version 11 Alexandria ?
 
Faire des applications web avec Delphi
Faire des applications web avec DelphiFaire des applications web avec Delphi
Faire des applications web avec Delphi
 
Utilisation de git avec Delphi
Utilisation de git avec DelphiUtilisation de git avec Delphi
Utilisation de git avec Delphi
 
Diffuser nos logiciels et leurs mises à jour
Diffuser nos logiciels et leurs mises à jourDiffuser nos logiciels et leurs mises à jour
Diffuser nos logiciels et leurs mises à jour
 
Delphi et les tests unitaires
Delphi et les tests unitairesDelphi et les tests unitaires
Delphi et les tests unitaires
 
Développer une application pour Android TV avec Delphi
Développer une application pour Android TV avec DelphiDévelopper une application pour Android TV avec Delphi
Développer une application pour Android TV avec Delphi
 
Sauvegarder et restaurer l'état des applications mobiles
Sauvegarder et restaurer l'état des applications mobilesSauvegarder et restaurer l'état des applications mobiles
Sauvegarder et restaurer l'état des applications mobiles
 
Gérer le clavier virtuel sous iOS et Android
Gérer le clavier virtuel sous iOS et AndroidGérer le clavier virtuel sous iOS et Android
Gérer le clavier virtuel sous iOS et Android
 
Internationaliser les projets VCL / FMX
Internationaliser les projets VCL / FMXInternationaliser les projets VCL / FMX
Internationaliser les projets VCL / FMX
 
Comment développer pour Linux avec Delphi
Comment développer pour Linux avec DelphiComment développer pour Linux avec Delphi
Comment développer pour Linux avec Delphi
 
Utiliser des dessins vectoriels à la place d'images
Utiliser des dessins vectoriels à la place d'imagesUtiliser des dessins vectoriels à la place d'images
Utiliser des dessins vectoriels à la place d'images
 
Embarquer une base de données locale dans vos logiciels et applications mobiles
Embarquer une base de données locale dans vos logiciels et applications mobilesEmbarquer une base de données locale dans vos logiciels et applications mobiles
Embarquer une base de données locale dans vos logiciels et applications mobiles
 
Déploiement et débogage à distance
Déploiement et débogage à distanceDéploiement et débogage à distance
Déploiement et débogage à distance
 
Utiliser l'EDI pour développer en multiplateforme
Utiliser l'EDI pour développer en multiplateformeUtiliser l'EDI pour développer en multiplateforme
Utiliser l'EDI pour développer en multiplateforme
 
Faire une interface adaptive avec la VCL
Faire une interface adaptive avec la VCLFaire une interface adaptive avec la VCL
Faire une interface adaptive avec la VCL
 
Faire une interface adaptive avec FireMonkey
Faire une interface adaptive avec FireMonkeyFaire une interface adaptive avec FireMonkey
Faire une interface adaptive avec FireMonkey
 

Recently uploaded

Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Envertis Software Solutions
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 

Recently uploaded (20)

Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 

Easy coding a multi device game with FireMonkey

  • 1. Easy coding a multi-device game with FireMonkey Patrick Prémartin Twitter : @premartinpatric Email : patrick.premartin@olfsoft.com www.embarcaderoacademy.com/p/coderage-2018
  • 2. Agenda • Introduction • Setting the project • Creating sprites and buttons • Creating the screens • Do some (simple) code • Testing on devices • Conclusion • Q&A
  • 4. What is FireMonkey ? • FireMonkey (FMX) is a multi-device framework based on graphic libraries. • The same program can be compiled for iOS, Android, macOS and Windows. • FireMonkey has RAD capabilities. It’s simple to use, simple to understand and simple to learn. • And of course it’s included for free in RAD Studio, Delphi and C++Builder even in the free Community Edition.
  • 5. What sort of games can we create ? • FireMonkey includes 2D and 3D components, Box2D and libraries usually used by game creators. • With no programming skills you can create simple games like today. • With programming skills you can do what ever you want and benefit from multi-device FMX capabilities.
  • 6. What will we do today ? • For Halloween I’ve created the game Pumpkin Killer available on https://pumpkinkiller.gamolf.fr and the app stores. • Today we’ll create a game for Christmas based on the same idea : => objects move on the screen => the player have to touch some of them • We’ll start the game with 3 lives and no score. It will end after the lost of last life. • You can download this game project and use it as a template : https://vasur.fr/coderage2018src
  • 8. Setting the project • Design your game on paper • Choose, buy or create your assets (images, sounds, musics) : • title and background image for your game • an app icon for Windows, macOS, iOS and Android • a splash screen for iOS and Android • user interface buttons, sprites and other elements • Arrange them in a folder tree • Add a text to remember what you can do with each file and where they come from.
  • 9. Setting the project • Open Delphi or C++Builder • Create a new multi-device blank application • Put your icons in “Project / Options / Application / Icons” • Fill the “Project / Options / Application / Version Info” forms • Save the project
  • 11. Creating sprites and buttons • Creating a button component
  • 12. Creating sprites and buttons • Creating a button component • Creating the sprite base
  • 13. Creating sprites and buttons • Creating a button component • Creating the sprite base • Creating the “good” sprite
  • 14. Creating sprites and buttons • Creating a button component • Creating the sprite base • Creating the “good” sprite • Creating the ”bad” sprite
  • 16. Creating the screens • For a simple game we need 6 screens : home, game, game over, hall of fame, options and credits.
  • 17. Creating the screens • For a simple game we need 6 screens : home, game, game over, hall of fame, options and credits. • The simple way is to use a TLayout for each screen on the same TForm. • The background of the game will be the background bitmap on the TForm. It can stretch to the good size. • In our game we put the title image on the TForm. If you prefer you can put it on some TLayout or change it’s visible property depending on the screen displayed.
  • 19. Do some (simple) code • The first thing to do is to add link between the screens. We use onClick event on the buttons.
  • 20. Do some (simple) code • The first thing to do is to add link between the screens. We use onClick event on the buttons. • On Android we need to intercept the “back” button of the phone or tablet. We use onKeyDown event on the TForm. For Windows and Mac we intercept the ESC key in the same event.
  • 21. Do some (simple) code • The first thing to do is to add link between the screens. We use onClick event on the buttons. • On Android we need to intercept the “back” button of the phone or tablet. We use onKeyDown event on the TForm. For Windows and Mac we intercept the ESC key in the same event. • To store and display the scores we add a TDataModule unit with some properties and a TFDMemTable. We add a link between it and the Hall of Fame screen with Live Bindings.
  • 22. Do some (simple) code • Now we can animate the sprites : • Initialize their properties on create • Fill the onClick event (increase score, decrease life, enable the animation) • Move the sprites and test when they exit the screen
  • 23. Do some (simple) code • Now we can animate the sprites : • Initialize their properties on create • Fill the onClick event (increase score, decrease life, enable the animation) • Move the sprites and test when they exit the screen • Working on the game screen : • Initialize the game properties • Add the code needed when the score changes • Add the code needed when the number of lifes changes • Add the game loop (add, kill and move the sprites)
  • 24. Do some (simple) code • And we finish with the game over screen : • Store the score if the user wants it • Display the hall of fame
  • 26. Testing on devices • Compile and run the game on Windows
  • 27. Testing on devices • Compile and run the game on Windows • Compile and run the game on Android
  • 28. Testing on devices • Compile and run the game on Windows • Compile and run the game on Android • Compile and run the game on macOS
  • 29. Testing on devices • Compile and run the game on Windows • Compile and run the game on Android • Compile and run the game on macOS • Compile and run the game on iOS
  • 31. Conclusion • Now you have a simple game template you can modify as you want. • As you can see FireMonkey is a simple framework to play with. J • We are waiting for your games…
  • 32. Recap • Introduction • Setting the project • Creating sprites and buttons • Creating the screens • Do some (simple) code • Testing on devices • Conclusion • Q&A
  • 33. • Patrick Prémartin Twitter : @premartinpatric patrick.premartin@olfsoft.com • My blog : https://developpeur-pascal.fr • Download this project on: https://vasur.fr/coderage2018src www.embarcaderoacademy.com/p/coderage-2018