- Timestamp:
- 10/29/09 00:52:53 (4 years ago)
- Location:
- lang/haxe/Tonyu2
- Files:
-
- 3 added
- 4 modified
-
make.bat (modified) (1 diff)
-
test/haxe/Boot.hx (modified) (3 diffs)
-
test/haxe/Test.hx (modified) (1 diff)
-
test/haxe/make.bat (added)
-
test/haxe/test.swf (modified) (previous)
-
test/haxe/tonyu (added)
-
test/haxe/tonyu/TSprite.hx (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/haxe/Tonyu2/make.bat
r35690 r35763 1 C:\bin\_other\haxe-2.04-win\haxe make.hxml1 ..\haxe make.hxml -
lang/haxe/Tonyu2/test/haxe/Boot.hx
r35663 r35763 1 1 2 2 class Boot { 3 public static var chars:Array< Test>;3 public static var chars:Array<tonyu.TSprite>; 4 4 static function main() { 5 //var tf= new Test();6 5 chars = []; 7 // var sh= new Shape();8 // flash.Lib.current.addChild(tf);9 // sh.addChild(tf);10 6 var i:Int; 11 7 for (i in 0 ... 99) { … … 13 9 tf.x=Std.random(200); 14 10 tf.y=Std.random(200); 15 tf.text="大";16 flash.Lib.current.addChild(tf);11 12 //flash.Lib.current.addChild(tf); 17 13 chars.push(tf); 18 14 } … … 22 18 for (tf in chars) { 23 19 tf.move(); 20 tf.draw(); 24 21 } 25 22 }); -
lang/haxe/Tonyu2/test/haxe/Test.hx
r35663 r35763 1 class Test extends flash.text.TextField { 2 var state:Int; 3 var vx:Int; 4 var vy:Int; 5 //public var id:Int; 6 //static var idSeq:Int=0; 7 public function new() { 8 super(); 9 state=0; 10 vx=1; 11 vy=1; 12 //id=idSeq++; 13 } 14 function crashTo(t:Test):Bool{ 15 return Math.abs(t.x-x)+Math.abs(t.y-y)<10; 16 } 17 public function move() { 1 class Test extends tonyu.TSprite { 2 public var vx:Float; 3 public var vy:Float; 4 5 public override function move() { 18 6 while (true) { 19 switch (state) { 20 case 0: 21 text="x"; 22 state=1; 23 break; 24 case 1: // while(x<100) { 25 x+=vx; y+=vy; 26 if (x>200) vx=-vx; 27 if (x<0) vx=-vx; 28 if (y>200) vy=-vy; 29 if (y<0) vy=-vy; 30 var t:Test; 31 for (t in Boot.chars) { 32 if (this!=t && crashTo(t)) { 33 vx=-Std.random(3)+1; 34 vy=-Std.random(3)+1; 7 switch (state) { 8 case 0: 9 vx=rnd()*3; 10 vy=rnd()*3; 11 state=1; 12 break; 13 case 1: // while(1) { 14 var sx=x,sy=y; 15 x+=vx; y+=vy; 16 17 if (x>200) {x=200;vx=-abs(vx);} 18 if (x<0) {x=0;vx=abs(vx);} 19 if (y>200) {y=200;vy=-abs(vy);} 20 if (y<0) {y=0;vy=abs(vy);} 21 var t:Test; 22 for (t in Boot.chars) { 23 if (this!=t && crashTo(t)) { 24 x=sx; 25 y=sy; 26 vx=-vx*0.9; 27 vy=-vy*0.9; 28 } 35 29 } 36 }37 state=2;38 return; // update39 case 2:40 state=1;41 break; // }42 case 3:43 }30 vy+=0.04; 31 state=2; 32 return; // update(); 33 case 2: 34 state=1; 35 break; // } 36 case 3: 37 } 44 38 } 45 39 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)