SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Ähnlich wie Easy coding a multi device game with FireMonkey

Ähnlich wie 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 games for consoles as an indie in 2019
Developing games for consoles as an indie in 2019Developing games for consoles as an indie in 2019
Developing games for consoles as an indie in 2019
 

Mehr von 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
 
Internationaliser les projets VCL / FMX
Internationaliser les projets VCL / FMXInternationaliser les projets VCL / FMX
Internationaliser les projets VCL / FMX
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
 

Mehr von 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
 

Kürzlich hochgeladen

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 

Kürzlich hochgeladen (20)

WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 

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