예제 #1
0
        private void UpdateTrainWarp()
        {
            if (Vector2.Distance(this.player.position, PlayerHelpers.GetSpawnPoint(this.player)) <= 8)          // is at spawn
            {
                if (Vector2.Distance(this.player.position, this.PrevPosition) > 16 * 4)                         // is 4+ blocks away since prev tick
                {
                    this.HandleRecall();
                }
            }

            this.PrevPosition = this.player.position;
        }
예제 #2
0
        public override bool ConsumeItem( Player player )
        {
            var player_pos = player.Center;
            var home_pos = PlayerHelpers.GetSpawnPoint( player );
            player_pos.X -= WormholePortal.Width / 2;
            player_pos.Y -= 128 + player.height + 1;
            home_pos.X -= WormholePortal.Width / 2;
            home_pos.Y -= 128 + player.height + 1;

            TownPortalScrollItem.OpenPortal( (WormholesMod)this.mod, player, player_pos, home_pos );

            return base.ConsumeItem( player );
        }