Sidescrolling Platformer ~Part 4~ Gravity and Jumping

In Part 3 we took a simple, scrollable background and added a layer of realistic player interaction by adding collisions and smoother movement. But we didn’t have the time to finish our player interaction by adding gravity and jumping, so that’s what we’ll do in this part. We are also going to add a few small tweaks to earlier game mechanics so that everything runs better.

Get ready for another great tutorial. I put more time into this one than I expected to.


Adding gravity is actually really easy. If you have any experience with Physics, you know that gravity causes an acceleration on objects. And an acceleration is nothing more than a change in speed. In an ideal situation on earth, an object’s velocity downwards increases by 9.8 meters per second for every second that it’s falling. So in our game, we will increase the speed of the player by a certain number for every frame that he is falling.

Continue reading

Sidescrolling Platformer ~Part 3~ The Player

In our last tutorial we programmed the background so that it scrolls when we control it with the arrow keys. But as cool as that is, it isn’t enough. Right now the player is nothing more than a a static object on the side of the stage. What we’re going to do in this tutorial is program the player to interact with the background.

Player Mechanics

What code do we add for the player? That’s a BIG question… the fate of our entire game pretty much depends upon how the player interacts with the environment. In order to stay organized, I’ll outline all the basic concepts the player should follow:

  • Smooth Movement: The player should accelerate smoothly upon pressing the arrow key, and glide to a stop due to friction when the arrow key is released.
  • Collisions: The player should not be able to walk through walls, fall through the ground, or jump through ceilings.
  • Gravity: The player should be pulled downwards unless he is standing on the ground.
  • Jumping: If the player is standing on the ground, he should be able to jump upwards.

Continue reading

Sidescrolling Platformer ~Part 2~ Scrolling the Background with the Arrow Keys

After setting up the basic outline of the platformer in Part 1, we will create a scrolling effect for the background in this tutorial which will be controlled by the arrow keys.

Keyboard Controls

One of the most useful things to be able to do with AS3 is to use the keyboard to control the game. It requires a bit of code, but once you learn to do it you will have a very important building block for any game.

Start out by adding the following code to the Actions panel on frame 1 of the timeline:

Continue reading

Sidescrolling Platformer ~Part 1~ Setup and Planning

Welcome to my new tutorial series: how to make a simple art-based sidescrolling platformer game! You guys requested it, so here it is:

(This tutorial will be a bit more advanced, but still very understandable for a beginner or intermediate programmer. If you are completely new to programming check out my quick Getting Started series, and then try out the Pong tutorials for more experience.)

Why make a sidescroller?

Because they are awesome. In terms of how fun a game is, sidescrolling games are pretty much as good as you can get, at least in the 2D game world. This can be seen in the wild popularity of the original Mario, Metroid, Megaman, or Sonic the Hedgehog titles, as well as modern classics like the Fancy Pants Adventures. If you can master the basic mechanics behind a side scrolling game, you will have a versatile game engine from which you can build tons of awesome games.

Without further ado, let’s get into our game.

Continue reading

Pong ~Part 6~ Scoring Points

Welcome back to the AS3 Game Tuts pong tutorial series. So far in this series we’ve created a working pong game complete with a ball and two paddles. In this tutorial we are going to add a scoring system to the game.

Continue reading

Pong ~Part 5~ Collisions!

This is it. The tutorial you’ve all been waiting for. The tutorial that will bring everything together. The tutorial which will make you cry out in joy– OK, maybe not, I’m getting a little too excited… but seriously this is a good one.

If you haven’t read the whole series yet, I recommend starting at the beginning.

Part 1: Setting up the Project

Part 2: Programming the Ball

Part 3: The Player’s Paddle

Part 4: The CPU’s Paddle

Let’s get started.

So far, we’ve got the ball to move and bounce off walls. We’ve made the playerPaddle be controllable by the mouse. And we’ve told the cpuPaddle to move up or down depending upon the position of the ball. It’s time to turn this into a “real” game by letting the ball be blocked by the paddles.

Hit Testing

The way Flash handles collisions between two objects on the stage is called hit testing. The way it works is that Flash keeps track of invisible bounding boxes around every object on the screen. These bounding boxes are the smallest possible rectangle that your object can fit inside. So for our paddles, the bounding box is exactly the same shape. But for the ball, instead of using the circular 30px by 30px shape we drew, Flash uses a 30px by 30px square.

Continue reading

Resources: Beginner Tutorials

If you’re looking for some great beginner tutorials besides AS3GameTuts’s Getting Started with AS3, or Pong, here is a list of some of my favorites:

Highly Recommended:

The Avoider Game Tutorial – Michael James Williams

This is basically the pinnacle of the flash gaming tutorials for beginners. Michael J Williams takes you through 12 easy-to-follow steps to make an Avoider game complete with many features. After you complete this you will feel very confident with the basics of AS3.

Other Great Tutorials:

How to Create a Brick Breaker Game in AS3 – Flash Game Tuts

This tutorial is from the website that gave me the inspiration for AS3 Game Tuts.  It is a very thorough tutorial on creating a Breakout style game in AS3. This site has many other helpful tutorials for all sorts of game styles.

AS3 101 – ActiveTuts+

So you want to figure out actionscript 3? This is the place to do it. It doesn’t teach you to make any specific games, but if you start from the beginning and read all the way to the end, you will be an actionscript pro.

Flash ball game creation tutorial – Emanuele Feronato

This is a quick tutorial that shows how to move a ball around using the arrow keys. Useful.

Number guessing game in AS3 – iLike2Flash

Create a simple higher-or-lower guessing game in Flash AS3

Kongregate AS3 Shootorials:

This 8 part tutorial series from the Kongregate will teach you to create a horizontal space shooter flash game in AS3. You can see what the result looks like by clicking here.

The AS3 tutorials don’t link to one-another, so bookmark this page if you need to and use this list of links to find each section.

Kongregate AS3 Shootorials – Part 1

Kongregate AS3 Shootorials – Part 2

Kongregate AS3 Shootorials – Part 3

Kongregate AS3 Shootorials – Part 4

Kongregate AS3 Shootorials – Part 5

Kongregate AS3 Shootorials – Part 6

Kongregate AS3 Shootorials – Part 7

Kongregate AS3 Shootorials – Part 8

If you know of any great beginner tutorials that I left out, please let me know in the comments so I can update the list.

And if you think you’re beyond the very basics, you might want to give my Platformer tutorials a try.