Changeset 873
- Timestamp:
- 01/25/2011 12:47:17 PM (10 years ago)
- Location:
- scenarios/GerminationX
- Files:
-
- 45 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
scenarios/GerminationX/fungi/compile-fungi.hxml
r843 r873 4 4 -main Fungi 5 5 -cp src 6 -swf-header 640:480:40:ffffff6 -swf-header 950:576:40:ffffff -
scenarios/GerminationX/fungi/html/index.html
r843 r873 5 5 <title>germination x</title> 6 6 </head> 7 <body >7 <body bgcolor="#000000"> 8 8 <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 9 9 width="50" … … 16 16 <param name="salign" value="lt" /> 17 17 <param name="bgcolor" value="#000000"/> 18 18 19 <embed src="fungi.swf" 19 20 bgcolor="#ffffff" 20 width=" 640"21 height=" 480"21 width="950" 22 height="576" 22 23 name="haxe" 23 24 quality="high" 24 25 align="middle" 25 allowScriptAccess="always" 26 allowScriptAccess="always" 26 27 type="application/x-shockwave-flash" 27 28 pluginspage="http://www.macromedia.com/go/getflashplayer" -
scenarios/GerminationX/fungi/resources.xml
r871 r873 5 5 <library> 6 6 <bitmap id="BlueCubeTex" import="textures/blue-cube.png"/> 7 <bitmap id="GrassCube01Tex" import="textures/grass-cube-01.png"/>8 <bitmap id="GrassCube02Tex" import="textures/grass-cube-02.png"/>9 <bitmap id="GrassCube03Tex" import="textures/grass-cube-03.png"/>10 <bitmap id="SeaCube01Tex" import="textures/sea-cube-01.png"/>11 <bitmap id="SeaCube02Tex" import="textures/sea-cube-02.png"/>12 <bitmap id="SeaCube03Tex" import="textures/sea-cube-03.png"/>13 <bitmap id="RBotNorthTex" import="textures/bbot-north.png"/>14 <bitmap id="RBotSouthTex" import="textures/bbot-south.png"/>15 <bitmap id="RBotEastTex" import="textures/bbot-east.png"/>16 <bitmap id="RBotWestTex" import="textures/bbot-west.png"/>17 <bitmap id="CanopyTex" import="textures/canopy.png"/>18 <bitmap id="LollyPopTex" import="textures/lollypop.png"/>19 <bitmap id="FlowersTex" import="textures/flowers.png"/>20 <bitmap id="ClimberTex" import="textures/climber.png"/>21 22 <bitmap id="Player" import="textures/player.png"/>23 24 <bitmap id="GhostVertical" import="textures/ghost-vertical.png"/>25 <bitmap id="GhostVerticalHappy" import="textures/ghost-vertical-happy.png"/>26 <bitmap id="GhostVerticalSad" import="textures/ghost-vertical-sad.png"/>27 28 <bitmap id="GhostCover" import="textures/ghost-cover.png"/>29 <bitmap id="GhostCoverHappy" import="textures/ghost-cover-happy.png"/>30 <bitmap id="GhostCoverSad" import="textures/ghost-cover-sad.png"/>31 32 <bitmap id="GhostCanopy" import="textures/ghost-canopy.png"/>33 <bitmap id="GhostCanopyHappy" import="textures/ghost-canopy-happy.png"/>34 <bitmap id="GhostCanopySad" import="textures/ghost-canopy-sad.png"/>35 36 7 <bitmap id="Test" import="textures/test.png"/> 37 <bitmap id="CursorTex" import="textures/cursor.png"/>38 39 <bitmap id="Plant001Tex" import="textures/plant-001.png"/>40 <bitmap id="Plant002Tex" import="textures/plant-002.png"/>41 <bitmap id="Plant003Tex" import="textures/plant-003.png"/>42 <bitmap id="Plant004Tex" import="textures/plant-004.png"/>43 <bitmap id="Plant005Tex" import="textures/plant-005.png"/>44 <bitmap id="Plant006Tex" import="textures/plant-006.png"/>45 <bitmap id="Plant007Tex" import="textures/plant-007.png"/>46 <bitmap id="Plant008Tex" import="textures/plant-008.png"/>47 8 48 9 <bitmap id="SeedTex" import="textures/seed.png"/> … … 53 14 <bitmap id="Arr4Tex" import="textures/arr4.png"/> 54 15 55 <bitmap id="Plant000GrowATex" import="textures/grow-a.png"/> 56 <bitmap id="Plant000GrowBTex" import="textures/grow-b.png"/> 57 <bitmap id="Plant000GrowCTex" import="textures/grow-c.png"/> 58 <bitmap id="Plant000GrownTex" import="textures/grown.png"/> 59 <bitmap id="Plant000DecayATex" import="textures/decay-a.png"/> 60 <bitmap id="Plant000DecayBTex" import="textures/decay-b.png"/> 61 <bitmap id="Plant000DecayCTex" import="textures/decay-c.png"/> 62 <bitmap id="Plant000IllATex" import="textures/ill-a.png"/> 63 <bitmap id="Plant000IllBTex" import="textures/ill-b.png"/> 64 <bitmap id="Plant000IllCTex" import="textures/ill-c.png"/> 65 <bitmap id="Plant000FruitATex" import="textures/fruit-a.png"/> 66 <bitmap id="Plant000FruitBTex" import="textures/fruit-b.png"/> 67 <bitmap id="Plant000FruitCTex" import="textures/fruit-c.png"/> 16 <bitmap id="RockCube01Tex" import="textures/rock-cube-01.png"/> 17 <bitmap id="RockCube02Tex" import="textures/rock-cube-02.png"/> 18 <bitmap id="RockCube03Tex" import="textures/rock-cube-03.png"/> 19 <bitmap id="RockCube04Tex" import="textures/rock-cube-04.png"/> 20 <bitmap id="RockCube05Tex" import="textures/rock-cube-05.png"/> 21 <bitmap id="RockCube06Tex" import="textures/rock-cube-06.png"/> 22 23 <bitmap id="Plant001GrowATex" import="textures/plant-001-grow-a.png"/> 24 <bitmap id="Plant001GrowBTex" import="textures/plant-001-grow-b.png"/> 25 <bitmap id="Plant001GrowCTex" import="textures/plant-001-grow-c.png"/> 26 <bitmap id="Plant001GrownTex" import="textures/plant-001-grown.png"/> 27 <bitmap id="Plant001DecayATex" import="textures/plant-001-decay-a.png"/> 28 <bitmap id="Plant001DecayBTex" import="textures/plant-001-decay-b.png"/> 29 <bitmap id="Plant001DecayCTex" import="textures/plant-001-decay-c.png"/> 30 <bitmap id="Plant001IllATex" import="textures/plant-001-ill-a.png"/> 31 <bitmap id="Plant001IllBTex" import="textures/plant-001-ill-b.png"/> 32 <bitmap id="Plant001IllCTex" import="textures/plant-001-ill-c.png"/> 33 <bitmap id="Plant001FruitATex" import="textures/plant-001-fruit-a.png"/> 34 <bitmap id="Plant001FruitBTex" import="textures/plant-001-fruit-b.png"/> 35 <bitmap id="Plant001FruitCTex" import="textures/plant-001-fruit-c.png"/> 36 37 <bitmap id="Plant002GrowATex" import="textures/plant-002-grow-a.png"/> 38 <bitmap id="Plant002GrowBTex" import="textures/plant-002-grow-b.png"/> 39 <bitmap id="Plant002GrowCTex" import="textures/plant-002-grow-c.png"/> 40 <bitmap id="Plant002GrownTex" import="textures/plant-002-grown.png"/> 41 <bitmap id="Plant002DecayATex" import="textures/plant-002-decay-a.png"/> 42 <bitmap id="Plant002DecayBTex" import="textures/plant-002-decay-b.png"/> 43 <bitmap id="Plant002DecayCTex" import="textures/plant-002-decay-c.png"/> 44 <bitmap id="Plant002IllATex" import="textures/plant-002-ill-a.png"/> 45 <bitmap id="Plant002IllBTex" import="textures/plant-002-ill-b.png"/> 46 <bitmap id="Plant002IllCTex" import="textures/plant-002-ill-c.png"/> 47 <bitmap id="Plant002FruitATex" import="textures/plant-002-fruit-a.png"/> 48 <bitmap id="Plant002FruitBTex" import="textures/plant-002-fruit-b.png"/> 49 <bitmap id="Plant002FruitCTex" import="textures/plant-002-fruit-c.png"/> 50 51 <bitmap id="Plant003GrowATex" import="textures/plant-003-grow-a.png"/> 52 <bitmap id="Plant003GrowBTex" import="textures/plant-003-grow-b.png"/> 53 <bitmap id="Plant003GrowCTex" import="textures/plant-003-grow-c.png"/> 54 <bitmap id="Plant003GrownTex" import="textures/plant-003-grown.png"/> 55 <bitmap id="Plant003DecayATex" import="textures/plant-003-decay-a.png"/> 56 <bitmap id="Plant003DecayBTex" import="textures/plant-003-decay-b.png"/> 57 <bitmap id="Plant003DecayCTex" import="textures/plant-003-decay-c.png"/> 58 <bitmap id="Plant003IllATex" import="textures/plant-003-ill-a.png"/> 59 <bitmap id="Plant003IllBTex" import="textures/plant-003-ill-b.png"/> 60 <bitmap id="Plant003IllCTex" import="textures/plant-003-ill-c.png"/> 61 <bitmap id="Plant003FruitATex" import="textures/plant-003-fruit-a.png"/> 62 <bitmap id="Plant003FruitBTex" import="textures/plant-003-fruit-b.png"/> 63 <bitmap id="Plant003FruitCTex" import="textures/plant-003-fruit-c.png"/> 68 64 69 65 -
scenarios/GerminationX/fungi/src/Fungi.hx
r871 r873 38 38 public function UpdateTex(rnd:RndGen) 39 39 { 40 if (LogicalPos.z <0)40 if (LogicalPos.z%2==0) 41 41 { 42 42 Spr.ChangeBitmap(Resources.Get( 43 rnd.Choose([" sea-cube-01","sea-cube-02","sea-cube-03"])));43 rnd.Choose(["rock-cube-01","rock-cube-02","rock-cube-03"]))); 44 44 } 45 45 else 46 46 { 47 47 Spr.ChangeBitmap(Resources.Get( 48 rnd.Choose([" grass-cube-01","grass-cube-02","grass-cube-03"])));49 48 rnd.Choose(["rock-cube-04","rock-cube-05","rock-cube-06"]))); 49 } 50 50 } 51 51 } … … 70 70 Owner=owner; 71 71 PlantScale=0; 72 NeedsUpdate=true;72 //NeedsUpdate=true; 73 73 Seeds=[]; 74 74 … … 82 82 tf.background = true; 83 83 //tf.autoSize = true; 84 tf.backgroundColor = 0x8dd788;84 //tf.backgroundColor = 0x8dd788; 85 85 tf.border = true; 86 86 tf.wordWrap = true; … … 91 91 } 92 92 93 function StateUpdate(state)93 public function StateUpdate(state,world:World) 94 94 { 95 95 State=state; 96 Spr.ChangeBitmap(Resources.Get(PlantType+"-"+State)); 96 if (State!="decayed") 97 { 98 Spr.ChangeBitmap(Resources.Get(PlantType+"-"+State)); 99 } 100 if (State=="fruit-c" && Seeds.length==0) 101 { 102 Fruit(world); 103 } 97 104 } 98 105 … … 170 177 } 171 178 } 172 173 } 174 175 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 176 /* 177 class PlayerEntity extends Entity 178 { 179 public function new(pos:Vec3) 180 { 181 super(pos, Resources.Get("player")); 182 } 183 184 public function Handle(e:Int, world:World) 185 { 186 var pos=new Vec3(LogicalPos.x,LogicalPos.y,LogicalPos.z); 187 188 if (e==Keyboard.toInt(Key.left)) { pos.x-=1; } 189 if (e==Keyboard.toInt(Key.right)) { pos.x+=1; } 190 if (e==Keyboard.toInt(Key.up)) { pos.y-=1; } 191 if (e==Keyboard.toInt(Key.down)) { pos.y+=1; } 192 //if (e==Keyboard.toInt(Key.space)) { world.AddServerPlant(new Vec3(pos.x,pos.y,1)); } 193 194 if (e==87) 195 { 196 world.WorldClient.Call("add-object/WiltedVine",function(d){}); 197 world.AddServerPlant(new Vec3(pos.x,pos.y,1),2); 198 } 199 200 if (e==84) 201 { 202 world.WorldClient.Call("add-object/AppleTree",function(d){}); 203 world.AddServerPlant(new Vec3(pos.x,pos.y,1),3); 204 } 205 206 if (e==80) 207 { 208 world.WorldClient.Call("perceive",function(d){}); 209 } 210 211 var oldworldpos=new Vec3(world.WorldPos.x,world.WorldPos.y,world.WorldPos.z); 212 213 if (pos.x<0) 214 { 215 pos.x=world.Width-1; 216 world.UpdateWorld(world.WorldPos.Add(new Vec3(-1,0,0))); 217 } 218 219 if (pos.x>=world.Width) 220 { 221 pos.x=0; 222 world.UpdateWorld(world.WorldPos.Add(new Vec3(1,0,0))); 223 } 224 225 if (pos.y<0) 226 { 227 pos.y=world.Height-1; 228 world.UpdateWorld(world.WorldPos.Add(new Vec3(0,-1,0))); 229 } 230 231 if (pos.y>=world.Height) 232 { 233 pos.y=0; 234 world.UpdateWorld(world.WorldPos.Add(new Vec3(0,1,0))); 235 } 236 237 if (world.GetCube(pos).LogicalPos.z>-1) 238 { 239 LogicalPos=pos; 240 LogicalPos.z=world.GetCube(LogicalPos).LogicalPos.z+1; 241 } 242 else 243 { 244 world.UpdateWorld(oldworldpos); 245 } 246 } 247 } 248 */ 179 } 249 180 250 181 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 317 248 var TickTime:Int; 318 249 var Ghosts:Array<Ghost>; 319 var Cursor:Sprite;320 var CursorLogicalPos:Vec3;321 250 public var Seeds:SeedStore; 322 251 var Server : ServerConnection; … … 335 264 WorldPos = new Vec3(0,0,0); 336 265 MyRndGen = new RndGen(); 337 CursorLogicalPos = new Vec3(5,5,0);338 266 Server = new ServerConnection(); 339 267 MyName = ""; 340 268 341 var arrow1 = new SpriteEntity(this,new Vec3( 5,-2,1), Resources.Get("arr3"));269 var arrow1 = new SpriteEntity(this,new Vec3(7,-2,1), Resources.Get("arr3")); 342 270 arrow1.Spr.MouseUp(this,function(c) { c.UpdateWorld(c.WorldPos.Add(new Vec3(0,-1,0))); }); 343 271 arrow1.Spr.MouseOver(this,function(c) { arrow1.Spr.SetScale(new Vec2(1.1,1.1)); arrow1.Spr.Update(0,null); }); 344 272 arrow1.Spr.MouseOut(this,function(c) { arrow1.Spr.SetScale(new Vec2(1,1)); arrow1.Spr.Update(0,null); }); 345 273 346 var arrow2=new SpriteEntity(this,new Vec3( 7,15,1), Resources.Get("arr4"));274 var arrow2=new SpriteEntity(this,new Vec3(10,21,1), Resources.Get("arr4")); 347 275 arrow2.Spr.MouseUp(this,function(c) { c.UpdateWorld(c.WorldPos.Add(new Vec3(0,1,0))); }); 348 276 arrow2.Spr.MouseOver(this,function(c) { arrow2.Spr.SetScale(new Vec2(1.1,1.1)); arrow2.Spr.Update(0,null); }); 349 277 arrow2.Spr.MouseOut(this,function(c) { arrow2.Spr.SetScale(new Vec2(1,1)); arrow2.Spr.Update(0,null); }); 350 278 351 var arrow3=new SpriteEntity(this,new Vec3(-2, 5,1), Resources.Get("arr2"));279 var arrow3=new SpriteEntity(this,new Vec3(-2,7,1), Resources.Get("arr2")); 352 280 arrow3.Spr.MouseUp(this,function(c) { c.UpdateWorld(c.WorldPos.Add(new Vec3(-1,0,0))); }); 353 281 arrow3.Spr.MouseOver(this,function(c) { arrow3.Spr.SetScale(new Vec2(1.1,1.1)); arrow3.Spr.Update(0,null); }); 354 282 arrow3.Spr.MouseOut(this,function(c) { arrow3.Spr.SetScale(new Vec2(1,1)); arrow3.Spr.Update(0,null); }); 355 283 356 var arrow4=new SpriteEntity(this,new Vec3( 14,7,1), Resources.Get("arr1"));284 var arrow4=new SpriteEntity(this,new Vec3(20,10,1), Resources.Get("arr1")); 357 285 arrow4.Spr.MouseUp(this,function(c) { c.UpdateWorld(c.WorldPos.Add(new Vec3(1,0,0))); }); 358 286 arrow4.Spr.MouseOver(this,function(c) { arrow4.Spr.SetScale(new Vec2(1.1,1.1)); arrow4.Spr.Update(0,null); }); … … 365 293 var ob:Cube = new Cube(this,new Vec3(0,0,0)); 366 294 367 ob.Spr.MouseOver(this,function(c)368 {369 c.Cursor.Pos=ob.Spr.Pos;370 c.CursorLogicalPos = ob.LogicalPos;371 });372 373 295 ob.Spr.MouseDown(this,function(c) 374 296 { … … 376 298 if (type!="") 377 299 { 378 c.AddServerPlant( c.CursorLogicalPos.Add(new Vec3(0,0,1)),type);300 c.AddServerPlant(ob.LogicalPos.Add(new Vec3(0,0,1)),type); 379 301 } 380 302 }); … … 393 315 } 394 316 */ 395 MyTextEntry=new TextEntry( 190,10,310,30,NameCallback);317 MyTextEntry=new TextEntry(300,10,310,30,NameCallback); 396 318 addChild(MyTextEntry); 397 319 … … 399 321 SortScene(); 400 322 Server.Request("spirit-sprites",this,UpdateSpiritSprites); 401 402 Cursor=new Sprite(new Vec2(0,0), Resources.Get("cursor"), true);403 AddSprite(Cursor);404 323 } 405 324 … … 423 342 for (i in 0...5) 424 343 { 425 var pos = new Vec3(MyRndGen.RndFlt()*1 0+x*10,426 MyRndGen.RndFlt()*1 0+y*10,344 var pos = new Vec3(MyRndGen.RndFlt()*15+x*15, 345 MyRndGen.RndFlt()*15+y*15, 427 346 0); 428 347 circles.push(new Circle(pos, MyRndGen.RndFlt()*4)); … … 448 367 449 368 ClearPlants(); 450 Server.Request("get-tile/"+Std.string(cast(WorldPos.x,Int))+"/"451 +Std.string(cast(WorldPos.y,Int)),452 this,453 function (c:truffle.World,d)454 {455 var data:Array<Dynamic>=cast(d.entities,Array<Dynamic>);456 for (p in data)457 {458 var pos = new Vec3(p.pos.x,p.pos.y,1);459 460 if (pos.x<10 && pos.y<10 && pos.x>0 && pos.y>0 &&461 c.SpaceClear(pos) && c.GetCube(pos).LogicalPos.z>-1)462 {463 var plant = new Plant(c,p.owner,pos,p.type,p.state);464 c.Plants.push(plant);465 }466 }467 c.SortScene();468 });469 369 } 470 370 471 371 public function AddServerPlant(pos:Vec3,type) 472 372 { 473 if (MyName!=null && SpaceClear(pos) && GetCube(pos).LogicalPos.z>-1)373 if (MyName!=null && SpaceClear(pos)) 474 374 { 475 375 var size=MyRndGen.RndFlt()+0.5; 476 var plant = new Plant(this,MyName,pos,"plant-000","grow-a");477 Plants.push(plant);478 376 Server.Request("make-plant/"+Std.string(cast(WorldPos.x,Int))+"/"+ 479 377 Std.string(cast(WorldPos.y,Int))+"/"+ … … 484 382 Math.round(size*100), 485 383 this, function (c,data) {}); 486 SortScene();487 384 } 488 385 } … … 554 451 function (c:truffle.World,d) 555 452 { 556 c.ClearPlants();557 453 var data:Array<Dynamic>=cast(d.entities,Array<Dynamic>); 558 454 for (p in data) 455 { 456 var e = c.Get(new Vec2(p.pos.x,p.pos.y)); 457 if (!Std.is(e,Plant)) 559 458 { 560 var pos = new Vec3(p.pos.x,p.pos.y,1); 561 562 if (pos.x<10 && pos.y<10 && pos.x>0 && pos.y>0 && 563 c.SpaceClear(pos) && c.GetCube(pos).LogicalPos.z>-1) 564 { 565 var plant = new Plant(c,p.owner,pos,p.type,p.state); 566 c.Plants.push(plant); 567 } 459 var pos = new Vec3(p.pos.x,p.pos.y,e.LogicalPos.z+1); 460 var plant = new Plant(c,p.owner,pos,p.type,p.state); 461 c.Plants.push(plant); 568 462 } 463 else 464 { 465 //trace("updating plant"); 466 cast(e,Plant).StateUpdate(p.state,c); 467 } 468 } 569 469 c.SortScene(); 570 }); 571 572 470 }); 573 471 574 472 TickTime=time+100; 575 473 } 576 /*577 for (plant in Plants)578 {579 if (plant.Age>2000)580 {581 Plants.remove(plant);582 Remove(plant);583 }584 }*/585 586 //Cursor.Update(time,null);587 474 } 588 475 … … 596 483 { 597 484 // Log.setColor(0xFFFFFF); 598 super(new FungiWorld(1 0,10));485 super(new FungiWorld(15,15)); 599 486 } 600 487 -
scenarios/GerminationX/fungi/src/Resources.hx
r871 r873 21 21 22 22 class BlueCubeTex extends BitmapData { public function new() { super(0,0); } } 23 class GrassCube01Tex extends BitmapData { public function new() { super(0,0); } }24 class GrassCube02Tex extends BitmapData { public function new() { super(0,0); } }25 class GrassCube03Tex extends BitmapData { public function new() { super(0,0); } }26 class SeaCube01Tex extends BitmapData { public function new() { super(0,0); } }27 class SeaCube02Tex extends BitmapData { public function new() { super(0,0); } }28 class SeaCube03Tex extends BitmapData { public function new() { super(0,0); } }29 class RBotNorthTex extends BitmapData { public function new() { super(0,0); } }30 class RBotSouthTex extends BitmapData { public function new() { super(0,0); } }31 class RBotEastTex extends BitmapData { public function new() { super(0,0); } }32 class RBotWestTex extends BitmapData { public function new() { super(0,0); } }33 class FlowersTex extends BitmapData { public function new() { super(0,0); } }34 class LollyPopTex extends BitmapData { public function new() { super(0,0); } }35 class ClimberTex extends BitmapData { public function new() { super(0,0); } }36 class CanopyTex extends BitmapData { public function new() { super(0,0); } }37 38 class Player extends BitmapData { public function new() { super(0,0); } }39 40 41 class GhostCanopy extends BitmapData { public function new() { super(0,0); } }42 class GhostCanopyHappy extends BitmapData { public function new() { super(0,0); } }43 class GhostCanopySad extends BitmapData { public function new() { super(0,0); } }44 45 class GhostCover extends BitmapData { public function new() { super(0,0); } }46 class GhostCoverHappy extends BitmapData { public function new() { super(0,0); } }47 class GhostCoverSad extends BitmapData { public function new() { super(0,0); } }48 49 class GhostVertical extends BitmapData { public function new() { super(0,0); } }50 class GhostVerticalHappy extends BitmapData { public function new() { super(0,0); } }51 class GhostVerticalSad extends BitmapData { public function new() { super(0,0); } }52 53 23 class Test extends BitmapData { public function new() { super(0,0); } } 54 class CursorTex extends BitmapData { public function new() { super(0,0); } }55 56 class Plant001Tex extends BitmapData { public function new() { super(0,0); } }57 class Plant002Tex extends BitmapData { public function new() { super(0,0); } }58 class Plant003Tex extends BitmapData { public function new() { super(0,0); } }59 class Plant004Tex extends BitmapData { public function new() { super(0,0); } }60 class Plant005Tex extends BitmapData { public function new() { super(0,0); } }61 class Plant006Tex extends BitmapData { public function new() { super(0,0); } }62 class Plant007Tex extends BitmapData { public function new() { super(0,0); } }63 class Plant008Tex extends BitmapData { public function new() { super(0,0); } }64 24 65 25 class SeedTex extends BitmapData { public function new() { super(0,0); } } … … 84 44 class Plant000FruitCTex extends BitmapData { public function new() { super(0,0); } } 85 45 46 class RockCube01Tex extends BitmapData { public function new() { super(0,0); } } 47 class RockCube02Tex extends BitmapData { public function new() { super(0,0); } } 48 class RockCube03Tex extends BitmapData { public function new() { super(0,0); } } 49 class RockCube04Tex extends BitmapData { public function new() { super(0,0); } } 50 class RockCube05Tex extends BitmapData { public function new() { super(0,0); } } 51 class RockCube06Tex extends BitmapData { public function new() { super(0,0); } } 52 53 class Plant001GrowATex extends BitmapData { public function new() { super(0,0); } } 54 class Plant001GrowBTex extends BitmapData { public function new() { super(0,0); } } 55 class Plant001GrowCTex extends BitmapData { public function new() { super(0,0); } } 56 class Plant001GrownTex extends BitmapData { public function new() { super(0,0); } } 57 class Plant001DecayATex extends BitmapData { public function new() { super(0,0); } } 58 class Plant001DecayBTex extends BitmapData { public function new() { super(0,0); } } 59 class Plant001DecayCTex extends BitmapData { public function new() { super(0,0); } } 60 class Plant001IllATex extends BitmapData { public function new() { super(0,0); } } 61 class Plant001IllBTex extends BitmapData { public function new() { super(0,0); } } 62 class Plant001IllCTex extends BitmapData { public function new() { super(0,0); } } 63 class Plant001FruitATex extends BitmapData { public function new() { super(0,0); } } 64 class Plant001FruitBTex extends BitmapData { public function new() { super(0,0); } } 65 class Plant001FruitCTex extends BitmapData { public function new() { super(0,0); } } 66 67 class Plant002GrowATex extends BitmapData { public function new() { super(0,0); } } 68 class Plant002GrowBTex extends BitmapData { public function new() { super(0,0); } } 69 class Plant002GrowCTex extends BitmapData { public function new() { super(0,0); } } 70 class Plant002GrownTex extends BitmapData { public function new() { super(0,0); } } 71 class Plant002DecayATex extends BitmapData { public function new() { super(0,0); } } 72 class Plant002DecayBTex extends BitmapData { public function new() { super(0,0); } } 73 class Plant002DecayCTex extends BitmapData { public function new() { super(0,0); } } 74 class Plant002IllATex extends BitmapData { public function new() { super(0,0); } } 75 class Plant002IllBTex extends BitmapData { public function new() { super(0,0); } } 76 class Plant002IllCTex extends BitmapData { public function new() { super(0,0); } } 77 class Plant002FruitATex extends BitmapData { public function new() { super(0,0); } } 78 class Plant002FruitBTex extends BitmapData { public function new() { super(0,0); } } 79 class Plant002FruitCTex extends BitmapData { public function new() { super(0,0); } } 80 81 class Plant003GrowATex extends BitmapData { public function new() { super(0,0); } } 82 class Plant003GrowBTex extends BitmapData { public function new() { super(0,0); } } 83 class Plant003GrowCTex extends BitmapData { public function new() { super(0,0); } } 84 class Plant003GrownTex extends BitmapData { public function new() { super(0,0); } } 85 class Plant003DecayATex extends BitmapData { public function new() { super(0,0); } } 86 class Plant003DecayBTex extends BitmapData { public function new() { super(0,0); } } 87 class Plant003DecayCTex extends BitmapData { public function new() { super(0,0); } } 88 class Plant003IllATex extends BitmapData { public function new() { super(0,0); } } 89 class Plant003IllBTex extends BitmapData { public function new() { super(0,0); } } 90 class Plant003IllCTex extends BitmapData { public function new() { super(0,0); } } 91 class Plant003FruitATex extends BitmapData { public function new() { super(0,0); } } 92 class Plant003FruitBTex extends BitmapData { public function new() { super(0,0); } } 93 class Plant003FruitCTex extends BitmapData { public function new() { super(0,0); } } 94 95 86 96 class Resources 87 97 { … … 94 104 { 95 105 case "blue-cube": tex.data = new BlueCubeTex(); 96 case "grass-cube-01": tex.data = new GrassCube01Tex();97 case "grass-cube-02": tex.data = new GrassCube02Tex();98 case "grass-cube-03": tex.data = new GrassCube03Tex();99 case "sea-cube-01": tex.data = new SeaCube01Tex();100 case "sea-cube-02": tex.data = new SeaCube02Tex();101 case "sea-cube-03": tex.data = new SeaCube03Tex();102 case "rbot-north": tex.data = new RBotNorthTex();103 case "rbot-south": tex.data = new RBotSouthTex();104 case "rbot-east": tex.data = new RBotEastTex();105 case "rbot-west": tex.data = new RBotWestTex();106 case "flowers": tex.data = new FlowersTex();107 case "lollypop": tex.data = new LollyPopTex();108 case "climber": tex.data = new ClimberTex();109 case "canopy": tex.data = new CanopyTex();110 case "player": tex.data = new Player();111 112 case "ghost-canopy": tex.data = new GhostCanopy();113 case "ghost-canopy-happy": tex.data = new GhostCanopyHappy();114 case "ghost-canopy-sad": tex.data = new GhostCanopySad();115 116 case "ghost-cover": tex.data = new GhostCover();117 case "ghost-cover-happy": tex.data = new GhostCoverHappy();118 case "ghost-cover-sad": tex.data = new GhostCoverSad();119 120 case "ghost-vertical": tex.data = new GhostVertical();121 case "ghost-vertical-happy": tex.data = new GhostVerticalHappy();122 case "ghost-vertical-sad": tex.data = new GhostVerticalSad();123 106 case "test": tex.data = new Test(); 124 case "cursor": tex.data = new CursorTex();125 case "plant-001": tex.data = new Plant001Tex();126 case "plant-002": tex.data = new Plant002Tex();127 case "plant-003": tex.data = new Plant003Tex();128 case "plant-004": tex.data = new Plant004Tex();129 case "plant-005": tex.data = new Plant005Tex();130 case "plant-006": tex.data = new Plant006Tex();131 case "plant-007": tex.data = new Plant007Tex();132 case "plant-008": tex.data = new Plant008Tex();133 134 107 case "seed": tex.data = new SeedTex(); 135 108 … … 153 126 case "plant-000-fruit-c": tex.data = new Plant000FruitCTex(); 154 127 128 case "rock-cube-01": tex.data = new RockCube01Tex(); 129 case "rock-cube-02": tex.data = new RockCube02Tex(); 130 case "rock-cube-03": tex.data = new RockCube03Tex(); 131 case "rock-cube-04": tex.data = new RockCube04Tex(); 132 case "rock-cube-05": tex.data = new RockCube05Tex(); 133 case "rock-cube-06": tex.data = new RockCube06Tex(); 134 135 case "plant-001-grow-a": tex.data = new Plant001GrowATex(); 136 case "plant-001-grow-b": tex.data = new Plant001GrowBTex(); 137 case "plant-001-grow-c": tex.data = new Plant001GrowCTex(); 138 case "plant-001-grown": tex.data = new Plant001GrownTex(); 139 case "plant-001-ill-a": tex.data = new Plant001IllATex(); 140 case "plant-001-ill-b": tex.data = new Plant001IllBTex(); 141 case "plant-001-ill-c": tex.data = new Plant001IllCTex(); 142 case "plant-001-decay-a": tex.data = new Plant001DecayATex(); 143 case "plant-001-decay-b": tex.data = new Plant001DecayBTex(); 144 case "plant-001-decay-c": tex.data = new Plant001DecayCTex(); 145 case "plant-001-fruit-a": tex.data = new Plant001FruitATex(); 146 case "plant-001-fruit-b": tex.data = new Plant001FruitBTex(); 147 case "plant-001-fruit-c": tex.data = new Plant001FruitCTex(); 148 149 case "plant-002-grow-a": tex.data = new Plant002GrowATex(); 150 case "plant-002-grow-b": tex.data = new Plant002GrowBTex(); 151 case "plant-002-grow-c": tex.data = new Plant002GrowCTex(); 152 case "plant-002-grown": tex.data = new Plant002GrownTex(); 153 case "plant-002-ill-a": tex.data = new Plant002IllATex(); 154 case "plant-002-ill-b": tex.data = new Plant002IllBTex(); 155 case "plant-002-ill-c": tex.data = new Plant002IllCTex(); 156 case "plant-002-decay-a": tex.data = new Plant002DecayATex(); 157 case "plant-002-decay-b": tex.data = new Plant002DecayBTex(); 158 case "plant-002-decay-c": tex.data = new Plant002DecayCTex(); 159 case "plant-002-fruit-a": tex.data = new Plant002FruitATex(); 160 case "plant-002-fruit-b": tex.data = new Plant002FruitBTex(); 161 case "plant-002-fruit-c": tex.data = new Plant002FruitCTex(); 162 163 case "plant-003-grow-a": tex.data = new Plant003GrowATex(); 164 case "plant-003-grow-b": tex.data = new Plant003GrowBTex(); 165 case "plant-003-grow-c": tex.data = new Plant003GrowCTex(); 166 case "plant-003-grown": tex.data = new Plant003GrownTex(); 167 case "plant-003-ill-a": tex.data = new Plant003IllATex(); 168 case "plant-003-ill-b": tex.data = new Plant003IllBTex(); 169 case "plant-003-ill-c": tex.data = new Plant003IllCTex(); 170 case "plant-003-decay-a": tex.data = new Plant003DecayATex(); 171 case "plant-003-decay-b": tex.data = new Plant003DecayBTex(); 172 case "plant-003-decay-c": tex.data = new Plant003DecayCTex(); 173 case "plant-003-fruit-a": tex.data = new Plant003FruitATex(); 174 case "plant-003-fruit-b": tex.data = new Plant003FruitBTex(); 175 case "plant-003-fruit-c": tex.data = new Plant003FruitCTex(); 176 177 155 178 } 156 179 -
scenarios/GerminationX/fungi/src/truffle/Entity.hx
r846 r873 42 42 // do the nasty iso conversion 43 43 // this is actually an orthogonal projection matrix! (I think) 44 return new Vec3( 280+(pos.x*36-pos.y*26),44 return new Vec3(400+(pos.x*36-pos.y*26), 45 45 120+(pos.y*18+pos.x*9)-(pos.z*37), 46 46 pos.x*0.51 + pos.y*0.71 + pos.z*0.47); -
scenarios/GerminationX/fungi/src/truffle/flash/FlashTextEntry.hx
r864 r873 44 44 TextField.width = w; 45 45 TextField.height = h; 46 TextField.backgroundColor = 0x8dd788;46 //TextField.backgroundColor = 0x8dd788; 47 47 48 48 var tf = new flash.text.TextFormat(); -
scenarios/GerminationX/fungi/src/truffle/flash/FlashWorld.hx
r846 r873 23 23 import truffle.Entity; 24 24 import truffle.Truffle; 25 import truffle.Vec2; 25 26 26 27 class FlashWorld implements World, extends MovieClip … … 45 46 e.Destroy(cast(this,truffle.World)); 46 47 Scene.remove(e); 48 } 49 50 public function Get(p:Vec2) : Dynamic 51 { 52 var top:Entity = null; 53 var upper:Float=-9999; 54 55 for (e in Scene) 56 { 57 if (p.x==e.LogicalPos.x && 58 p.y==e.LogicalPos.y) 59 { 60 if (e.LogicalPos.z>upper) 61 { 62 top=e; 63 upper=e.LogicalPos.z; 64 } 65 } 66 } 67 return top; 47 68 } 48 69 -
scenarios/GerminationX/fungi/src/truffle/interfaces/World.hx
r814 r873 17 17 18 18 import truffle.Entity; 19 import truffle.Vec2; 19 20 20 21 interface World … … 22 23 public function Add(e:Entity) : Void; 23 24 public function Remove(e:Entity) : Void; 25 public function Get(p:Vec2) : Dynamic; 24 26 public function AddSprite(s:Sprite) : Void; 25 27 public function RemoveSprite(s:Sprite) : Void; -
scenarios/GerminationX/oak/public/index.html
r844 r873 5 5 <title>germination x</title> 6 6 </head> 7 <body >7 <body bgcolor="#000000"> 8 8 <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 9 9 width="50" … … 16 16 <param name="salign" value="lt" /> 17 17 <param name="bgcolor" value="#000000"/> 18 18 19 <embed src="fungi.swf" 19 20 bgcolor="#ffffff" 20 width=" 640"21 height=" 480"21 width="950" 22 height="576" 22 23 name="haxe" 23 24 quality="high" 24 25 align="middle" 25 allowScriptAccess="always" 26 allowScriptAccess="always" 26 27 type="application/x-shockwave-flash" 27 28 pluginspage="http://www.macromedia.com/go/getflashplayer" -
scenarios/GerminationX/oak/src/oak/core.clj
r871 r873 40 40 41 41 ;(def my-game-world (ref (game-world-load state-filename))) 42 (def my-game-world (ref (make-game-world 1000 4)))42 (def my-game-world (ref (make-game-world 5000 4))) 43 43 44 44 (append-spit log-filename (str (str (Date.)) " server started\n")) … … 58 58 (GET "/make-plant/:tilex/:tiley/:posx/:posy/:type/:owner/:size" 59 59 [tilex tiley posx posy type owner size] 60 (println "making plant...") 60 61 (append-spit 61 62 log-filename … … 69 70 (make-vec2 (parse tilex) (parse tiley)) 70 71 (make-plant (make-vec2 (parse posx) (parse posy)) type owner size)))) 71 (game-world-save (deref my-game-world) state-filename)72 (println (deref my-game-world))72 ;(game-world-save (deref my-game-world) state-filename) 73 ;(println (deref my-game-world)) 73 74 (json/encode-to-str '("ok"))) 74 75 (GET "/spirit-sprites" [] … … 104 105 (game-world-update (deref my-game-world) 105 106 time 1)))) 107 (println "tick...") 106 108 (recur)) 107 109 -
scenarios/GerminationX/oak/src/oak/game_world.clj
r871 r873 86 86 (modify :tiles 87 87 (fn [tiles] 88 ( map89 (fn [tile]90 (tile-update tile time delta))91 tiles))88 (doall (map 89 (fn [tile] 90 (tile-update tile time delta)) 91 tiles))) 92 92 game-world)) -
scenarios/GerminationX/oak/src/oak/plant.clj
r871 r873 47 47 48 48 (defn make-plant [pos type owner size] 49 (plant. pos type "" 'grow-a '() owner size 0 5start-health))49 (plant. pos type "" 'grow-a '() owner size 0 (+ 30 (Math/floor (rand 10))) start-health)) 50 50 51 51 (defn make-random-plant [] 52 52 (make-plant 53 (make-vec2 (Math/ round (rand 10)) (Math/round (rand 10)))54 "plant-000"53 (make-vec2 (Math/floor (rand 15)) (Math/floor (rand 15))) 54 (rand-nth (list "plant-001" "plant-002" "plant-003")) 55 55 "the garden" 56 56 (Math/round (+ 50 (rand 100))))) … … 63 63 (= state 'grow-c) (cond (> health min-health) 'grown :else (rand-nth (list 'grow-c 'grown))) 64 64 (= state 'grown) (cond 65 (> health max-health) 'fruit-a66 (< health min-health) 'ill-a65 (> health max-health) (rand-nth (list 'grown 'fruit-a)) 66 (< health min-health) (rand-nth (list 'grown 'ill-a)) 67 67 :else 'grown) 68 68 (= state 'decay-a) (cond (> health max-health) 'decay-a :else 'decay-b) … … 90 90 (< (count neighbours) min-neighbours) (max 0 (- health 1)) 91 91 (> (count neighbours) max-neighbours) (max 0 (- health 1)) 92 (= (:state plant) 'fruit-c) (max 0 (- health 10)) 92 93 :else (min 100 (+ health 1)))) 93 94 (modify
Note: See TracChangeset
for help on using the changeset viewer.