Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var baelle:Array = new Array(b1, b2, b3, b4, b5, b6);
- var x_richtung:Array = new Array(1, 1, 1, 1, -1, -1);
- var y_richtung:Array = new Array(1, 1, -1, -1, 1, -1);
- baelle[0].x = 80;
- baelle[0].y = 100;
- baelle[1].x = 160;
- baelle[1].y = 30;
- baelle[2].x = 280;
- baelle[2].y = 150;
- baelle[3].x = 150;
- baelle[3].y = 260;
- baelle[4].x = 430;
- baelle[5].y = 40;
- var farbe:ColorTransform = new ColorTransform();
- this.addEventListener(Event.ENTER_FRAME, bewegen);
- function bewegen(evt:Event):void {
- for (var i=0; i<6; i++) {
- baelle[i].x = baelle[i].x + x_richtung[i];
- baelle[i].y = baelle[i].y + y_richtung[i];
- for (var a=0; a<6; a++) {
- for (var c=0; c<6; c++) {
- if(baelle[a].hitTestObject(baelle[c]) && baelle[c] != baelle[a]) {
- x_richtung[a] *= -1;
- y_richtung[a] *= -1;
- farbe.color = Math.random() * 0xFFFFFF;
- baelle[a].transform.colorTransform = farbe;
- }
- }
- if(baelle[a].hitTestObject(rechts_mc) || baelle[a].hitTestObject(links_mc)){
- x_richtung[a] *= -1;
- y_richtung[a] *= 1;
- farbe.color = Math.random() * 0xFFFFFF;
- baelle[a].transform.colorTransform = farbe;
- }
- if(baelle[a].hitTestObject(oben_mc) || baelle[a].hitTestObject(unten_mc)) {
- x_richtung[a] *= 1;
- y_richtung[a] *= -1;
- farbe.color = Math.random() * 0xFFFFFF;
- baelle[a].transform.colorTransform = farbe;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment