protected override void AddedToScene() { base.AddedToScene (); Background = new CCSprite ("background"); Background.Scale = screenSize.Width / Background.ContentSize.Width; Map = new CCTileMap (new CCTileMapInfo ("tilemaps/bitte.tmx")); //bei einer Invocation Exception einfach ne neue Map machen //vielleicht auch mal schauen, ob die XML_Datei korrekt ist(Attribute, fehlende < etc.) //wenn die Maplayer nicht vollständig geladen werden, muss man die Compression umstellen //mapproperties if (Map.MapPropertyNamed ("Creator") != null) mapCreator = Map.MapPropertyNamed ("Creator"); if (Map.MapPropertyNamed ("Version") != null) mapVersion = Map.MapPropertyNamed ("Version"); if (Map.MapPropertyNamed ("Name") != null) mapName = Map.MapPropertyNamed ("Name"); Map.Scale = 3f; //Scale auch beim Spawnpoint ändern Map.Antialiased = false; //Map.LayerNamed ("mainlayer") pointLayer = Map.ObjectGroupNamed ("points"); Dictionary<string,string> spawnPoint = pointLayer.ObjectNamed ("SpawnPoint"); gameContainer.mainCharacter.Position = new CCPoint ((float)Convert.ToInt32 (spawnPoint ["x"]) * Map.ScaleX, (float)Convert.ToInt32 (spawnPoint ["y"]) * Map.ScaleY); gameContainer.physicsHandler.Initialize (Map.MapDimensions.Size.Width * Map.TileTexelSize.Width * Map.ScaleX, gameContainer.mainCharacter, Map.LayerNamed ("mainlayer"), Map, gameContainer); gameContainer.mainCharacter.bindToPhysicsHandler (gameContainer.physicsHandler); //Platform hinzufügen gameContainer.platformContainer.AddRange (TMXLayerDataLoader.LoadPlatformFromLayer (Map, Map.ObjectGroupNamed ("aditionallayer"), gameContainer)); gameContainer.jumpPadContainer.AddRange (TMXLayerDataLoader.LoadJumpPadFromLayer (Map, Map.ObjectGroupNamed ("aditionallayer"), gameContainer)); this.AddChild (Background, -1); this.AddChild (Map, 0); this.AddChild (gameContainer.mainCharacter.Sprite, 2); this.AddChild (gameContainer.physicsHandler.debugDrawer.DrawNode, 1); foreach (Platform knownPlatform in gameContainer.platformContainer) { this.AddChild (knownPlatform); } foreach (JumpPad knownJumpPad in gameContainer.jumpPadContainer) { this.AddChild (knownJumpPad); } //particle init PlayerMovingParticle = new GroundParticle (); this.AddChild (PlayerMovingParticle); PlayerMovingParticle.Position = gameContainer.mainCharacter.Position; }