public void Draw(float timeElapsed)
        {
            fade       -= timeElapsed / maxtime;
            timealive  += timeElapsed;
            lifepercent = timealive / maxtime;

            currentsize = shockwaveminsize + lifepercent * shockwavemaxsize;
            scale       = camera.Scale(currentsize, shockwavetexture.Width);
            Color color = new Color(fade, fade, fade, fade);

            centertexture = new Vector2(shockwavetexture.Width / 2, shockwavetexture.Height / 2);
            spritebatch.Draw(shockwavetexture, camera.Converttovisualcoords(currentPos, scale), null, color, 0, centertexture, scale, SpriteEffects.None, 0.9f);
        }
예제 #2
0
        public void Draw(float elapsedtime)
        {
            timeElapsed += elapsedtime;

            float percentAnimated = timeElapsed / animationspeed;
            int   frame           = (int)(percentAnimated * totalframes);
            int   frameX          = frame % numframesX;
            int   frameY          = frame / numframesX;

            explosionwidth  = explosion.Width / numframesX;
            explosionheight = explosion.Height / numframesY;

            Rectangle rect = new Rectangle(explosionwidth * frameX, explosionheight * frameY, explosionwidth, explosionheight);

            centersprite = new Vector2(explosionwidth / 2, explosionheight / 2);
            spritebatch.Draw(explosion, camera.Converttovisualcoords(currentPos, scale), rect, Color.White, 0, centersprite, scale, SpriteEffects.None, 0.6f);
        }
 public void DrawBalls()
 {
     foreach (Ball ball in ballsim.getballs())
     {
         spritebatch.Draw(background, rect, Color.White);
         Vector2 currentballpos = ball.getballpos;
         float   scale          = camera.Scale(ball.getballradius * 2, balltexture.Width);
         var     ballvisualpos  = camera.Converttovisualcoords(currentballpos, scale);
         if (ball.Getballstatus == false)
         {
             spritebatch.Draw(balltexture, ballvisualpos, null, Color.White, 0, ballcenter, scale, SpriteEffects.None, 0.4f);
         }
         else
         {
             spritebatch.Draw(deadball, ballvisualpos, null, Color.White, 0, ballcenter, scale, SpriteEffects.None, 0.4f);
         }
     }
 }
        public void Draw(SpriteBatch spritebatch, Camera camera)
        {
            float scale = camera.Scale(particlesize,smokecloud.Width);

            spritebatch.Draw(smokecloud, camera.Converttovisualcoords(currentpos, scale), null, color, rotation, randomdirection, scale, SpriteEffects.None, 0.8f);
        }
예제 #5
0
        public void Draw(SpriteBatch spritebatch, Camera camera)
        {
            float scale = camera.Scale(particlesize, smokecloud.Width);

            spritebatch.Draw(smokecloud, camera.Converttovisualcoords(currentpos, scale), null, color, rotation, randomdirection, scale, SpriteEffects.None, 0.8f);
        }
예제 #6
0
        public void Draw()
        {
            float scale = camera.Scale(particlesize, spark.Width);

            spritebatch.Draw(spark, camera.Converttovisualcoords(startpos, scale), null, color, 0, randomdirection, scale, SpriteEffects.None, 0.7f);
        }