Let's DRAW! - drawing demo by trajecto
Posted: Fri Aug 06, 2004 3:32 am
I'M BACK EVERYBODY!!!
LET'S DRAW!!!
I am very happy to see the addition of drawing functions to GE
Now let's do it
In this demo we will draw a random starfield of random colors. You can make the starfield denser by continually selecting the Down Arrow. the fantastic Game-Editor setpen(), moveto() and putpixel() functions are demonstrated here along with the C rand() function and the C for loop control.
HERE WE GO!
1. Start a new project and add an actor of type CANVAS.
2. Go to Config and change Game resolution to 240 x 320 Pocket PC (I'm a Pocket PC guy - you dont need to do this).
3. Resize your Canvas Actor to the View Size.
4. Right-Click Events Add Key Down and press the Down Key then Add Action Script Editor.
5. Enter the following code:
int posX = 240;
int posY = 320;
int loopCount = 0;
int x = 0;
int y = 0;
for(loopCount=1; loopCount<1000; loopCount++)
{
x = rand(posX);
y = rand(posY);
setpen(rand(255),rand(255),rand(255),0,1);
moveto(x,y);
putpixel(x,y);
}
6. Add then Immediate Action then Close.
7. Go into Game Mode and press the Down Arrow to try it out.
Here is how your program will look:
http://www.trajectorylabs.com/Draw01.gif
http://www.trajectorylabs.com/Draw02.gif
Here we have only drawn points, NEXT we will cover drawing lines and shapes like this little program I wrote called Imagine: http://www.trajectorylabs.com/Imagine.html
How does that sound???
LET'S DRAW!!!
I am very happy to see the addition of drawing functions to GE
Now let's do it
In this demo we will draw a random starfield of random colors. You can make the starfield denser by continually selecting the Down Arrow. the fantastic Game-Editor setpen(), moveto() and putpixel() functions are demonstrated here along with the C rand() function and the C for loop control.
HERE WE GO!
1. Start a new project and add an actor of type CANVAS.
2. Go to Config and change Game resolution to 240 x 320 Pocket PC (I'm a Pocket PC guy - you dont need to do this).
3. Resize your Canvas Actor to the View Size.
4. Right-Click Events Add Key Down and press the Down Key then Add Action Script Editor.
5. Enter the following code:
int posX = 240;
int posY = 320;
int loopCount = 0;
int x = 0;
int y = 0;
for(loopCount=1; loopCount<1000; loopCount++)
{
x = rand(posX);
y = rand(posY);
setpen(rand(255),rand(255),rand(255),0,1);
moveto(x,y);
putpixel(x,y);
}
6. Add then Immediate Action then Close.
7. Go into Game Mode and press the Down Arrow to try it out.
Here is how your program will look:
http://www.trajectorylabs.com/Draw01.gif
http://www.trajectorylabs.com/Draw02.gif
Here we have only drawn points, NEXT we will cover drawing lines and shapes like this little program I wrote called Imagine: http://www.trajectorylabs.com/Imagine.html
How does that sound???