コード例 #1
0
ファイル: Falling.cs プロジェクト: roman-murashov/scmpoo
        public override int Tick()
        {
            Step = (Step + 1) % 2;
            Poo.SetSprite(4 + Step);
            if (Poo.IsMouseDown)
            {
                velocity = 0;
                return(100);
            }
            int    newvelocity   = velocity + acceleration;
            Screen currentScreen = Screen.FromControl(Poo);

            if (!currentScreen.WorkingArea.Contains(new Rectangle(Poo.Location.X, Poo.Location.Y + newvelocity, Poo.Width, Poo.Height)))
            {
                Impact(currentScreen.WorkingArea, newvelocity, false);
                return(100);
            }
            var rect = Utility.GetRectangleAtPoint(Poo.Location.X + Poo.Width / 2, Poo.Location.Y + Poo.Height + newvelocity);

            if (rect != Rectangle.Empty &&
                Between(rect.Y, Poo.Location.Y + Poo.Height, Poo.Location.Y + Poo.Height + newvelocity) &&
                rect.Contains(Poo.Location.X, Poo.Location.Y + Poo.Height + newvelocity) &&
                rect.Contains(Poo.Location.X + Poo.Width, Poo.Location.Y + Poo.Height + newvelocity))
            {
                Impact(rect, newvelocity, true);
                return(100);
            }
            velocity = newvelocity;
            Poo.Top += velocity;
            return(100);
        }
コード例 #2
0
ファイル: Turn.cs プロジェクト: roman-murashov/scmpoo
 public override int Tick()
 {
     Step++;
     if (Step > 2)
     {
         Poo.FacingRight = !Poo.FacingRight;
         Poo.SetSprite(3);
         Finished = true;
     }
     else
     {
         Poo.SetSprite(start + Step);
     }
     return(200);
 }
コード例 #3
0
ファイル: Sneeze.cs プロジェクト: roman-murashov/scmpoo
 public override int Tick()
 {
     if (Step == 1)
     {
         FormMain.PlaySound("sneeze.wav");
     }
     if (Step >= sprites.Length)
     {
         Finished = true;
     }
     else
     {
         Poo.SetSprite(sprites[Step]);
         Step++;
     }
     return(200);
 }
コード例 #4
0
ファイル: Move.cs プロジェクト: roman-murashov/scmpoo
 public override int Tick()
 {
     if (movetype == 0)
     {
         Poo.SetSprite(2 + Step % 2);
     }
     else if (movetype == 1)
     {
         Poo.SetSprite(4 + Step % 2);
     }
     // todo: running into the edge of another poo or a background window causes the poo to bounce away
     // alternatively, step and run up the side of the window
     // if running and reach edge of a window with nothing below, jump off ?
     Poo.Left      += stepdistance * (Poo.FacingRight ? 1 : -1);
     totaldistance -= stepdistance;
     if (totaldistance <= 0)
     {
         Finished = true;
     }
     return(200);
 }