@@ -243,8 +243,8 @@ class Main #if openfl extends Sprite #end
243243 if (player .follow )
244244 {
245245 // set camera to middle
246- objects .group .x = Math .round (lerp (objects .group .x ,- player .x * objects .scale + objects .width / 2 ,0.05 ));
247- objects .group .y = Math .round (lerp (objects .group .y ,- player .y * objects .scale + objects .height / 2 ,0.05 ));
246+ objects .group .x = Math .round (lerp (objects .group .x ,- player .x * objects .scale + objects .width / 2 ,0.08 ));
247+ objects .group .y = Math .round (lerp (objects .group .y ,- player .y * objects .scale + objects .height / 2 ,0.08 ));
248248 }
249249 // set ground
250250 ground .x = objects .group .x ;
@@ -361,8 +361,14 @@ class Main #if openfl extends Sprite #end
361361 trace (" kill" );
362362 program .kill (selectX ,selectY );
363363 }else {
364+ if (player .instance .age < 3 )
365+ {
366+ program .jump ();
367+ }
364368 // use action if within range
365369 program .use (selectX ,selectY );
370+ // check if player pickup
371+ program .pickup ();
366372 }
367373 }
368374 }
@@ -374,7 +380,7 @@ class Main #if openfl extends Sprite #end
374380 {
375381 if (player != null )
376382 {
377- if (player .instance .o_id > 0 )
383+ if (player .instance .o_id != 0 )
378384 {
379385 program .drop (selectX ,selectY );
380386 }else {
@@ -417,8 +423,10 @@ class Main #if openfl extends Sprite #end
417423 objects .clear ();
418424 trace (" clear " + Std .string (Timer .stamp () - time ));
419425 time = Timer .stamp ();
426+ // clear cache
420427 if (objects .getFill () > 0.90 || objects .clearBool )
421428 {
429+ trace (" clear cache!" );
422430 objects .cacheMap = new Map <Int ,Int >();
423431 objects .tileX = 0 ;
424432 objects .tileY = 0 ;
@@ -557,17 +565,19 @@ class Main #if openfl extends Sprite #end
557565 // set message reader function to game
558566 Main .client .message = message ;
559567 Main .client .end = end ;
568+ client .login .accept = null ;
560569 // Main.client.login = null;
561570 Main .client .tag = null ;
562571 index = 0 ;
563572 }
564573 client .login .reject = function ()
565574 {
566575 trace (" reject" );
576+ client .login .reject = null ;
567577 // Main.client.login = null;
568578 }
569579 client .message = Main .client .login .message ;
570- trace (" connect " + Main .client .ip + " email " + Main .client .login .email );
580+ // trace("connect " + Main.client.ip + " email " + Main.client.login.email);
571581 client .connect ();
572582 }
573583 public function message (input : String )
@@ -642,7 +652,7 @@ class Main #if openfl extends Sprite #end
642652 #if openfl
643653 var tile : Tile ;
644654 var id : Array <Int > = change .floor > 0 ? [change .floor ] : change .id ;
645- trace (" change id: " + id );
655+ // trace("change id: " + id);
646656 var move : Bool = change .speed > 0 ? true : false ;
647657 // removal location
648658 var rx : Int = change .speed > 0 ? change .oldX : change .x ;
@@ -663,7 +673,7 @@ class Main #if openfl extends Sprite #end
663673 if (array != null ) for (tile in array ) objects .group .removeTile (tile );
664674 // add new
665675 add (id ,rx ,ry ,move ,! move );
666- if (move )
676+ if (move && objects . object != null )
667677 {
668678 // add to new location
669679 data .tileData .object .set (change .x ,change .y ,[objects .object ]);
@@ -680,7 +690,7 @@ class Main #if openfl extends Sprite #end
680690 Main .client .tag = null ;
681691 index = 0 ;
682692 case FOOD_CHANGE :
683- trace (" food change " + input );
693+ // trace("food change " + input);
684694 var array = input .split (" " );
685695 food .graphics .clear ();
686696 food .graphics .beginFill (0 );
@@ -718,10 +728,7 @@ class Main #if openfl extends Sprite #end
718728 // p_id first_name last_name last_name may be ommitted.
719729 var array = input .split (" " );
720730 var name : String = array [1 ] + (array .length > 1 ? " " + array [2 ] : " " );
721- draw .username (Std .parseInt (array [0 ]),name );
722- case DYING :
723- // p_id isSick isSick is optional 1 flag to indicate that player is sick (client shouldn't show blood UI overlay for sick players)
724-
731+ draw .username (Std .parseInt (array [0 ]),name );
725732 case HEALED :
726733 // p_id player healed no longer dying.
727734
@@ -730,7 +737,27 @@ class Main #if openfl extends Sprite #end
730737
731738 case GRAVE :
732739 // x y p_id
740+ var array = input .split (" " );
741+ var x : Int = Std .parseInt (array [0 ]);
742+ var y : Int = Std .parseInt (array [1 ]);
743+ var id : Int = Std .parseInt (array [2 ]);
744+ if (player .instance .p_id != id )
745+ {
733746
747+ }else {
748+ // main player died disconnect
749+ client .close ();
750+ var timer = new Timer (2 * 1000 );
751+ timer .run = function ()
752+ {
753+ trace (" attempt to reconnect" );
754+ connect ();
755+ timer .stop ();
756+ }
757+ }
758+ case DYING :
759+ // p_id isSick isSick is optional 1 flag to indicate that player is sick (client shouldn't show blood UI overlay for sick players)
760+ trace (" dying " + input );
734761 case GRAVE_MOVE :
735762 // xs ys xd yd swap_dest optional swap_dest parameter is 1, it means that some other grave at destination is in mid-air. If 0, not
736763
0 commit comments