# pixelsketch

### » Tue Aug 14, 2012 1:15 am

Check out one of my first great accomplishments with construct2 : a simple 8x8 drawing app,
Next step is to learn how to create a save/load feature so ppl can save their creations, enjoy!
https://dl.dropbox.com/u/73848762/simon/index.html
B
15
S
3
G
4
Posts: 61
Reputation: 3,554

### » Tue Aug 14, 2012 4:41 am

Nice, its a visual representation of an array right?
B
37
S
11
G
6
Posts: 962
Reputation: 11,259

### » Tue Aug 14, 2012 5:30 am

That's how I need to learn how to do it, but the way I did it is simple, I made the color objects and a bunch of blank canvas squares all aligned to a 100x100 pixel 8x8 grid, the color object sets a global variable And the.blank canvas object changes to a color.set by the variable that is stored in an animation frame .
If you can give me an example of how to do it in an array though, it would probably make it easier to save though right?
-zakchaos
B
15
S
3
G
4
Posts: 61
Reputation: 3,554

### » Tue Aug 14, 2012 5:56 am

This is the best tutorial on arrays.
http://www.scirra.com/tutorials/307/arrays-for-beginners/page-1

It has pictures unlike the one in the manual.
Basically an array creates a 2D or 3D box where each square contains a value.

An array starts from a 0,0,0 (in this case you only need a 2D box, so you only need a X,Y, so yours will be 0,0)

So imagine your 10,10 grid, the first top left pixel should be a value at 0,0, the one on its right would be 1,0 and the one below that 1,1.

Store a value from 1-X (X being the number of colors you want in the palette) and make 0 white.

Make a every tick to check if eg. ArrayAt(0,0) value = 1. If it is, change its color to 1.

:) saving would be a piece of cake from there.
B
37
S
11
G
6
Posts: 962
Reputation: 11,259

### » Tue Aug 14, 2012 10:39 am

This is a good start,But can you make an option to reduce the pixel size?.
B
23
S
3
G
6
Posts: 1,356
Reputation: 7,176