
Explore flame, a lightweight 2D game engine built on Flutter, and learn how it renders, handles input, audio, and physics for cross-platform 2D games created with Dart.
Create a new Flutter project, integrate Flame version 1.3.1, add the dependency, build a MyFlameGame extending FlameGame, and run in a browser to see a green background.
Learn how the game loop updates the game state and renders changes each frame using update and render methods. Delta time drives the frame rate toward smooth 60 fps.
Learn to handle tap input in Flame by implementing tap callbacks, capturing local positions, and moving a rectangle toward tapped targets using normalized velocity.
Move the rectangle toward the tap target and stop at it. Check distance to the target in update; if distance < speed dt, snap to the target and zero velocity.
Rotate the rectangle toward the tap target using look at, then move to the target position. This avoids manual angle adjustments and ensures the orientation updates before movement.
Learn how to use flame's move effect and move to target to create non-linear movement with ease in out curves, duration, and an effect controller, attaching effects to components.
Learn to enable collision detection by adding a collision detection mixin, wrap components with rectangle and circle hitboxes, and respond to collisions via collision callbacks including active and passive types.
Display a numeric label on each created ball using a centered text component, with the number passed to the ball’s constructor and positioned randomly each second, with a spawn component.
Remove balls on collision with the player and update the score using the ball's number, displaying it with a text component refreshed each frame and a timer to end game.
Set up randomized ball velocity by computing a random x and y vector, normalize and scale it, then implement edge collisions with bounce and bottom removal.
Refactor the Flutter app to host the game in a material app root and add an overlay screen for welcome and game over states using an overlay builder map.
Implement start game and finish game methods in Flame, add ball and obstacle on start, manage timer and score, handle game over, and reset for replay.
Increase ball velocity by 1.5 on each target hit. Cap velocity at 800 and refine velocity.x based on ball and bat positions to adjust reflections and sound volume.
Release your flame game built with flutter in release mode for a smaller install and smoother performance, while inviting ideas for future features and stronger story objectives.
Use a sprite group component to manage two car sprites (normal and shielded), load them via an enum car type, and switch the current type at runtime.
Learn to extract seven sprites from a single sprite sheet using a sprite component, slicing the image into 64×128 frames and switching by index for left and right steering.
Load a four-frame sprite sheet with a sprite animation component to animate a spaceship's fire trail, using 32 by 39 pixel frames and a 0.1 second step time.
Learn to animate sprites from column-based sprite sheets by loading an image, defining a sprite sheet with columns and rows, extracting column-wise sequences, and switching animations with keyboard input.
Create a mosquito spaceship sprite animation group component with normal and shielded states, loading two looping animations for two blinking lights using a spaceship type enum and onload setup.
Create an intro screen widget with scaffold, stack, and positioned elements, layering parallax background images from assets with a centered title and a start button that fades in and out.
build a space shooter game screen in Flutter with Flame, and implement a score overlay showing lives, progress, and bullets via value notifiers.
Add a joystick as a fixed viewport control, customize knob and background visuals, and pass the joystick to the player so drag deltas move the player in real time.
Move the player using a joystick by updating velocity from the joystick's relative delta each frame, clamp the position to the game bounds, and have the camera follow the player.
Override the update method in the shooter game class to adjust the parallax base velocity from the player's velocity, speeding the background as the player moves within the rect bounds.
Calculate track progress by mapping the player's y position to a 0–100 progress value, update a value notifier, and clamp within the track height as the parallax background responds.
Create stationary enemy cannon ships with rotating cannons, placed alternately on the left and right edges, loaded with a cannon bullet system to fire at the player.
Rotate the cannon to face the player by predicting position from velocity and time with the bullet speed, then adjust the angle using screen angle to ensure the shot hits.
Apply a game over boolean to stop cannons from firing when the game ends, then reset and restart with the play again button, while tracking bullets and cannon ships.
Add life components as power-ups in the flame game engine with flutter to boost player lives on collisions, using zap.png sprites and a scale-then-fade removal sequence.
Define a drone spawner that creates drone components every two seconds within a specified rectangular area, add it to the world, and ensure drones are removed when the game ends.
Implement health bars for the player and enemies with a health bar component; update progress by current life over max lives and position bars accordingly; adjust enemy fire rate.
Add bullet sounds using flame audio and audio pools to preload multiple sound players, enabling gunshots, laser shots, and enemy explosions with adjustable volume.
Apply enemy destruction sounds by triggering the appropriate sound pools when enemies, bosses, or drone components are destroyed and when the player dies, testing audible feedback.
Add a fire missile method and track missiles with a value notifier, update the trigger to fire on tap up when missiles remain, and display missiles in the score overlay.
Explore creating screen boundaries in forge 2D with flame and flutter, using static edge walls and restitution to enable gravity-driven collisions and realistic bouncing.
Add a seven-sprite explosion as a sprite animation when the ball hits the bottom, using the world center position and adding it to the physics world.
Wrap up introduces the physics world with forge 2D and box2D and invites you to explore flame examples, sprite components, and effects, preparing you for the next section.
Create a full-screen background component as a sprite, load a background image, set opacity to 0.2, size it to visible world, and add it to the game world in onload.
Wire the start, pose, resume, and reset actions to the overlays, then test a timers-driven color balls game with scoring and a game over driven by misses.
Master Flame Game Engine with Flutter: Build 2D Mobile Games is the ultimate hands-on course for Flutter developers who want to step into the world of game development. Whether you’ve built apps before or are completely new to game programming, this course will guide you step by step in building fun and interactive 2D games using the Flame game engine.
We’ll start with an introduction to Flame and explore the essential building blocks like text, shapes, movement, timers, tap events, and collision detection. From there, you’ll put your skills into practice by creating Ramp Hit Game, a brick-breaker style game with collisions, reflections, obstacles, and sound effects.
Next, you’ll learn how to work with sprites, sprite sheets, animations, and parallax backgrounds, and then dive into an action-packed Space Shooter Game complete with enemies, shooting mechanics, explosions, scoring, and a camera that follows the player.
In the advanced sections, we’ll explore Forge2D, Flame’s physics engine, where you’ll learn about bodies, gravity, and physics-driven components. You’ll then apply these concepts by building Color Catch Game, where balls must be sorted into the correct buckets using physics, collisions, and creative rendering techniques.
By the end of this course, you won’t just know Flame basics—you’ll have built multiple complete games and gained the confidence to design and develop your own unique 2D games with Flutter and Flame.