Originally Posted by
Chig
I think he meant to write loop instead of oop
And he's right cause in uni, they drilled us hard on those for loops and while loops. Plus also learn how to do a loop within a loop
EDIT: surfing forums on andriod ain't so bad
No, he meant oop. Not loop. Loops are easy and not important.
Objective oriented programming.
Let's say you got a wall. The wall exists out of bricks. Every brick is from the brick class.
Pseudocode:
actionscript Code:
class Brick{
var width, height:Int;
var x, y:Int;
constructor(_x, _y, _w, _h:Int){
this.create();
x = _x;
y = _y;
width = _w;
height = _h;
}
Draw(canvas:Canvas){
canvas.drawThis(x, y, width, height);
}
}
Pseudocode:
actionscript Code:
class Wall{
var bricks:Array;
Create(){
var i:Int = 0;
var j:Int = 0;
for(j = 0; j < 10; j++) {
for(i = 0; i < 10; i++) {
bricks.push(new Brick(5*j,10*i,5,10));
}
}
}
Draw(canvas:Canvas){
for(j = 0; j < bricks.length; j++) {
bricks[j].draw(this);
}
}
}
edit:
If you want to start with directX look into this: http://drunkenhyena.com/cgi-bin/directx.pl