181
Axe / Axe Greyscale Tutorial
« on: February 20, 2011, 09:36:05 am »
Introduction
When I was new to Axe programming, I thought greyscale was reserved for extreme coders. I thought that making a greyscale game was really hard and I couldn't possibly do it. However, I noticed most games were greyscale and decided to try to make my first greyscale program. This is a quick guide and tutorial to help you with Axe greyscale.
The first think you need to know is that there are two types of greyscale in Axe. You can have three levels greyscale and four levels greyscale. The first one has three colours: Black, Grey and White. The second one has four colours: Black, Dark Grey, Light Grey and White.
Note: When I say white, I mean nothing, empty, the LCD colour.
We're starting off with three level greyscale since it is more simple and easy to understand.
I assume you've had previous experience in Axe programming, otherwise it will be difficult for you to understand the tutorial from now on.
The basics
Let's start by making your first greyscale program.
I'll post the code right here and then explain:
This is what this program will create:
It's a simple program that has greyscale and a gravity engine. It's a small grey square falling until it reaches the black line.
How did I achieve this?
3 Level Greyscale
Most drawing commands in Axe have a similar command followed by an 'r'. This 'r' can be found in 2ND+APPS+3.
The calculator can be divided in two parts, the main buffer (or front buffer) and the back buffer. It's a bit like layers, the back buffer's images will be displayed behind the main buffer's images. The back buffer is also a way to draw greyscale images.
If you had already drawn images on Axe, you probably did something like this:
Pt-On(X,Y,Pic
This draws pictures in the front buffer. The next one draws them in the back buffer:
Pt-On(X,Y,Pic)r
To display mono (black and white) images, you'd use:
DispGraph
For greyscale images you use:
DispGraphr
This is very simple, but where's the greyscale?
If I draw something to the back buffer only it will be grey, if I don't draw nothing, it'll be white.
If I draw something in the main buffer, it will be black. If I draw something both in the main and the back buffer it'll be black too (example):
In three level greyscale, we always use DispGraphr to display images..
Now let's make a four level greyscale program.
4 Level Greyscale
Now that I've thought you the basics, four level greyscale is very easy to understand.
First of all, we use DispGraphrr to display images.
Now, how do we make black, light grey or dark grey images?
Here's an example of a black sprite, a light grey sprite and a dark grey sprite in order:
More Information
When you want to clear the back buffer, you also need to use the r:
ClrDrawr
Conclusion
I want to thank BuilderBoy who taught me greyscale originally (he doesn't know he did, but he did).
If you have any doubts, you can PM me or respond to the topic, someone or me will help you out.
Attachments
Attached is Zip File with the source and executable program we made here in the first place and the screenshot.
When I was new to Axe programming, I thought greyscale was reserved for extreme coders. I thought that making a greyscale game was really hard and I couldn't possibly do it. However, I noticed most games were greyscale and decided to try to make my first greyscale program. This is a quick guide and tutorial to help you with Axe greyscale.
The first think you need to know is that there are two types of greyscale in Axe. You can have three levels greyscale and four levels greyscale. The first one has three colours: Black, Grey and White. The second one has four colours: Black, Dark Grey, Light Grey and White.
Note: When I say white, I mean nothing, empty, the LCD colour.
We're starting off with three level greyscale since it is more simple and easy to understand.
I assume you've had previous experience in Axe programming, otherwise it will be difficult for you to understand the tutorial from now on.
The basics
Let's start by making your first greyscale program.
I'll post the code right here and then explain:
Code: [Select]
.GRS
[FFFFFFFFFFFFFFFF]->Pic1
5->Y
40->X
Repeat getKey(15)
Pt-On(X,Y,Pic1)r
Line(0,63,95,63
If Y<55
Y+1->Y
End
DispGraphr
ClrDrawr
End
This is what this program will create:
It's a simple program that has greyscale and a gravity engine. It's a small grey square falling until it reaches the black line.
How did I achieve this?
3 Level Greyscale
Most drawing commands in Axe have a similar command followed by an 'r'. This 'r' can be found in 2ND+APPS+3.
The calculator can be divided in two parts, the main buffer (or front buffer) and the back buffer. It's a bit like layers, the back buffer's images will be displayed behind the main buffer's images. The back buffer is also a way to draw greyscale images.
If you had already drawn images on Axe, you probably did something like this:
Pt-On(X,Y,Pic
This draws pictures in the front buffer. The next one draws them in the back buffer:
Pt-On(X,Y,Pic)r
To display mono (black and white) images, you'd use:
DispGraph
For greyscale images you use:
DispGraphr
This is very simple, but where's the greyscale?
Code: [Select]
----- Black Grey White
Main Buffer X
Back Buffer X X
If I draw something to the back buffer only it will be grey, if I don't draw nothing, it'll be white.
If I draw something in the main buffer, it will be black. If I draw something both in the main and the back buffer it'll be black too (example):
Code: [Select]
Pt-On(10,30,Pic1)r
Pt-On(10,30,Pic1
In three level greyscale, we always use DispGraphr to display images..
Now let's make a four level greyscale program.
4 Level Greyscale
Now that I've thought you the basics, four level greyscale is very easy to understand.
First of all, we use DispGraphrr to display images.
Now, how do we make black, light grey or dark grey images?
Code: [Select]
DispGraphrr:
Buffer BackBuffer Color
White
X Light Grey
X Dark Grey
X X Black
Here's an example of a black sprite, a light grey sprite and a dark grey sprite in order:
Code: [Select]
Pt-On(50,40,Pic1)r
Pt-On(50,40,Pic1
Pt-On(0,0,Pic2)r
Pt-On(0,40,Pic3
More Information
When you want to clear the back buffer, you also need to use the r:
ClrDrawr
Conclusion
I want to thank BuilderBoy who taught me greyscale originally (he doesn't know he did, but he did).
If you have any doubts, you can PM me or respond to the topic, someone or me will help you out.
Attachments
Attached is Zip File with the source and executable program we made here in the first place and the screenshot.