Hyperspace Intro Animation on Pico-8

Pico-8 HyperspaceAn in development game that is heavy on perspective and animation, needed a little something extra for it’s intro and cut scenes. The solution was to create a hyperspace star field effect with individual, animated pixels.

My first attempt at the effect was to start each pixel at the screens center and randomly animate the stars outward, the result was less than satisfactory, either the range of the animation was too narrow or it was erratic.

The solution was to at initialization, create two tables, one for Y and one for y with randomly generated  locations on the screen. Interestingly, to limit the resolution of the values in Pico8, we set the upper limit as a parameter of rnd(x) and subtract an amount to set the negative limit of the range, for example :

for i=1,stars do -- Generate the two co-ordinate tables used to store each stars x and y
	add(starx,((rnd(256)-128))) -- 256 - 128 gives us a resolution between positive 128 and negative 128 i.e. the size of our screen

Continue reading Hyperspace Intro Animation on Pico-8

Tron Style 80’s Animated Landscape on Pico-8

The 8-bit style of the Pico-8 lends itself well to the 80’s cyber genre. I’ve been throwing around some ideas for a demo or potential game. A 3d style animated landscape seemed like a good place to start.

The concept is simple enough, a series of horizontal lines generated in a FOR loop that are animated down the screen, their start time is staggered and the lines are accelerated.

The vertical lines that give the illusion of perspective are generated from two FOR loops, one for either side of the middle of the screen. One loop increments while the other decrements.

The _init statement sets up the foundation objects and variables for the animation. Notice the “start” and “offset” vars, together these control the vertical start position of the horizon. “Start” will adjust the starting spacing of the horizontal lines.

function _init()
	start = 5 -- Starting distance between horizontal lines
	offset = 55 -- Starting vertical position for lines
	lineh = {}
	lineh.moveNum = {} -- Create the line object array
	last1 = time() -- Init animation timer
	start_line_num = 0 -- Init line counter, puts a delay on the for loop
	lineCont = {} -- Array 1 of vertical lines (left side of screen)
	lineCont2 = {} -- Array 2 of vertical lines (right side)
	lineNum = 0 -- Start the vertical lines horizontal 
	lineNum2 = 0

	lineEach = 5 -- Starting position and spacing horizontal lines

Continue reading Tron Style 80’s Animated Landscape on Pico-8