Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building Games with Flutter

You're reading from   Building Games with Flutter The ultimate guide to creating multiplatform games using the Flame engine in Flutter 3

Arrow left icon
Product type Paperback
Published in Jun 2022
Publisher Packt
ISBN-13 9781801816984
Length 224 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Paul Teale Paul Teale
Author Profile Icon Paul Teale
Paul Teale
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Part 1: Game Basics
2. Chapter 1: Getting Started with Flutter Games FREE CHAPTER 3. Chapter 2: Working with the Flame Engine 4. Chapter 3: Building a Game Design 5. Part 2: Graphics and Sound
6. Chapter 4: Drawing and Animating Graphics 7. Chapter 5: Moving the Graphics with Input 8. Chapter 6: Playing Sound Effects and Music 9. Chapter 7: Designing Your Own Levels 10. Chapter 8: Scaling the Game for Web and Desktop 11. Part 3: Advanced Games Programming
12. Chapter 9: Implementing Advanced Graphics Effects 13. Chapter 10: Making Intelligent Enemies with AI 14. Chapter 11: Finishing the Game 15. Other Books You May Enjoy Appendix: Answers

Drawing onscreen controls

In this section, we will add a joystick and a button to the screen that will allow us to control the character and some text for showing the player their score. These three components will form part of our Heads-Up Display (HUD), which is part of the user interface, showing game information that is drawn over the other graphics in the game and remains in a fixed position. The type of information could be the player's health, the number of lives remaining, or, in our case, the game score.

We will encapsulate our HUD into a single component, which makes showing or hiding it easier. The HUD component will contain JoyStickComponent for controlling the direction that George moves; the joystick will work by dragging an onscreen circle within a larger circle in the direction you want to move. The HUD will also include HudButtonComponent, an onscreen button that the player can press to double George's walking speed, making him run.

We will connect...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image