How to use a Flash game tutorial to make your own game

When I stated writing tutorials, I did not expect I would have to write a tutorial about… using a tutorial.

If you look at the most recent games published, you’ll find a lot of games are useless clones of some of my tutorials or some of Tony Pa‘s ones.

I said “useless” because a tutorial is not meant to be a complete game… so if you just add your name and the game name to a tutorial, be sure that it will be a game that sucks, no matter how good is the tutorial.

In order to use a tutorial to make your own game, you need to follow some rules.

Let’s see them

Because it would be too easy to use a tutorial of mine to create a game, I’ll use Tony Pa’s tile based tutorials.

The first one is “Creating Tiles” and that’s where I am going to start.

1) Resize the movie

The first thing you have to do is resizing the movie to your needs. Remember that tutorials are often embedded in blogs or websites, so their sizes depend on pages layout. Your game will be played on gaming portals that will display it on popups (like NG) or on liquid pages that will fit to your game.

In my case, I am converting Tony’s file into a 512×256 movie, so I had to add some tiles to the map

fscommand("allowscale", false);
fscommand("allowscale", false);
// our map is 2-dimensional array
myMap = new Array()
myMap[0] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
myMap[1] = [1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1];
myMap[2] = [1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1];
myMap[3] = [1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1];
myMap[4] = [1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1];
myMap[5] = [1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1];
myMap[6] = [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1];
myMap[7] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
// declare game object that holds info
game = {tileW:32, tileH:32};
// walkable tile
game.Tile0 = function() {
};
game.Tile0.prototype.walkable = true;
game.Tile0.prototype.frame = 1;
// wall tile
game.Tile1 = function() {
};
game.Tile1.prototype.walkable = false;
game.Tile1.prototype.frame = 2;
// building the world
function buildMap(map) {
	// attach empty mc to hold all the tiles and char
	_root.attachMovie("empty", "tiles", ++d);
	// declare clip in the game object
	game.clip = _root.tiles;
	// get map dimensions
	var mapWidth = map[0].length;
	var mapHeight = map.length;
	// loop to place tiles on stage
	for (var i = 0; i

And this is the result

2) Write the code according to your style

This is a very important step. Every coder has his own way to indent code, name variables, write comments and so on.

In this example, it's easy to see Tony loves naming variables with capizalized names such as myVariableName. I don't like any uppercase char but I love underscores, so I would name the same variable as my_variable_name.

Question: Capitalize or underscore?
Answer: The one you are used to deal with

When working on someone's else code, remember to edit it according to your rules, for a better readability. If the code is written in a language you don't know, rename the variables once you found out what they store, or you'll have to waste time every time you find a variable called fine_gioco when you should have named it as game_over

This is the same code as before, just written according to my rules

level_map = new Array();
level_map[0] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
level_map[1] = [1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1];
level_map[2] = [1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1];
level_map[3] = [1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1];
level_map[4] = [1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1];
level_map[5] = [1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1];
level_map[6] = [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1];
level_map[7] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
game = {tile_width:32, tile_height:32,map_width:16,map_height:8};
game.tile_0 = function() {
};
game.tile_0.prototype.walkable = true;
game.tile_0.prototype.frame = 1;
game.tile_1 = function() {
};
game.tile_1.prototype.walkable = false;
game.tile_1.prototype.frame = 2;
build_map(level_map);
function build_map(map) {
	_root.attachMovie("empty", "tiles", ++d);
	game.clip = _root.tiles;
	for (var i = 0; i

Now, I can easily read it

3) Add something new

At this time, my game would look like the million games created from Tony's tutorial.

It's time to change the graphics and add some new features.

In my case, I'll add a "grass" floor to the top of solid platforms. Now the "grass" is only a green line, but I am going to improve it a lot more during next steps of this tutorial

level_map = new Array();
level_map[0] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
level_map[1] = [1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1];
level_map[2] = [1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1];
level_map[3] = [1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1];
level_map[4] = [1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1];
level_map[5] = [1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1];
level_map[6] = [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1];
level_map[7] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
game = {tile_width:32, tile_height:32, map_width:16, map_height:8};
game.tile_0 = function() {
};
game.tile_0.prototype.walkable = true;
game.tile_0.prototype.frame = 1;
game.tile_1 = function() {
};
game.tile_1.prototype.walkable = false;
game.tile_1.prototype.frame = 2;
build_map(level_map);
function build_map(map) {
	_root.attachMovie("empty", "tiles", ++d);
	game.clip = _root.tiles;
	for (var i = 0; i

Now the game looks different than the original tutorial.

During next steps, we'll learn how to keep on using Tony's tutorials to make a game that is only based upon his ideas, with fancy graphics and gameplay.

Download the sources and change something, should you make something interesting I would be happy to publish it here.

Get the most popular Phaser 3 book

Through 202 pages, 32 source code examples and an Android Studio project you will learn how to build cross platform HTML5 games and create a complete game along the way.

Get the book

215 GAME PROTOTYPES EXPLAINED WITH SOURCE CODE
// 1+2=3
// 100 rounds
// 10000000
// 2 Cars
// 2048
// A Blocky Christmas
// A Jumping Block
// A Life of Logic
// Angry Birds
// Angry Birds Space
// Artillery
// Astro-PANIC!
// Avoider
// Back to Square One
// Ball Game
// Ball vs Ball
// Ball: Revamped
// Balloon Invasion
// BallPusher
// Ballz
// Bar Balance
// Bejeweled
// Biggification
// Block it
// Blockage
// Bloons
// Boids
// Bombuzal
// Boom Dots
// Bouncing Ball
// Bouncing Ball 2
// Bouncy Light
// BoxHead
// Breakout
// Bricks
// Bubble Chaos
// Bubbles 2
// Card Game
// Castle Ramble
// Chronotron
// Circle Chain
// Circle Path
// Circle Race
// Circular endless runner
// Cirplosion
// CLOCKS - The Game
// Color Hit
// Color Jump
// ColorFill
// Columns
// Concentration
// Crossy Road
// Crush the Castle
// Cube Jump
// CubesOut
// Dash N Blast
// Dashy Panda
// Deflection
// Diamond Digger Saga
// Don't touch the spikes
// Dots
// Down The Mountain
// Drag and Match
// Draw Game
// Drop Wizard
// DROP'd
// Dudeski
// Dungeon Raid
// Educational Game
// Elasticity
// Endless Runner
// Erase Box
// Eskiv
// Farm Heroes Saga
// Filler
// Flappy Bird
// Fling
// Flipping Legend
// Floaty Light
// Fuse Ballz
// GearTaker
// Gem Sweeper
// Globe
// Goat Rider
// Gold Miner
// Grindstone
// GuessNext
// Helicopter
// Hero Emblems
// Hero Slide
// Hexagonal Tiles
// HookPod
// Hop Hop Hop Underwater
// Horizontal Endless Runner
// Hundreds
// Hungry Hero
// Hurry it's Christmas
// InkTd
// Iromeku
// Jet Set Willy
// Jigsaw Game
// Knife Hit
// Knightfall
// Legends of Runeterra
// Lep's World
// Line Rider
// Lumines
// Magick
// MagOrMin
// Mass Attack
// Math Game
// Maze
// Meeblings
// Memdot
// Metro Siberia Underground
// Mike Dangers
// Mikey Hooks
// Nano War
// Nodes
// o:anquan
// One Button Game
// One Tap RPG
// Ononmin
// Pacco
// Perfect Square!
// Perfectionism
// Phyballs
// Pixel Purge
// PixelField
// Planet Revenge
// Plants Vs Zombies
// Platform
// Platform game
// Plus+Plus
// Pocket Snap
// Poker
// Pool
// Pop the Lock
// Pop to Save
// Poux
// Pudi
// Pumpkin Story
// Puppet Bird
// Pyramids of Ra
// qomp
// Quick Switch
// Racing
// Radical
// Rebuild Chile
// Renju
// Rise Above
// Risky Road
// Roguelike
// Roly Poly
// Run Around
// Rush Hour
// SameGame
// SamePhysics
// Save the Totem
// Security
// Serious Scramblers
// Shrink it
// Sling
// Slingy
// Snowflakes
// Sokoban
// Space Checkers
// Space is Key
// Spellfall
// Spinny Gun
// Splitter
// Spring Ninja
// Sproing
// Stabilize!
// Stack
// Stairs
// Stick Hero
// String Avoider
// Stringy
// Sudoku
// Super Mario Bros
// Surfingers
// Survival Horror
// Talesworth Adventure
// Tetris
// The Impossible Line
// The Moops - Combos of Joy
// The Next Arrow
// Threes
// Tic Tac Toe
// Timberman
// Tiny Wings
// Tipsy Tower
// Toony
// Totem Destroyer
// Tower Defense
// Trick Shot
// Tunnelball
// Turn
// Turnellio
// TwinSpin
// vvvvvv
// Warp Shift
// Way of an Idea
// Whack a Creep
// Wheel of Fortune
// Where's my Water
// Wish Upon a Star
// Word Game
// Wordle
// Worms
// Yanga
// Yeah Bunny
// Zhed
// zNumbers