Blockcade 9 – Run the Gauntlet

Another of the most instantly recognisable machines from the classical era – Gauntlet. This was a monster cab and it’s a big build…

I was preparing a complicated Elf Shot Food joke, but I don’t have a Legolas mini-fig, you’ll have to imagine it.
Start with a standard 2×4 block
Add a 1×2 block
And a 2×4 plate
Repeat on the other side with another 2×4 block and 1×2 block to create a bridge
Add two 2×3 blocks to create the base for the control panel
Add two rocker bases to hold the bottom of the screen
And the control panel piece is a 2×4 flat plate
Start building up the back with 1x2x2 blocks
Add three more to finish the back
Add a 1×1 block with one knob and a 2×4 flat plate to make up the side panels
And repeat on the other side
Start building the monitor with a rocker base
Add a rocker plate
Add this to the centre of the main cab
Put the rest to one side and take a 3×4 window frame and add two rocker plates to the underside edge
Add two rocker plates to the top edge
And attach to the rocker plates above the control panel
The monitor starts life as a 2×3 block
Add a 1×2 plate to the rear
A 1×2 flat plate will hold the right hand side of the widescreen (the score panel)
And a 2×2 flat plate for the main game screen
Attach this to the central rocker plate and angle to be in line with the monitor frame
Start building the marquee/speaker box with a 2×4 plate
Add a 2×4 flat plate
Add a 1×2 block with four knobs to the back of the 2×4 plate
With a rocker plate underneath to attach to the top of the monitor
Repeat for the other side
Add a 2×4 flat plate to hold the marquee/speaker image
Add a 1×4 plate to the centre to fill that gap between the front and back plates
Add two 1×4 flat plates to finish off the box
Attach the marquee to the top of the model and you’re done
A screen shot – feel free to find a better one – scale to 15mm x 15mm
The stats page – attach next to the screen and scale to 15mm x 7mm
Control panel – scale to 15mm x 30mm
Coin instruction cards – scale to 30mm x 8mm and place underneath the control panel
Marquee image – scale to 15mm x 30mm and attach to the top box.
Side art images – scale to 30mm x 40mm

You’ll need to cut out the side art images as below – I found that printing two copies for each side and overlapping the images on the top and bottom bricks gave the best results

Blockcade 8 – Tempest in a tea cup

Atari’s 1981 classic is one of the most striking cabinet designs in the arcade, and we’ve had to make a few adjustments to get its stylish angular beauty into Lego form.

Okay, coffee mug rather than tea cup

We build this one in two parts – so we start with the screen and marquee

Which starts as a 1×3 plate
Add 3 1×2 flat plates (two for the screen, one for the marque)
Add a 1×1 block to the back
Put that to one side and start on the main cab with a 2×4 flat plate
Add a 2×3 angle plate to get the distinctive angled top of the cab
Add a 2×3 plate for the base of the cab
Attach a 1×1 block with one knob to the angle plate
Add a 1×2 block with four knobs for the centre of the cab
Complete the side of the cab with a 1×3 flat plate
And a 2×2 flat plate
Add a 1×2 block to complete the plinth
And a 1×2 plate at the bottom
Complete the other side in the same way and attach a mini-fig backpack holder to the centre block
Attach a 1×1 round flat piece for a spinner
Now, take the screen piece and attach it to that 1×1 block between the two sides. It doesn’t look like it fits here, but it will…
Marquee image – scale to 15mm x 7mm for the top block
A screen shot – scale to 15mm x 15mm and stick across the two bottom 1×2 flat plates

The side art is in three pieces per side, and the bottom piece will span multiple blocks. Not ideal, but it works. Reverse these images for the other side.

Part 1 scales to 10mm x 20mm and attaches to the 2×4 flat plate
Part two scales to 7mm x 12mm and attaches to the visible part of the 2×3 angle plate
And part three scales to 17mm x 20mm and attaches across the bottom three flat plates on the side.

Blockcade 7 – Pinblock

Luckily for my bank account, I’ve never really felt the urge to start collecting Pinball machines, but they still have a place in any good arcade. This is a simple build but really nicely effective.

I think the Doctor would probably appreciate a good pin more than those new-fangled arcade machines
Start with a 1×2 handle
Add a 2x2x2 roof tile
And another handle for the back legs
Use a 2×3 plate to hold the back glass
Followed by a 2×2 flat plate for the glass itself

See, told you it was simple. You could use a 1x2x2 block to get a older style square table

But it does come up a little short…

Some graphics for you – back glass sized to 15mm x 15mm and playfields to 15mm x 25mm.

Black Knight

Genie

Blockcade 6 – Robotron and on

Another essential cab – here in US form as I was getting a bit bored of “black”

Must be a tank wave – save those Mikeys
All roads start with a single 1×1 plate
Followed by another to make a 2/3 height block
Add a 1×4 bow (if you can find a 2×2 bow then that would make the build simpler – again, appears to be a non-standard block?)
Put that to one side and start building the sides with a 2×4 flat plate
Add 2 1×1 blocks with knobs at the base
And slot that into the bow
To build the joystick base start with a 1×3 plate
Add two 1×2 plates to one end
And two 1×1 blocks with knobs as above
And attach a 1×4 flat plate

The two sides in this version of the build are asymmetric – this is to allow us to build over the top of those 1×4 bow pieces, which will form the control panel. A 2×2 bow would simplify this build

To build the other side we start with a 1×1 block with a knob to a 2×4 flat plate
Add the bow and two 1×1 plates
Followed by another 1×1 knob
Add a 1×4 flat plate
And attach to the joystick base
To create the distinctive redtop joysticks start with a 1×2 angle piece
Add a 1×1 round piece with ball – in red obviously
And something to cover the bottom part (could be a 1×2 flat plate if you prefer)
Repeat for the second joystick
And attach that to the model
To build the top half of the cab, we start with a 2×2 flat plate for the screen
Add a 1×2 hand piece
Add a 1×2 flat piece with rod
Add a 1×1 knob
And a 2×2 flat plate
Place a 1 x2 plate under the screen mount
And repeat for the other side
Suspend two 1×1 knobs in mid-air (you might need to be creative with this step)
Attach the marquee block
And then connect the two pieces together with a 2×3 plate
Attach the screen/marquee to the main model
And then finally add back in the right side of the cab that has been sitting to the side all this time

Again, you’ll notice the build is different to mine – I don’t think either of them is completely right – although this is closer to the right look. Again, it’s all about the stickers.

Marquee – size to 15mm x 7mm
Control panel – crop to 15mm wide and apply to the bow pieces, and perhaps across the front of those joysticks?
Left hand side art – size to 24mm x 30mm and cut around the top 2×2 square as high as possible. The grey doesn’t quite match, so potentially print on transparent vinyl and let the block colour come through
Right hand side – same as above but reverse the cut out
And a screen – size to 15mm x 15mm

Blockcade 5 – King of Blockcade

You can’t have an arcade with Donkey Kong can you – I couldn’t quite match the cabinet colours on this one, but threw an extra brick width in to show a slightly different way of building a square box with a screen…

DK has this effect on people
We start with two 1×3 blocks in a cross shape
Add a button and whatever you have to hand for a joystick to build a control panel
To build the sides start with a 2×2 flat plate
Add a 1×4 block with four knobs and a 2×4 flat plate
Add a 1×1 with one knob facing upwards
And another this time facing towards the front of the cab to hold the marquee
Attach this to the control panel
And repeat for the other side
Add a 2×3 plate to the top and a 1×3 flat plate to the front – this will add stability to the model
Start the monitor bracket with a 1×3 flat plate
Add a 1×1 “hand” to the centre
And the now familiar 2×2 screen held in place with a 1×2 plate with rod
Attach this across the two vertical blocks at the back of the model
To create a coin box/kickstand, start with a 1×3 block and attach a 1×2 black flat plate to the centre
Add two 1×2 blue flat plates to either side
Add two further 1×3 blocks (in any colour really) to the back
Slide this into the bottom and you’re done
Marquee image – scale this to 6mm x 24mm
Screen image – scale to the normal 15mm x 15mm
And side art (same on both sides) – scale to 15mm x 20mm

Not my favourite of the builds so far, to be honest, but it gets the point across and I do like the bigger marquee size.

Blockcade 4 – Cocktails for two

Another simple one today – I love cocktail (or tabletop) arcade machines, so of course they had to feature in the Blockcade.

Variations on a theme
We start with a Telescope for a leg (although you can use any of the cone style pieces, I just happened to have four of these)
Add a 3×4 minifig base
And a 1×3 plate to the side
Topped with a 1×3 flat plate
Add the other legs (I don’t know why the designer adds them in such an odd order)
We use a 1×2 plate with a single knob to hold the screen
Repeat the 1×3 plate and flat plate on the other side
Add a 2×2 flat plate to act as a screen
The control panel is a 1×2 with four knobs
Add a button and a joystick – I use Microphones, but any small 1×1 shaft will do
Repeat on the other side and attach to the bottom of the table

You can vary the theme a little bit – I quite like the coke can and coin on my other model, but that loses the central positioning of the screen – and, also, they’re non-standard pieces.

No cabinet graphics on these, although there is space for instruction cards. Screen graphics need to be cropped to 15mm x 15mm
And the classic spacies

Blockcade 3 – Into the Battlezone

A more complex build this time, for the behemoth that is the upright Battlezone cab.

I used a spoiler from a racing car for the top shroud, but that’s a non-standard part so I’ve adjusted the build steps below to use standard bits.

Start with a 3×4 baseplate (the minifig stands)
Add a 2×4 block to the back
And a 1×2 plate
Drop a 1×3 plate over the lip of the base
Use a 1×4 across the top of the monitor shroud
And another one for luck
Add a 1×4 flat plate
A 2×2 flat plate acts as the screen
Another 2×4 block on the back
Add a 2×2 flat plate with a central knob – this will hold the controls
And complete the back with a third 2×4 block
Add 1×2 plate to the bottom
And a 1×1 roof tile
Add a 1×1 plate in the centre to hold the joystick
Repeat the above steps for the other side of the cab
Add a 1×2 with pole at the top – this will hold the viewfinder
A 1×2 flat plate for the marquee
I used two wrench/spanners for the joystick but I couldn’t find those in the build a brick app, so a 1×1 block with a handlebar seemed like a reasonable substitute
Add that to the front of the cab
The viewfinder is a binocular part
Attach that to a 1×1 plate with grip
And attach that above the monitor
Marquee – scale to 15mm x 7mm
Screenshot – scale to 15mm x 15mm
Left side art – scale to 35mm x 12mm
Right side – again, scale to 35mm x 12mm

The side art stickers will go over more than one brick, which is cheating a bit, but should look better.

The Blockcade 2 – The Pac-enning

A simple one to follow from the Defender cab – this one uses yellow flat plates which aren’t too common (about 19p on the pick-a-brick site, albeit with fairly hefty postage), but again you could print your own stickers for the colour sides.

P-p-p-pick up a Pac-Man
Start with a 1×4 with four knobs (look, I don’t name these blocks okay, stop sniggering)
Add a 1×2 yellow flat plate to the bottom
Then a standard 2×2 block at the front
Add a 2×2 yellow (although black would be fine too) flat plate for the coin door
Add a 2×4 yellow flat plate to the side
Use a rocker to hold the screen in place
Now to build the marquee header – start with a 1×1 block with side knob
A 1×2 yellow or white flat plate will be used for the marquee itself
Attach this to the model
The screen is a 2×2 flat plate on a 1×2 rocker plate
Attach that to the rocker base and adjust the screen into position
Repeat for the other side
And attach to the main model

Again, side art images attached below – crop these as before – 15mm x 30mm for the side art, 15mm x 15mm for the screen and front panel (this might look better slightly cropped) and 15mm x 7mm for the marquee

The Blockcade

Welcome to my lockdown obsession…

About a million years ago I was involved with the online Videogame mag Way of the Rodent – technically, we’re still active, but the chances of a new issue are vanishingly close to zero, but for a while there we were, if not surfing the zeitgeist, at least paddling hard towards the waves. One of our biggest successes, back before things went viral, was something we Called Paper Arcade. A bunch of print-out-and-fold “papercraft” arcade cabinets, at Barbie scale. They were fun, and they were popular (and we made precisely ┬úzero out of it because we were a bunch of idealistic idiots who thought that fun should be free – we still do)

Anyway, lockdown happened, we all know the story. But here I was stuck at home for six months (and luckily working the whole time), so spent a fair amount of time sorting through old boxes of stuff – trying to sift out the gold from the dirt.

One thing I found was an old box of Lego Dimensions game packs. Dimensions, as I’m sure you know, was a short-lived but actually quite fun videogame/Amiibo/Lego crossover project where you built little Lego models and then used them on the ingame portal to open different characters, levels and so on. One of the packs I had was the Midway Arcade – basically, Lego versions of Spy Hunter, Defender and so on. It was perfectly fine, but it had one problem.

What the juddering cock is that monstrosity

Green? Since when were Defender cabs green? And what’s going on with that control panel? This is an abomination unto the Jarvis and frankly there’s no excuse for it.

So, I dug out the few odd bits of Lego I had lying around and, in idle moments, started fiddling.

That’s better, although still a few bits of green too many…

And hence, a new lockdown obession was born, you can see them in the background… If you have one of these Defender sets and a few bits of Lego to hand, here are the build instructions – although I’ve changed a few details in this version – use the closest parts you have!

Start with a basic 2×3
Add a 2×4 plate
Followed by a 2×3 plate
A 1×4 plate for the control panel
Add some buttons
And get a joystick ready
A 1×2 for the monitor base
Followed by a rocker base
And the joystick to finish the control panel
Put that to one side and then start building the side panels (use the Defender printed panels if you have them)
Add a 1×1 block with a side knob
And attach that to the model
Do the same for the other side
Attach a 2×2 flat plate to a rocker for the screen (again, use the Defender tile if you have one)
Attach this to the rocker base plate on the model
Start with a 1×2 plate
And another (for height)
Then a 1×2 block
Add a 1×1 block with a side knob
Add another one, but this time rotated so that the knob is to the side (oo-er missus)
Add a 2×3 angle plate to the side for the top of the cabinet
Repeat for the other side
Add a 1×2 plate to space the marquee forwards
Add the Defender marquee panel if you have one, or a 1×2 plate if you don’t
Finally, put the two halves of the model together and you’re done.

But what if you don’t have the Defender specific pieces to hand? Well, you can try ebay, but you can get inkjet printable white vinyl – it’s relatively expensive at something like a pound a sheet (so print more than one thing at once!), but it works brilliantly. I’ve provided some sample artwork below, but feel free to use your own – you will need to scale this artwork to 15mm x 30mm for the 2×4 plates, 15mm x 15mm for the 2×2 plate and 15mm x 7mm for the 1×2 plate. I find that Word is the easiest way to do this (right click and choose Format Size and Position), but you can use whichever software you are more comfortable with

Enjoy. More to come, including Pacman, Donkey Kong, Robotron, Battlezone and a Star Wars cockpit.

Vectors. Vectors Everywhere.

Defenderoids, nothing more than a name really. But lets see where that goes… So, last time, we left our little bitmap engine creating a glorified star field, to not especially great effect.

Time to add some pizazz.

Vectors are great, but they are very mathematically intense, especially on a system without functional floating points like the poor old NGPC.

To start with then, we need to think about what constitutes a vector, and how to model that in code in such a way that we can work on it in integer maths.

A vector is, to all intents and purposes, a line. It has an origin, a direction and a length. It could also be represented as a start and end point if we prefer.

But a line isn’t very interesting, and probably not what you or I think about when we imagine vectors. I want shapes. Triangles, Squares, Asteroids, SPACESHIPS. For that, we need a list of Vectors, and a way to join them up.

So, what does that mean in practise? If we think of that as a series of points and each line is a vector from the last point to the next, then we can envisage how we might draw the five lines in sequence from that list like so:

XY
030
2020
300
4010
100
030

So, five vectors, needs six points – as I said, in this case it’s easier to think of the vectors as having fixed start and end points rather than trying to work backwards from a direction and length). Each vector hops from one point to the next in sequence – vector 1 from (0,30) to (20,20), vector 2 from (20,20) to (30,0) right the way through to vector 5 which joins the shape up by going from (10,0) back to (0,30). (remember that our bitmap origin in the NGPC is the Top Left corner, so all points are relative to that. There’s no particular need to join it up I suppose, but it wouldn’t be a very good asteroid if it wasn’t closed now would it?

Luckily, as well as the humble SetPixel() our NGPC C Library contains a handy function to draw a line on a bitmap – DrawLine(). So, enough theory for now – lets see how that works if we inject that into our bitmap code for the above example.

// Create the bitmap
CreateBitmap((u16*)bmpLogo, 144, 112);
CopyBitmap((u16*)bmpLogo, bgTileBase);

// Copy the tiles into the screen RAM
iTile=0;
for (iLoopY=0;iLoopY<14;iLoopY++)
{
	for (iLoopX=0;iLoopX<18;iLoopX++)
	{
		PutTile(SCR_1_PLANE, 0, 1 + iLoopX, 1 + iLoopY, bgTileBase+iTile);
		iTile++;
	}
}

// Draw the lines
DrawLine((u16*)bmpLogo,0,30,20,20,1);
DrawLine((u16*)bmpLogo,20,20,30,40,1);
DrawLine((u16*)bmpLogo,30,40,40,10,1);
DrawLine((u16*)bmpLogo,40,10,10,0,1);
DrawLine((u16*)bmpLogo,10,0,0,30,1);

// Then copy the bitmap back into tile memory...
CopyBitmap((u16*)bmpLogo, bgTileBase);
Voila, our first “vector” object

So far so good, but not very flexible. We need to step back a bit from the DrawLine() functions and define a couple of structures that can represent our shapes.

typedef struct Point
{
	s16 x;
	s16 y;
} POINT;

typedef struct ColourPoint
{
	s16 x;
	s16 y;
	u8 colour;
} COLOURPOINT;

typedef struct VectorObject
{
	POINT Origin;
	POINT Position;
	u8 Points;
	COLOURPOINT VectorList[128];
	u8 Scale;
	s8 RotationAngle;
} VECTOROBJECT;

First, we need a “point” structure – I use two slightly different ones both with and without a colour attribute. I could probably use the COLOURPOINT for both purposes and just ignore the Colour, but I prefer to keep things focused.

The main part of the VECTOROBJECT structure is the list of COLOURPOINTS – I’ve coded this to a maximum of 128 points because we can’t have open ended arrays within a structure. There are then a few additional attributes around this big list of points (as in our example basically) which will be used to define the position of the object within our bitmap, the scale, and the rotation angle – more on that in a minute. As we move on, we’ll extend this to include behavioural attributes for the object such as speed, direction and rotation. Lets look at our example again but this time using the above structure.

// Create the bitmap
CreateBitmap((u16*)bmpLogo, 144, 112);
CopyBitmap((u16*)bmpLogo, bgTileBase);

// Copy the tiles into the screen RAM
iTile=0;
for (iLoopY=0;iLoopY<14;iLoopY++)
{
	for (iLoopX=0;iLoopX<18;iLoopX++)
	{
		PutTile(SCR_1_PLANE, 0, 1 + iLoopX, 1 + iLoopY, bgTileBase+iTile);
		iTile++;
	}
}

myVectorObject.Points=5;
myVectorObject.VectorList[0].x = 0;
myVectorObject.VectorList[0].y = 30;
myVectorObject.VectorList[0].colour = 1;
myVectorObject.VectorList[1].x = 20;
myVectorObject.VectorList[1].y = 20;
myVectorObject.VectorList[1].colour = 1;
myVectorObject.VectorList[2].x = 30;
myVectorObject.VectorList[2].y = 40;
myVectorObject.VectorList[2].colour = 1;
myVectorObject.VectorList[3].x = 40;
myVectorObject.VectorList[3].y = 10;
myVectorObject.VectorList[3].colour = 1;
myVectorObject.VectorList[4].x = 10;
myVectorObject.VectorList[4].y = 0;
myVectorObject.VectorList[4].colour = 1;
myVectorObject.VectorList[5].x = 0;
myVectorObject.VectorList[5].y = 30;
myVectorObject.VectorList[5].colour = 1;

myStartPoint = myVectorObject.VectorList[0];
for (iLoop=1;iLoop<=myVectorObject.Points;iLoop++)
{
	DrawLine((u16*)bmpLogo,(u8)myStartPoint.x,myStartPoint.y,(u8)myVectorObject.VectorList[iLoop].x,(u8)myVectorObject.VectorList[iLoop].y,(u8)myVectorObject.VectorList[iLoop].colour);
	myStartPoint = myVectorObject.VectorList[iLoop];
}

// Then copy the bitmap back into tile memory...
CopyBitmap((u16*)bmpLogo, bgTileBase);

If we run that, then we should get the same shape again – just with more lines of code (and yes, I know that the constructor can be simplified, at the expense of readability). But, crucially, we’ve now abstracted the shape definition away from the drawing – and we can now further abstract that to do more stuff. Remember we had a couple of attributes in the VECTOROBJECT structure for rotation and scale. After all, if they were just going to stay the same size and face in one direction, a sprite would be much easier.

I won’t dwell on the maths too much – there are far better places to go for that if you are interested – I’d recommend Ian Bell’s page “Maths for programmers” – it’s just brilliant. And yes, it is that Ian Bell.

So, the two things we want to do most will be to scale the shape – I won’t dwell on that, as essentially all we have to do is “multiply” the .x and .y coordinates by our scaling factor. For speed reasons, I will always try and use the boolean left and right shift operators for multiplication and division where it makes sense, so multiplying by factors of two.

Rotation is a bit more complex, and needs three things:

  • a point of origin, that we are going to rotate our object around
  • a rotation angle
  • Sine and Cosine functions.

The basic method to rotate a point is simply:

  1. Offset the point by the origin
  2. Transform the x-coordinate as point.x * Cosine(angle) – point.y * Sine(angle)
  3. Transform the y-coordinate as point.x * Sine(angle) + point.y * Cosine(angle)
  4. Offset the rotated point back to it’s relative position from the origin

So, putting both of those together, and further abstracting our “drawing” routine into a function gives us:

void DrawVectorObject(u16 * BitmapAddress, VECTOROBJECT VectorObject)
{
	s16 iStartX;
	s16 iStartY;
	s16 iEndX;
	s16 iEndY;
	s16 iTempX;
	s16 iTempY;
	u8 iPoint = 0;
	s8 cSin;
	s8 cCos;
	
	cSin = Sin(VectorObject.RotationAngle);
	cCos = Cos(VectorObject.RotationAngle);

	iStartX = VectorObject.VectorList[0].x;
	iStartY = VectorObject.VectorList[0].y;

	while (iPoint++<VectorObject.Points)
	{

		// Modifier here is to find the centre of rotation
		iStartX = (iStartX*VectorObject.Scale)-VectorObject.Origin.x;
		iStartY = (iStartY*VectorObject.Scale)-VectorObject.Origin.y;

		// rotate point.
		iTempX = ((iStartX * cCos)>>7) - ((iStartY * cSin)>>7);
		iTempY = ((iStartX * cSin)>>7) + ((iStartY * cCos)>>7);

		// translate point back to it's original position:
		// Modify back from the centre of rotation above, and then add the X & Y co-ordinates
		iStartX = (VectorObject.Position.x>>7)+iTempX+VectorObject.Origin.x;
		iStartY = (VectorObject.Position.y>>7)+iTempY+VectorObject.Origin.y;

		iEndX = (VectorObject.VectorList[iPoint].x*VectorObject.Scale)-VectorObject.Origin.x;
		iEndY = (VectorObject.VectorList[iPoint].y*VectorObject.Scale)-VectorObject.Origin.y;

		// rotate point
		iTempX = ((iEndX * cCos)>>7) - ((iEndY * cSin)>>7);
		iTempY = ((iEndX * cSin)>>7) + ((iEndY * cCos)>>7);

		// translate point back:
		iEndX = (VectorObject.Position.x>>7)+iTempX+VectorObject.Origin.x;
			//if (iEndX<0) iEndX=0;
		iEndY = (VectorObject.Position.y>>7)+iTempY+VectorObject.Origin.y;

		// Bounds check to ensure that rotated points are still within the bitmap boundary
		if (iStartX>=0&&iStartY>=0&&iEndX>=0&&iEndY>=0&&iStartX<=BitmapAddress[0]&&iStartY<=BitmapAddress[1]&&iEndX<=BitmapAddress[0]&&iEndY<=BitmapAddress[1])
		{
			DrawLine((u16*)BitmapAddress,(u8)(iStartX),(u8)(iStartY),(u8)(iEndX),(u8)(iEndY),VectorObject.VectorList[iPoint].colour);
		}
		iStartX = VectorObject.VectorList[iPoint].x;
		iStartY = VectorObject.VectorList[iPoint].y;
	}
	
}

We can now call that directly instead of our drawing code:

myVectorObject.Position.x = 0;
myVectorObject.Position.y = 0;
myVectorObject.RotationAngle = 0;
myVectorObject.Scale = 1;

DrawVectorObject((u16*)bmpLogo,myVectorObject);

Which will give us the same shape again, or we can change the scale, position and angle to do something more interesting.

myVectorObject.Points=5;
myVectorObject.VectorList[0].x = 0;
myVectorObject.VectorList[0].y = 3;
myVectorObject.VectorList[0].colour = 1;
myVectorObject.VectorList[1].x = 2;
myVectorObject.VectorList[1].y = 2;
myVectorObject.VectorList[1].colour = 1;
myVectorObject.VectorList[2].x = 3;
myVectorObject.VectorList[2].y = 4;
myVectorObject.VectorList[2].colour = 1;
myVectorObject.VectorList[3].x = 4;
myVectorObject.VectorList[3].y = 1;
myVectorObject.VectorList[3].colour = 1;
myVectorObject.VectorList[4].x = 1;
myVectorObject.VectorList[4].y = 0;
myVectorObject.VectorList[4].colour = 1;
myVectorObject.VectorList[5].x = 0;
myVectorObject.VectorList[5].y = 3;
myVectorObject.VectorList[5].colour = 1;
myVectorObject.Position.x = 2048;
myVectorObject.Position.y = 2048;
myVectorObject.RotationAngle = 16;
myVectorObject.Scale = 6;

DrawVectorObject((u16*)bmpLogo,myVectorObject);
It’s moved! Finally.

There are a couple of things to note here. Firstly, I use a larger scale for the position variables, so that objects can move at different paces, but still move at the right relative speeds.

You’ll also notice that the point definitions of the base object have changed slightly – this is just to make the vector definition as small as possible so that we have more flexibility to scale it up. There is no support here for scaling the object down to make it smaller, but there’s no reason why we couldn’t do that too I suppose.

Secondly, sine() and cosine() as defined in the library are integer values – remember how I mentioned that we don’t have a floating point on the poor old NGPC? So, we need to shift these down by 128 AFTER the multiplication in order to pretend that we’re multiplying by a decimal point. Also, we use a 256 degree circle for the angles – primarily for speed reasons. Everything is better when it’s a power of two.

I’m going to leave this post here, as I think I’ve waffled on plenty well enough about the theory for now. Tune in next time when I might actually start doing something about writing a game…