25行AS3代码编程大赛的第一名!25行代码构造的AS3游戏

叫做Marius Heil的AS开发者使用AS3构造了一个25行代码的AS3游戏,并且获得了25行AS3代码编程大赛的第一名!

/** * 25-Line ActionScript Contest Entry * * Project: SmilieBounce 25 * Author: Marius Heil * Date: 26.11.2008 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ // 3 free lines! Alter the parameters of the following lines or remove them. // Do not substitute other code for the three lines in this section [SWF(width=800, height=650, backgroundColor=0xffffff, frameRate=12)] stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; // 25 lines begins here! stage.addEventListener(KeyboardEvent.KEY_DOWN, function(e:KeyboardEvent){ root["key"+e.keyCode] = true;}); stage.addEventListener(KeyboardEvent.KEY_UP, function(e:KeyboardEvent){ root["key"+e.keyCode] = false; }); (this.field = addChild(new TextField())).text = this.backup = (this.field.type=(this.field.autoSize="left").substring(0, 0)+"input").substring(0, 0)+"‼==============================================================================================================================================‼/n‼ ‼/n‼ ‼/n‼ ♫♫ ‼/n‼♫♫♫♫♫♫ ▐▀▐ ¥ ▀ ☼ ▀ ∙ ‼/n▀▀▀▀▀▀▀▀ ∙ ▐ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ♫♫♫♫‼/n‼ ▐ ▀▀▀▀▀‼/n‼ ▀♫♫♫♫♫♫♫♫♫♫♫♫♫♫ ∙ ∙ ▐ ‼/n‼ ∙ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▐ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▐ ∙ ‼/n‼ ▐ ▀ ☼ ▐ ▐ ‼/n‼ ▐ ▀▀▀▀▀▀▀ ▐▀▀▀▀ ‼/n‼ ∙ ▐ ▐ ‼/n‼ ♫♫♫♫ ^///^ ▐ ☼ ▀ ▐ ‼/n‼ ∙ ▀▀▀▀▀▀▀▀▀ ▐▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▐ ‼/n‼ ♫♫♫♫♫ ♫♫♫♫♫ ▐ ▐ ‼/n‼ ▀▀▀▀▀ ▀▀▀▀▀ ▐♫▐ ///^/// ^/// ▐ ▀▀▀▀▀▀▀▀▀▀▀▐ ∙ ‼/n‼♫♫♫♫ ▐♫▐ / // //^^///// //^///▐ ▐ ‼/n▀▀▀▀▀▀▀▀▀▀ ▐♫▐ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▐ ∙ ♫♫ ‼/n‼ ▀ ▐♫▐ ▐ ▐ ▐ ♫♫ ‼/n‼ ▀ ¥ ▀ ☼ ▀ ▐♫▐ ▐ ▀▀▀▀▐ ▐ ▐ ▀▀ ‼/n‼ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▐♫▐ ▐ ♫♫♫♫♫♫♫▐ ▐▀ ▐ ‼/n‼ ☺ ▀▀▀▀▀▀ ♫ ▀▀▀▀▀▀▀▀▐ ▐ ▐ ‼/n‼ ΞΞ ▐ ▐ ▀▐ ‼/n‼ ♫ ///^ ▀▀▀ ▐ ▐ ‼/n‼ ♫♫♫ ΞΞΞΞ ▀///^/ //// ▀ ¥ ▐ ▐ ◘◘ ‼/n‼ ▀▀▀▀▀▀▐ ΞΞ === ▐ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▐ ▀▀▀▀▀▀ ‼/n‼ ‼‼~~~~~~~‼‼ ▐ ▐ ▀▐ ▀ ‼/n▀▀▀▀▀▀ ‼‼░░░░░░░‼‼▬▬▬▬▬ ▐ /// /// ^/// ///^ /// /// ///^ ///^▐ ▐ /// /// /// ♫♫ ‼/n‼♫♫ ‼‼░░░░░░░‼‼ΞΞΞΞΞ ▐/ // //^^///// //^/ //^ // //^^///^/ ///// //▐ ☼ ▀ ▐^ // //^/ //♫♫///^‼/n‼=========‼‼‼‼‼‼‼‼‼‼‼==========================================================================================================================‼/nSmilieBounce 25 with built in copy&replace editor ;-)/n/n[.:control:.] [.:enemies:.] [.:goal:.] [.:have fun:.]/n ↑up/n ← → ▀ ¥▀☼ ▀~~▀///▀ ◘◘ & ♫♫ & do not cheat ;-)/n left right ▀▀▀▀▀▀▀▀▀▀▀▀▀/n/n[.:score:.] "; addEventListener(Event.ENTER_FRAME, function(){ replace("☼", "☼", true, Math.round(Math.random())*2-1, 0, "¥", "¥", true, Math.round(Math.random())*2-1, 0, "☺", "☺", root["key"+39], 1, 0, "☺", "☺", root["key"+37], -1, 0, "☺", "☺", true, 0, 1) }); function replace(...args) { var pos=this.field.text.indexOf("☺"); if (this.jCount>0 && "♫♪☼~^/// ".indexOf(this.field.text.substring( (pos%145)+(Math.floor(pos/145)-1)*145 , (pos%145)+(Math.floor(pos/145)-1)*145 +1)) > -1) this.field.text = (((this.jCount = this.jCount -1)-this.jCount)+"").substring(0,0)+(this.field.text.substring(0,pos)+" "+this.field.text.substring(pos+1,this.field.text.length)).substring(0 , (pos%145)+(Math.floor(pos/145)-1)*145) + "☺" + (this.field.text.substring(0,pos)+" "+this.field.text.substring(pos+1,this.field.text.length)).substring((pos%145)+(Math.floor(pos/145)-1)*145 +1 , this.field.text.length  );// Neue x, y position berechnen else if ("♫♪☼~^/// ".indexOf(this.field.text.substring( (pos%145)+(Math.floor(pos/145)-1)*145 , (pos%145)+(Math.floor(pos/145)-1)*145 +1)) < 0) this.jCount=0; if ( ((this.field.x+(pos%145)*12) > 500 || (this.field.x+(pos%145)*12) < 300) && (this.field.x < 0 || ((this.field.x+(pos%145)*12)-400)*0.03 > 0) && (this.field.x > -930 || ((this.field.x+(pos%145)*12)-400)*0.03 < 0) ) this.field.x -= ((this.field.x+(pos%145)*12)-400)*0.03; if(root["key"+16]) this.field.text = tempField = this.backup; var tempField:String=this.field.text; for (var j:int=0; j<args.length; j+=(this.pos=0)+5) { while( (this.pos = this.field.text.indexOf(args[j+0], this.pos+1)) > -1){ var futChar = this.field.text.substring( (this.pos%145)+args[j+3]+(Math.floor(this.pos/145)+args[j+4])*145 , (this.pos%145)+args[j+3]+(Math.floor(this.pos/145)+args[j+4])*145 +1); if ( "♫♪☼~^ ///".indexOf(this.field.text.substring( (pos%145)+(Math.floor(pos/145)+1)*145 , (pos%145)+(Math.floor(pos/145)+1)*145 +1)) < 0 && root["key"+38] && this.field.text.substring(this.pos,this.pos+1) == "☺" ) this.jCount=5; if ( (args[j+2]) && "·☼¥☺~^ ♫♪///◘".indexOf(futChar) > -1 && (!this.jCount || args[j+4] != 1)) { tempField = (tempField.substring(0, this.pos) + " " + tempField.substring(this.pos+1, tempField.length)); tempField = tempField.substring(0 , (this.pos%145)+args[j+3]+(Math.floor(this.pos/145)+args[j+4])*145) + args[j+1] + tempField.substring((this.pos%145)+args[j+3]+(Math.floor(this.pos/145)+args[j+4])*145 +1 , tempField.length  ); if ((this.field.text.substring(this.pos,this.pos+1) == "☺" && "~¥☼^///".indexOf(futChar) > -1) || (futChar == "☺" && "☼¥~^^///".indexOf(this.field.text.substring(this.pos,this.pos+1)) > -1)) this.field.text=tempField="/n ______ __ __ ______ __ __ __/n / __ // | | | | / || | | | | |/n | | | | | | | | | ,----'| |__| | | |/n | | | | | | | | | | | __ | | |/n | `--' | | `--' | | `----.| | | | |__|/n //______/ //______/ //______||__| |__| (__)/n/n/n/n +++++ +++++/n +#### ++ +#### ++/n +# ‼ You killed a lovely +# ‼/n | ‼ Smilie :-( | ‼/n | RIP ‼ | RIP ‼/n | ‼ | ‼/n | #‼ Better Luck next Time | #‼/n | ##‼ | ##‼/n +++######-++ +++######-++/n //. **. // //. , . ///n // ° ****// // ° ° ///n // ** )(// /**. ** ///n // **** // Smile again: /******** ///n //° .)( ° // // )( .)( ///n /+________+/ Hit SHIFT for rebirth /+________+//n +----------+ +----------+"; if (this.field.text.substring(this.pos,this.pos+1)=="☺"&&"♫♪".indexOf(futChar)>-1) tempField+="I"; if (this.field.text.substring(this.pos,this.pos+1)=="☺" && futChar == "◘") this.field.text=tempField =" .-./n /. ///n (.. )/n // //n /// `-´ ////n /// () /°´°// () ////n (´) () /// /// / ´°°°// /// /// () (´)/n |// /// /°°// /´´// / ´ °°°// / ´// /°°// /// /|/n |´/// ´///°´°´// /´ ´´// / ´ °°°°°// / ´´// /°°+°/// ´///+|/n |´´//´´/°°´°°°//´ ´´´´/ ° ´°°°°°°//´ ´ ´´/°.°...//´´/##|/n |´ ´///°° ´ °°°//´´´´/ ´ °´´´°°°°°// ´´´/°°.+...#///+##|/n |´ °°° °°°°°°//´´/ °#######°°°°//´´/°°......#.°+#+|/n |´ ´´ ´ °° °°°°///°°## ##°°°///°°..°.++.#.###.|/n |´ ´´´ °°°°°°°°°°# #°°°...°°°°°....+++|/n | ´ ´´ °°°°°°°°# ©© ©© #°°.°.°°°.°°+#..++|/n | ´´´° °°°°+++# ©©©© ©©©© #+++°°°°...+..°.+|/n |´´ ´´´°°°°+ # ©© ©© # +°°.°°°+.#.+|/n | ´ ´´°°°°+ © ©# #© © +°°°°°.#°#+|/n | ´ ´´ °°+ # ** ** # +°°.+..°#+|/n |´´´´ °°°+ * # ** ** # * +°°°.+#+.#+|/n | ´´ °°°°°+ *** +# ****** #+ *** +°°°°#+°##.+|/n |´ °°° °°°°°°+++°°°°## ##°°°°+++°°°°°+°°+°°#+|/n | CONGRATULATIONS!°°°°######°°°YOU JUST FINISHED°#.|/n (+---------------------------------------------------+)/n /°´ °°°**_____*__**__*_____*_*°**°*_____*______** ´ ´´///n /°´´ *° */ ____| /// |_ _| |*°°*|_ _| ____|**´´*´°´)/n (*°° ° °*| (___*| // / |*| |*| |*°°***| |*| |__ *°° ´ ´°´° )/n //*´***_**//___ //| |///| |*| |*| |******| |*| __|*°*°°°**´´´///n (//__ | |*____) | |**| |_| |_| |____*_| |_| |____ ***°**°° *)/n /**´**| ||_____/|_|_*|_|_____|______|_____|______|_____* °*//n (*´´°*| '_ //*/ _ //| |*| | _ //*/ __/ _ //***/ _ //| ____| _//n |** *| |_) | (_) | |_| | |*| | (_| __/*°*|/*) /| |__** *°)/n (**´*|_.__/*//___/*//__,_|_|*|_|//___//___|*°°**/ /*|___ //* * |/n //** *´´*´*°***°*°°°**°°******°°°°°****°***/ /_**___) | **)/n ( ***Wanna play again? Just Hit SHIFT***/_____|____/* *//n //____________________________________________________//n/n Final score (if you didn't cheat:D): "+(this.field.text.length-4581); }} this.field.text=tempField;} this.field.setTextFormat(new TextFormat("Lucida Console", 20, null, null, null, null, null, null, null, null, null, null, -3)); } // 25 lines ends here!

 

 

 

 

 

 

文章来自: 闪无忧(www.5uflash.com) 详文参考:http://www.5uflash.com/flashjiaocheng/Flash-as3-jiaocheng/4677.html

你可能感兴趣的:(25行AS3代码编程大赛的第一名!25行代码构造的AS3游戏)