Exemplo n.º 1
0
 private void SpawnPickups()
 {
     foreach (Vector2 cell in Pickups.GetUsedCells())
     {
         int    id   = Pickups.GetCellv(cell);
         string type = Pickups.TileSet.TileGetName(id);
         if (type.ToLower() == "gem" || type.ToLower() == "cherry")
         {
             GD.Print(type);
             Collectible c   = (Collectible)Collectible.Instance();
             Vector2     pos = Pickups.MapToWorld(cell);
             c.Init(type, pos + Pickups.CellSize / 2);
             AddChild(c);
             c.Connect("Pickup", this, "_on_Collectible_Pickup");
         }
     }
 }