private MyVisual() { //animation using a single SpriteSheet explosion = new SpriteSheetAnimation(new SpriteSheet(TextureLoader.FromBitmap(Resourcen.explosion), 5), 0, 24, 1f); //art from https://github.com/sparklinlabs/superpowers-asset-packs var spriteSheetGirl = new SpriteSheet(TextureLoader.FromBitmap(Resourcen.girl_2), 6, 7); girlIdleRun = new SpriteSheetAnimation(spriteSheetGirl, 0, 10, 1f); girlJumpBall = new SpriteSheetAnimation(spriteSheetGirl, 11, 20, 1f); girlFight = new SpriteSheetAnimation(spriteSheetGirl, 21, 25, 1f); girlDie = new SpriteSheetAnimation(spriteSheetGirl, 25, 32, 1f); girlBack = new SpriteSheetAnimation(spriteSheetGirl, 33, 36, 1f); //animation using a bitmap for each frame alienShip = new AnimationTextures(.5f); //art from http://millionthvector.blogspot.de/p/free-sprites.html alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10001)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10002)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10003)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10004)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10005)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10006)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10007)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10008)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10009)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10010)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10011)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10012)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10013)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10014)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10015)); //for transparency in textures GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); GL.Enable(EnableCap.Blend); timeSource.Start(); //start game time }
private MyVisual(IRenderState renderState, IContentLoader contentLoader) { //animation using a single SpriteSheet explosion = new SpriteSheetAnimation(new SpriteSheet(contentLoader.Load <ITexture2D>("explosion"), 5, 5), 0, 24, 1f); //art from https://github.com/sparklinlabs/superpowers-asset-packs var spriteSheetGirl = new SpriteSheet(contentLoader.Load <ITexture2D>("girl-2"), 6, 7); girlIdleRun = new SpriteSheetAnimation(spriteSheetGirl, 0, 10, 1f); girlJumpBall = new SpriteSheetAnimation(spriteSheetGirl, 11, 20, 1f); girlFight = new SpriteSheetAnimation(spriteSheetGirl, 21, 25, 1f); girlDie = new SpriteSheetAnimation(spriteSheetGirl, 25, 32, 1f); girlBack = new SpriteSheetAnimation(spriteSheetGirl, 33, 36, 1f); //animation using a bitmap for each frame alienShip = new AnimationTextures(.5f); //art from http://millionthvector.blogspot.de/p/free-sprites.html alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10001")); alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10002")); alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10003")); alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10004")); alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10005")); alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10006")); alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10007")); alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10008")); alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10009")); alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10010")); alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10011")); alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10012")); alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10013")); alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10014")); alienShip.AddFrame(contentLoader.Load <ITexture2D>("alien10015")); //for transparency in textures renderState.Set(BlendStates.AlphaBlend); GL.Enable(EnableCap.Texture2D); //TODO: remove if shader is used }