Skip to content

Tag: actionscript

Moving Enemies with Waypoints

Getting enemies to move tends to be one of the more difficult things for me to get right. It just doesn’t always seem natural. And I’m not talking about moving with any type of AI. Just moving around the screen in a pattern.

Sure, straight lines are pretty easy. But games get really boring if all the enemies just go from right to left or left to right.

For this post we’re going to explore moving an enemy through a series of waypoints using ActionScript 3. I’m going to create a movie clip symbol in Flash named Enemy_mc.

Let’s see it

Doesn’t do much good to explain with words. This is what we’re going to create.

One minor difference. I set this demo up to loop so the enemy goes back to its starting position and sets its current waypoint back to 0 when it gets to the last one. The real deal will remove the enemy from the stage.

Scrolling Background with ActionScript

Take a look at your favorite game. Odds are good that there is a scrolling background of some type. Think Super Mario Brothers.

Mario is a bit different than what we’re after though. The background in Mario is a single graphic that scrolls as Mario moves through the world. What we want is a scrolling background that loops forever. We’re going to scroll horizontally like a platform jumping game, but the same concept works vertically.

Dragging symbols in a grid with ActionScript

Some games, I’m thinking tower defense, need to give the player the ability to drag symbols around. But you don’t always want to give the player free reign to drag it anywhere. Maybe you want them to only be able to position symbols in a grid. That’s what we’ll create here using ActionScript 3.

Demo

This is what we’re going to be creating.  Try dragging the green square. It will snap so that it’s always in one of the grid squares.

How to create a very simple space game in Flash

Admit it, you’ve played an online game while at work. And odds are very good it was written in Flash / ActionScript. We’re going to cook up a very simple Flash project that might serve as the start of a game. Keyword here is simple though. We’re not going to worry about anything except for a scrolling background and a space ship, with maybe a laser at the end. But it should be enough to get you started with some basics.

The Project
First step is to create an empty Flash ActionScript file. We’re going to go with ActionScript 3 with a stage size at the default 550x400px just to keep it easy.

Project Properties