
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.
Build 2D games with the flame game engine and flutter, mastering game loops, components, collision detection, and overlays. Create projects like a space shooter with parallax backgrounds and joystick control.
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 create a position component in the flame game engine, set its size and position, and add it during onload, using vector2 and debug mode for visualization.
Override render to draw the position component on the canvas using its size, color, and anchor. Adjust scale to zoom and rotate with angle in radians (convert degrees to radians).
Explore using the rectangle component to render a rectangle with specific position and size, instead of the position component. The lecture shows constructor parameters and optional paint for color.
Add a rectangle component as a child of a position component to establish local origin. The child’s position and rotation follow the parent; rotating the parent rotates the child.
learn to implement a continuous rotation animation by overriding the update method, updating the angle per frame, and applying clockwise or anticlockwise speeds to parent and child components.
Learn to move a game component using a velocity vector and speed, updating position by delta time to control x and y movement across the screen.
Learn to handle tap input in Flame by implementing tap callbacks, capturing local positions, and moving a rectangle toward tapped targets using normalized velocity.
Normalize the direction vector to a unit vector to ensure consistent speed when moving a component toward a target, preserving direction without magnitude distortions.
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.
Apply a rotate effect to smoothly spin the player to a target position, then move to the target with a linear duration and an oncomplete callback.
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.
Turn a working example into a game by defining features, scoring, and timer-based win/lose conditions. Generate balls that collide with player, award scores, and introduce a spawn component for play.
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.
Explore using the spawn component to emit balls each second with a factory, random numbers, and a defined spawn area. Learn how collisions trigger scoring and a game timer.
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 and manage a 60-second timer in a Flutter Flame game, updating the on-screen remaining time each second, and stop the timer and ball spawner when time runs out.
Implement start and restart control flow in a Flutter 2D game by using a running flag, start timers, spawn balls, show tap-to-start text, and reset on finish.
Explore adding a sequence of effects in Flame with Flutter, using scale down and remove effects to vanish a ball after a timed delay.
Add a high score feature to the Flame game engine with Flutter, displaying and updating the high score text, handling timer and restart logic, and showing new high score messages.
Run the flame game on a mobile emulator and make it full screen in landscape, removing the status bar. Use responsive sizing, with text and shapes scaled by screen width.
Master Flame game engine basics by exploring the game loop, update and render methods, spawning balls with the timer component, and building with position, rectangle, circle, and text components.
Create a Flame game with Flutter, featuring a ball, a bat, a target, and a moving obstacle, world, camera, overlays, audio, collision detection, and a score to 20 to win.
Understand the rules and objectives of a paddle-and-ball game: hit the target to increase score from 10 toward 20, while avoiding the bottom and a score decay every five seconds.
Set up a new flutter project and run the Flame game on a real device to avoid emulator issues, enabling portrait fullscreen and wiring RampHitGame extending FlameGame with GameWidget.
Explore the Flame game world and camera, add components to the world, and use a viewport and viewfinder to control zoom and rotation for responsive gameplay.
Create a flame play area with a fixed 820 by 1600 resolution, anchor the viewfinder to the top left, and wire the camera and world for cross-device consistency.
Create and add a bat component in flame, positioning a rounded rectangle at the bottom center and enabling horizontal drag within screen bounds.
Move the bat horizontally using drag callbacks in the play area, updating with the drag delta and clamping to the game width. Prep for adding target, obstacle, and ball.
Implement a top-aligned target as a circle with the bottom half visible, painted dark green, centered, with a solid hitbox, added to the game world.
Add an obstacle component with a rectangle hitbox and defined width and height constants. Apply a move effect to glide horizontally between edges for four seconds, loop with reverse duration.
Add a ball component to the Flame game that moves downwards with a randomized horizontal velocity, uses a circle hitbox, and handles collisions via collision callbacks within the 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.
Implement collision detection for the ball with the play area by adding a rectangle hitbox, removing the ball when it exits, and bouncing off edges, bat, obstacle, and circular target.
Master collision handling between a ball and a circular target in Flame by calculating the normal, using the reflected velocity, and updating the ball's velocity on impact.
Add and update the score by displaying a center bottom text, starting at ten, decreasing every five seconds, increasing when the ball hits the target, and ending at twenty.
Declare game states using an enum and a getter/setter, initialize to welcome, and manage Flutter overlays to show welcome, game over, and win messages while playing.
Create a reusable Flutter overlay screen widget that accepts a title, subtitle, optional description, and on-tap callback to display welcome or game over messages with a start button.
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.
Add the Flame Audio package and register assets under assets/audio in pubspec.yaml, then prepare short, copyright-free audio clips under two seconds for hits and victories, referenced by file name.
Learn to play and cache sounds in a Flutter Flame game using Flame Audio, audio cache, load all, and a single play sound method with a sound type enum.
Tests the game audio on a real device, confirming clear target, win, and lose sounds, and adjusts the win threshold to 11 while noting bat-edge reflections affect velocity.
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.
Turn the ball disappearing bug into a feature by re-spawning the ball after it exits the screen, with a brief delay, and increasing speed after each target hit.
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.
Master sprite concepts and sprite sheets using sprite components, sprite group components, and animation components to create animated game objects, parallax backgrounds, and walking or thrust animations from images.
Create a basic sprite component in flame by loading an image as a sprite, adding it to the game, centering it, and rotating it to demonstrate sprite sheets and animation.
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.
Learn to build row-wise sprite animations in Flame by loading a space marine sprite sheet, extracting row-based sequences, and switching animations with keyboard inputs.
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 a parallax background in Flame by stacking multiple transparent images with different velocities using a parallax component and parallax data, base velocity, and velocity multiplier.
Create a production-level space shooter in Flutter using the Flame engine, integrating sprites, joystick controls, power-ups, missiles, enemy ships, a camera following a long track, and a finish line.
Set up a space shooter project by adding flame core engine, flame audio, google fonts, and flutter animate dependencies in pubspec.yaml, and prepare assets folders for audio and images.
Make the main function asynchronous, initialize Flutter bindings, set full screen and landscape orientation, then build an intro screen as a stateless widget inside a material app using Google Fonts.
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.
Create a game over overlay in Flutter, wiring a status string and play again callback to the game screen, display as center column, and prepare initial overlays like scores.
Add a background parallax component by loading nebula and star images in sequence, override onload to initialize parallax data, and attach it to the game with upward velocity and multiplier.
Add a game boundary component defining a 2000 by 600 track, drawing a boundary rect and finishing line; attach it to the world and center the camera at bottom center.
Load the player's sprite animation, define the game boundaries, and add the player to the world with an anchor-centered position using vector two in a Flame Flutter 2d game.
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 an obstacle component using a sprite with a circular hitbox and center anchor, loading asteroid.png to challenge the player and later place obstacles at random positions along the track.
Generate obstacles within the game boundary at random positions and sizes using a loop and a random generator, then add them to the world asynchronously.
Add a circle hitbox to the player, enable collision with obstacles, and on impact remove the player, trigger a non-looping explosion, and show a game over overlay for reset.
optimize performance by removing off-screen obstacles to free memory, while a debug text tracks obstacle count and a remove from parent or delayed remove effect uses the visible world rect.
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.
Fix cannon positions by centering cannons on their ships using size/2 and passing the is_left argument to place the left cannon, with clockwise rotation for left and anticlockwise for right.
Create a cannon bullet component that manages direction and speed, loads a laser sprite, updates position, handles collisions, and removes off-screen bullets.
Introduces a cannon bullet spawner with a tip-direction, height offset, and world positioning for bullets fired at 10 per second with speed 1000, plus start/stop shooting based on player distance.
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.
Learn how to reset a Flame Flutter game by removing all remaining objects, then re-adding obstacles, ships, and cannons on restart, with a loading overlay during the process.
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.
Add an enemy drone component that spawns at the top, moves downward, and shoots at the player when within range; integrate collision handling and a bullet spawner for combat.
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.
Stop the drone spawner timer at game over and prevent firing; implement destroy all drone components to remove bullets and drones on restart, then restart the spawner when play resumes.
Adds a finishing line component at the top boundary, rendering a blue rectangle and a hitbox, and uses a win/lose game result to display mission accomplished or mission failed.
Create a player bullet as a sprite component, move it upward with speed, handle collisions with enemy cannons, trigger explosions, reduce lives, and remove bullets and cannons on defeat.
Set up a bullet spawner that emits player bullets from the top of the player, with a limited bullet amount and start/stop shooting controls via an on-screen toggle.
Add a trigger component that fires bullets by toggling a pressed state and calling the game's start and stop shooting methods, with idle and pressed visuals.
Add a solid circle hitbox in the player class to ensure bullet collisions are detected reliably and enable smoother, tunable explosion timing for a more dynamic animation.
Create an enemy boss as a sprite animation component using the enemy_boss sheet. Place it above the finishing line with five frames, a circle hitbox, life, and firing.
Add a bullet spawner to the enemy boss, fire fast cannon bullets toward the player when in range, manage boss lives and explosions, and handle game end and restart.
Create a health bar component as a bordered rectangle with a green fill that updates width by progress percent to show each entity’s health, including the player in space shooter.
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.
Create a player missile component using a column sprite sheet, implement animation, collision logic, and on-screen boundaries, and wire firing with the existing trigger for future missile support.
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.
Create and integrate a dynamic bonus pack in a Flutter Flame 2D game, featuring life, bullet, and missile bonuses loaded as sprites with collision and random enemy drops.
Add a pause resume overlay to the Flame game engine with Flutter, using a boolean value notifier to toggle play/pause icons and pause or resume the engine.
Add two explosion components, the enemy boss explosion and the enemy boss hit explosion, and integrate them for hits and destruction.
Discover how Forge 2D brings realistic physics to flame games by automating gravity, collisions, and interactions with body components like static, dynamic, and kinematic bodies.
Add flame and forge 2D dependencies from pub.dev to a flutter project, then build my physics game and world that extend forge 2D with zero gravity.
Add the first body component by extending the body component to render a circle, define its circle shape, fixture and body definitions, and place it in the world.
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.
Position balls using the visible rect at the top-left with an offset, then spawn balls on tap down, adjust gravity, and rely on the engine for collisions and reflections.
Create a basket as a kinematic body with three edge fixtures (left, bottom, right), using a keyboard handler to move it and catch falling balls.
Add a slope to reflect falling balls toward a basket, spawn balls from a fixed point, and use a timer to vary restitution for dynamic scoring.
Spawn balls every three seconds using a timer in the game world, with random restitution between 0.7 and 1.0, update the timer, and remove balls when caught or hit ground.
Add a bottom flag to wall and basket fixtures and pass user data through fixtures and body definitions to detect collisions and remove balls on bottom hits.
Add a scores system by tracking misses with a ten limit, updating missed and score text as balls hit the basket, stopping the timer, and showing a game over overlay.
Develop a Flutter game app widget and use an overlay builder map to add start, play, and game over overlays, with reset and timer controls for my physics game.
Add a sprite to a body component by loading a basketball image, attaching a sprite component, and hiding the physics shape to render only the sprite in Flame.
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.
Learn to build a color catch game with Flame and Forge 2D, handling ball spawning, collisions, gates, and color-based scoring.
Create a Flutter Flame 2D project and scaffold a color catch game with overlays for start, pause, resume, and game over; configure gravity and a fixed 1080 by 720 camera.
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.
Define core game properties for the color catch game, including the visible rect, red/green/blue scores with text components, a win flag, and enums for cover and bucket types and timer.
Create a slope surface component to form a non-square platform, attach a brick sprite, clip edges, define a four-corner polygon, and spawn five instances using a loop.
Create a private clip texture component to render a sprite on a slope surface by clipping the canvas with polygon points, then draw using source and destination rectangles.
Compute dynamic slope width, height, and gaps to render five slope surfaces with top left, top right, bottom left, bottom right points, using a loop to adapt to screen size.
Design five slope surface components using a for loop, calculating x and y positions from visible rect, margin, slope width, gap, and slope height for responsive, aligned slopes.
Add four color buckets red, green, blue, and other between slope surfaces by creating a bucket component with position, color, bucket type, and gap, then position them accordingly.
Build a tunnel cover component in a Flame-based Flutter game, an H-shaped cover with start and end vectors, cover type, and amber color, added for three tunnels.
Implement a single toggle cover method to control tunnel covers by type, flip the is active flag, and wire red, green, and blue buttons to toggle.
Create a color ball component for a Flame-based Flutter game, define its physics and collisions with slope surfaces and buckets, and spawn randomized balls with a timer to update scores.
Define start, pause, resume, and reset methods to control the timer and overlays including start, pause, resume, and game over. Reset scores and color lists.
Handle ball–bucket collisions by removing the ball, update red, green, and blue scores when colors match, end the game on wrong buckets or when all scores reach 255.
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.
Create a color box puzzle in flame flutter, drawing a white rectangle and a black inner box that updates with red, green, and blue scores and turns white at max.
Learn to add sound effects in Flame with Flutter by using audio pulls, caching onload, and playing sounds for cover toggles and scoring in color catch.
Fix the game over overlay to display the correct win or lose message by using the status string, and refine ball spawning to stop red and green balls at 255.
Explore flame game engine capabilities for flutter to build 2D games, review joints, and study example code. Collaborate, share ideas, and anticipate future 3D support as you continue practicing.
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.