Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 26-02-2004, 18:30   #1 (permalink)
[+]
 
Benutzerbild von André Michelle
 
Registriert seit: Dec 2002
Ort: cologne
Beiträge: 2.271
MicroPacman < 30 lines

hi,


es gibt wieder einen neuen Actionscript Award 30 line Wettbewerb. Diesmal wollte ich mitmachen, aber ich hätte ich die Bedingungen richtig lesen sollten:
Zitat:
This competition is open to residents in Singapore only. Overseas applications will not be accepted.
Naja, beim nächstenmal.
Trotzdem für alle, jetzt erst recht :o)


ActionScript:
  1. (o = this.createEmptyMovieClip( "point" , 0 )).lineStyle(7,0xffcc00)
  2. o.moveTo(4,4)
  3. o.lineTo(4.5,4);
  4. map= new String("%C2%80%C2%80%C2%80%C2%80A%02A%02%5F%7E%60%3ESFR%26%5F%7E%60%3EA%01%01%02%5Fp%7C%3E%5Fp%7C%3EAbD%02%7F%7E%60%40%03%7E%60%21%03a%04%21%03o%3C%21%7Fo%3C%40%01%0D%19%01%7Fp%7C%40%03p%7C%21%03a%04%21%03p%7C%21%7Fp%7C%40A%02A%02%5F%7E%60%3E%5F%7E%60%3EG%01%012wp%7C8wp%7C8AbD%02%60%7E%60%7E%60%7E%60%7EA%01%01%02%C2%80%C2%80%C2%80%C2%80,%01%01%01%01%40%7F%40%7F%22%03%21C%22%03%21C%22%03%21C%40%C2%80%C2%80%7F%22%11%05C%22%11%05C%40%1F%3D%7F%02%01%01A%02%01%01A%02%01%01A%02%01%01A%02%01%01A%02%01%01A%02%01%01A%02%01%01A%02%01%01A%02%01%01A%02%01%01A%40%7F%40%7F%22%03%21C%22%03%21C%3A%7F%40O%0A%11%05I%0A%11%05I%40%1F%3D%7F%21%03%21%03%21%03%21%03%40%C2%80%C2%80%7F%01%01%01%01").split(",");
  5. for ( var i = 0, eats = 0 ; i < 28 * 31 ; i++ ) {
  6.     occ = ((dec=new String("0000000").substr(0,7-(dec=(unescape(map[0]).charAt(int(i/7)).charCodeAt(0)-1).toString(2)).length)+dec).charAt(i%7)==1);
  7.     eat = ((dec=new String("0000000").substr(0,7-(dec=(unescape(map[1]).charAt(int(i/7)).charCodeAt(0)-1).toString(2)).length)+dec).charAt(i%7)==1);
  8.     new Color(o.duplicateMovieClip("t_"+i,++d,{_x:(i%28)*8,_y:int(i/28)*8,occ:occ})).setRGB(occ?0xee9933:0x0);
  9.     if(eat)new Color(o.duplicateMovieClip("e_"+i,++d,{_x:(i%28)*8+2,_y:int(i/28)*8+2,_xscale:50,_yscale:50,onUnload:function(){if(!(--eats)){trace( "CONGRATULATIONS! LEVEL COMPLETE!");_root.gameover=true;}}},eats++)).setRGB(0x00ff00);
  10. }
  11. o.duplicateMovieClip("player",++d,{ _x: 13 * 8, _y: 23 * 8 } ).onEnterFrame = function () {
  12.     if ((this._x+=vx)%8==0&&(this._y+=vy)%8==0){
  13.         vx=((usercode=(Key.isDown(Key.RIGHT))?1:(Key.isDown(Key.LEFT))?2:(Key.isDown(Key.DOWN))?3:(Key.isDown(Key.UP))?4:0)==1&&!_root["t_"+((this._x>>3)+1+((this._y>>3)*28))].occ)*2+(usercode==2&&!_root["t_"+((this._x>>3)-1+((this._y>>3)*28))].occ)*-2;
  14.         vy=(usercode==3&&!_root["t_"+((this._x>>3)+(((this._y>>3)+1)*28))].occ)*2+(usercode==4&&!_root["t_"+((this._x>>3)+(((this._y>>3)-1)*28))].occ)*-2;
  15.         _root["e_"+((this._x>>3)+(((this._y>>3))*28))].removeMovieClip();
  16.     }
  17.     this._x= ( this._x == 216 && usercode == 1 ) ? 0 : ( this._x == 0 && usercode == 2 ) ? 216 : this._x;
  18. }
  19. for (e=0;e<5;e++,new Color(enemy).setRGB(0xff0000)){
  20.     (enemy = o.duplicateMovieClip("enemy_"+e,++d,{ _x: 13 * 8, _y: 13 * 8 } )).onEnterFrame = function () {
  21.         if ( ( this._x += this.dir.x ) % 8 == 0 && (this._y += this.dir.y) % 8 == 0 ){
  22.             this._x = ( this._x == 216 && this.dir.x == 2 ) ? 0 : ( this._x == 0 && this.dir.x == -2 ) ? 216 : this._x;
  23.             possible = [];
  24.             if ( !_root["t_"+(((this._x>>3)+1)+((this._y>>3)*28))].occ && this.dir.x !=-2 ) possible.push ( { x: 2, y: 0 } );
  25.             if ( !_root["t_"+(((this._x>>3)-1)+((this._y>>3)*28))].occ && this.dir.x != 2 ) possible.push ( { x:-2, y: 0 } );
  26.             if ( !_root["t_"+((this._x>>3)+(((this._y>>3)+1)*28))].occ && this.dir.y !=-2 ) possible.push ( { x: 0, y: 2 } );
  27.             if ( !_root["t_"+((this._x>>3)+(((this._y>>3)-1)*28))].occ && this.dir.y != 2 ) possible.push ( { x: 0, y:-2 } );
  28.             this.dir = possible[ random( possible.length ) ];
  29.         }
  30.         if (_root.gameover || (_root.gameover = ((this._x-(p = _root.player)._x)*(this._x-p._x)+(this._y-p._y)*(this._y-p._y)<64))) {
  31.             trace( "GAME OVER." );
  32.             delete this.onEnterFrame;
  33.             delete p.onEnterFrame;
  34.         }
  35.     }
  36. }
Angehängte Dateien
Dateityp: zip micro_pacman.zip (3,4 KB, 110x aufgerufen)
__________________
aM

blog | laboratory | tonfall | processing

Audiotool.com
André Michelle ist offline   Mit Zitat antworten
Alt 26-02-2004, 18:47   #2 (permalink)
Steffen G.
 
Benutzerbild von Tschdaeff
 
Registriert seit: Aug 2001
Ort: Ba-Wü
Beiträge: 4.123
Thumbs up

du bist der hammer

fette sache!!!!


cu mfg
Tschdaeff
__________________
mod@
www.flashbattle.de
www.steffen-guse.de
------------------------------------

Tschdaeff ist offline   Mit Zitat antworten
Alt 26-02-2004, 21:12   #3 (permalink)
Neuer User
 
Registriert seit: Mar 2002
Ort: D'dorf
Beiträge: 765

Ich gebe mal mindestens fünf Ausrufezeichen:

fette sache!!!!!

Wie lange sitzt du an so nem Script?
Genial!

gruß,
roman
romän ist offline   Mit Zitat antworten
Alt 26-02-2004, 21:37   #4 (permalink)
PIXELSCHIEBER
 
Benutzerbild von FlashKasper
 
Registriert seit: Oct 2001
Ort: Salem, Bodensee
Beiträge: 638
feines Teil

das muss ich mir mal in Ruhe anschaun
__________________
Pack den Highscore
FlashKasper ist offline   Mit Zitat antworten
Alt 26-02-2004, 23:32   #5 (permalink)
PIXELSCHIEBER
 
Benutzerbild von FlashKasper
 
Registriert seit: Oct 2001
Ort: Salem, Bodensee
Beiträge: 638
bin grade am genauer anschaun

Und die Zeile bereitet mir noch Kopfzerbrechen?

Das mit der Tastaturabfrage ist klar. Vielleicht kannst du mir ja den Rest kurz erläutern?

ActionScript:
  1. vx = ((usercode=(Key.isDown(Key.RIGHT))?1:(Key.isDown(Key.LEFT))?2:(Key.isDown(Key.DOWN))?3:(Key.isDown(Key.UP))?4:0)==1&&!_root["t_"+((this._x>>2)+1+((this._y>>2)*56))].occ)*2+(usercode==2&&!_root["t_"+((this._x>>2)-1+((this._y>>2)*56))].occ)*-2;

Danke und Gruss
FlashKasper
__________________
Pack den Highscore
FlashKasper ist offline   Mit Zitat antworten
Alt 26-02-2004, 23:43   #6 (permalink)
dummschnack
 
Benutzerbild von Chino
 
Registriert seit: Mar 2002
Ort: Essen
Beiträge: 1.778
Du bist doch wahnsinnig, André!

Echt sehr schön! Hut ab.

Gruss, Chino
__________________
» flashbored since 2006
» my band: radioghost
Chino ist offline   Mit Zitat antworten
Alt 27-02-2004, 09:42   #7 (permalink)
[+]
 
Benutzerbild von André Michelle
 
Registriert seit: Dec 2002
Ort: cologne
Beiträge: 2.271
Zitat:
Vielleicht kannst du mir ja den Rest kurz erläutern?
Ich berechne den Vektor für den PacMan. Der Witz ist, dass man mit 'true' und 'false' rechnen kann, heisst das 'true' x 3 = 3, weil sie intern als 0 und 1 verwenden werden. Damit kann man den Code sehr stark kleinkriegen.
__________________
aM

blog | laboratory | tonfall | processing

Audiotool.com
André Michelle ist offline   Mit Zitat antworten
Alt 27-02-2004, 09:51   #8 (permalink)
PIXELSCHIEBER
 
Benutzerbild von FlashKasper
 
Registriert seit: Oct 2001
Ort: Salem, Bodensee
Beiträge: 638
Danke für die Info@Andre' Michelle, ist mir jetzt ziemlich klar.

Feine Idee!!!
__________________
Pack den Highscore
FlashKasper ist offline   Mit Zitat antworten
Alt 27-02-2004, 10:44   #9 (permalink)
nky
Bontempi Punk
 
Benutzerbild von nky
 
Registriert seit: Dec 2001
Ort: Dtld/Pfalz
Beiträge: 4.185
beeindruckend ! thx for Inspiration !

auch die erkenntnis mit bools zu rechnen ist gold wert !

Gruss nky
nky ist offline   Mit Zitat antworten
Alt 27-02-2004, 18:42   #10 (permalink)
Flash-holic
 
Benutzerbild von DeMoehn
 
Registriert seit: Nov 2003
Ort: Neunkirchen(Saar)
Beiträge: 988
*würg* wie krank! Goiles script/ und spiel. Aber der Code is ja ma sowas von durschgeknallt hehe find ich goil. Wie lange machst du das schon?¿? Warst bestimmt so einer der Auf den Alten Amigas schon versucht hat Soundprogramme zu scripten lool. Wie goil
__________________
Wer Großes versucht, ist bewunderswert, auch wenn er fällt.
Lucius Annaeus Seneca
(ca. 4 v. Chr - 65 n. Chr.)


DeMoehn ist offline   Mit Zitat antworten
Alt 28-02-2004, 18:22   #11 (permalink)
Achim Math.PI
 
Benutzerbild von bloba
 
Registriert seit: Jul 2001
Ort: cool Colonia
Beiträge: 11.642
Thumbs up

krasses game !!
hut ab !!
__________________
gruß bloba

2 x onkel² b_d
bloba ist offline   Mit Zitat antworten
Alt 28-02-2004, 18:24   #12 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
Thumbs up

me to
abgefahren, sehr Geiles Teil
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake ist offline   Mit Zitat antworten
Alt 28-02-2004, 19:53   #13 (permalink)
~~~~~~~~~~~~
 
Benutzerbild von _geo_
 
Registriert seit: May 2002
Ort: AUSTRIA (OÖ)
Beiträge: 3.298
Thumbs up

extra geil !
__________________
--- :P ---

Blog
Bei unerwünschten Nebenwirkungen zerreißen Sie die Packungsbeilage oder erschlagen ihren Arzt oder Apotheker
_geo_ ist offline   Mit Zitat antworten
Alt 29-02-2004, 11:55   #14 (permalink)
ActionStripper
 
Benutzerbild von Mr.Twister
 
Registriert seit: Nov 2001
Ort: Oldenburg
Beiträge: 3.275
der HAMMER !!!

ich glaube, ich hätte angst vor mir selber, wenn ich so abstrakt denken könnte :-)
__________________
Design ist AUCH Geschmackssache.
Mr.Twister ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 21:56 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele