Objektumok - folytatás + tömbök


Röpi

A Mai óra menete:


Bemelegítés

Konstansok használata

Ciklusok:

A függvényekről egy picit többet

Ismétlés: Metódusok objektumba ágyazása


Gyakorlati rész:

cloudObject = function(x, y, velocity_x){
	this.x = x;
	this.y = y;
	this.velocity_x = velocity_x;

	this.img = loadImage("mistic_cloud.png");

	this.logic = function(){
		this.x += this.velocity_x;
		if(this.x > 600){
			this.x = -300;
		}
	};

	this.draw = function(context){
		context.drawImage(this.img, this.x, this.y);
	};
}

Házi feladat:

Szorgalmi feladat: