public override void evento_ColisionVerticalSprite(Sprite objSprite) { if (objSprite is PersonajePrincipal && Keyboard1.Instance.getkeyboardStateActual.IsKeyDown(Keys.Space) && band == 0) { band = 1; PersonajePrincipal personaje = (PersonajePrincipal)objSprite; // TileMap.GetInstance.sprites.Remove(this); Puzle puzle = new Puzle(game, "puzzle01"); puzle.x = this.x + 40; puzle.y = this.y - 50; TileMap.GetInstance.sprites.Add(puzle); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { this.IsMouseVisible = true; personaje = new PersonajePrincipal(this); Texture2D fondo = Content.Load<Texture2D>("Backgrounds/fondo"); TileMap.Instance(this, "Content/Mapas/mapa_1-1.csv", personaje,2,20); TileMap.GetInstance.spriteFactory = new RazonamientoSpriteFactory(this); //.spriteFactory = new RazonamientoSpriteFactory(this); //escenario.regenerarMapa(); TileMap.GetInstance.HorizontalScrolling = TileMap.Scrolling.Sprite; TileMap.GetInstance.VerticalScrolling = TileMap.Scrolling.Sprite; TileMap.GetInstance.ParallaxBackground = fondo; TileMap.GetInstance.regenerarMapa(); base.Initialize(); }