25行代码构造的AS3游戏

王朝学院·作者佚名  2008-12-30
窄屏简体版  字體: 小  |  中  |  大  |  超大  

叫做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鈥?========鈥尖�鈥尖�鈥尖�鈥尖�鈥尖�鈥?=========================================================================================================================鈥糪nSmilieBounce 25 with built in copy&replace editor ;-)

[.:control:.] [.:enemies:.] [.:goal:.] [.:have fun:.]

鈫憉p

鈫? 鈫? 鈻�楼鈻��鈻�~鈻�\鈻� 鈼樷棙 & 鈾櫕 & do not cheat ;-)

left right 鈻�杸鈻�杸鈻�杸鈻�杸鈻�杸鈻�杸鈻�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="

______ __ __ ______ __ __ __

/ __ \ | | | | / || | | | | |

| | | | | | | | | ,----'| |__| | | |

| | | | | | | | | | | __ | | |

| `--' | | `--' | | `----.| | | | |__|

\______/ \______/ \______||__| |__| (__)

+++++ +++++

+#### ++ +#### ++

+# 鈥? You killed a lovely +# 鈥糪n | 鈥? Smilie :-( | 鈥糪n | RIP 鈥? | RIP 鈥糪n | 鈥? | 鈥糪n | #鈥? Better Luck next Time | #鈥糪n | ##鈥? | ##鈥糪n +++######-++ +++######-++

//. **. // //. , . //

// 掳 ****// // 掳 掳 //

// ** )(// /**. ** //

// **** // Smile again: /******** //

//掳 .)( 掳 // // )( .)( //

/+________+/ Hit SHIFT for rebirth /+________+/

+----------+ +----------+";

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 =" .-.

/. \

(.. )

\ /

/\ `-麓 /\

\/ () /掳麓掳\ () \/

(麓) () /\ /\ / 麓掳掳掳\ /\ /\ () (麓)

|\ /\ /掳掳\ /麓麓\ / 麓 掳掳掳\ / 麓\ /掳掳\ /\ /|

|麓\/ 麓\/掳麓掳麓\ /麓 麓麓\ / 麓 掳掳掳掳掳\ / 麓麓\ /掳掳+掳\/ 麓\/+|

|麓麓\麓麓/掳掳麓掳掳掳\麓 麓麓麓麓/ 掳 麓掳掳掳掳掳掳\麓 麓 麓麓/掳.掳...\麓麓/##|

|麓 麓\/掳掳 麓 掳掳掳\麓麓麓麓/ 麓 掳麓麓麓掳掳掳掳掳\ 麓麓麓/掳掳.+...#\/+##|

|麓 掳掳掳 掳掳掳掳掳掳\麓麓/ 掳#######掳掳掳掳\麓麓/掳掳......#.掳+#+|

|麓 麓麓 麓 掳掳 掳掳掳掳\/掳掳## ##掳掳掳\/掳掳..掳.++.#.###.|

|麓 麓麓麓 掳掳掳掳掳掳掳掳掳掳# #掳掳掳...掳掳掳掳掳....+++|

| 麓 麓麓 掳掳掳掳掳掳掳掳# 漏漏 漏漏 #掳掳.掳.掳掳掳.掳掳+#..++|

| 麓麓麓掳 掳掳掳掳+++# 漏漏漏漏 漏漏漏漏 #+++掳掳掳掳...+..掳.+|

|麓麓 麓麓麓掳掳掳掳+ # 漏漏 漏漏 # +掳掳.掳掳掳+.#.+|

| 麓 麓麓掳掳掳掳+ 漏 漏# #漏 漏 +掳掳掳掳掳.#掳#+|

| 麓 麓麓 掳掳+ # ** ** # +掳掳.+..掳#+|

|麓麓麓麓 掳掳掳+ * # ** ** # * +掳掳掳.+#+.#+|

| 麓麓 掳掳掳掳掳+ *** +# ****** #+ *** +掳掳掳掳#+掳##.+|

|麓 掳掳掳 掳掳掳掳掳掳+++掳掳掳掳## ##掳掳掳掳+++掳掳掳掳掳+掳掳+掳掳#+|

| CONGRATULATIONS!掳掳掳掳######掳掳掳YOU JUST FINISHED掳#.|

(+---------------------------------------------------+)

/掳麓 掳掳掳**_____*__**__*_____*_*掳**掳*_____*______** 麓 麓麓\

/掳麓麓 *掳 */ ____| \/ |_ _| |*掳掳*|_ _| ____|**麓麓*麓掳麓)

(*掳掳 掳 掳*| (___*| \ / |*| |*| |*掳掳***| |*| |__ *掳掳 麓 麓掳麓掳 )

\*麓***_**\___ \| |\/| |*| |*| |******| |*| __|*掳*掳掳掳**麓麓麓\

(\__ | |*____) | |**| |_| |_| |____*_| |_| |____ ***掳**掳掳 *)

/**麓**| ||_____/|_|_*|_|_____|______|_____|______|_____* 掳*/

(*麓麓掳*| '_ \*/ _ \| |*| | _ \*/ __/ _ \***/ _ \| ____| _/

|** *| |_) | (_) | |_| | |*| | (_| __/*掳*|/*) /| |__** *掳)

(**麓*|_.__/*\___/*\__,_|_|*|_|\___\___|*掳掳**/ /*|___ \* * |

\** *麓麓*麓*掳***掳*掳掳掳**掳掳******掳掳掳掳掳****掳***/ /_**___) | **)

( ***Wanna play again? Just Hit SHIFT***/_____|____/* */

\____________________________________________________/

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!

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航