Esempio n. 1
0
        public void ImageTimer()
        {
            var now     = DateTime.Now;
            var elapsed = now - previousTime;

            previousTime = now;
            var msec = (int)elapsed.TotalMilliseconds;

            bgOffset -= bgSpeed * msec / 1000;
            if (bgOffset < -400)
            {
                bgOffset += 400;
            }

            if (kirbyTag == 0)
            {
                kirbyRun.updateFrame(msec);
            }
            else if (kirbyTag == 1)
            {
                kirbyStar.updateFrame(msec);
            }

            Invalidate();

            if (kirbyTag == 1)
            {
                drawCount++;
            }
        }
Esempio n. 2
0
        private void timer_Tick(object sender, EventArgs e)
        {
            var now     = DateTime.Now;
            var elapsed = now - previousTime;

            previousTime = now;
            var msec = (int)elapsed.TotalMilliseconds;

            bgOffset -= bgSpeed * msec / 1000;
            if (bgOffset < -400)
            {
                bgOffset += 400;
            }

            kurbi.updateFrame(msec);
            Invalidate();
        }