Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            DataInsert dataIn = new DataInsert();

            dataIn.Show();
        }
Beispiel #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (right == true)
            {
                player.Left += 5;
            }
            if (left == true)
            {
                player.Left -= 5;
            }

            if (jump == true && doubleJump == false)
            {
                player.Top -= Force; //점프하면서 떨어짐
                Force      -= 1;
            }
            if (jump == true && doubleJump == true)
            {
                player.Top -= Force; //점프하면서 떨어짐
                Force      -= 1;
            }

            if (player.Top + player.Height >= screen.Height)
            {
                player.Top = screen.Height - player.Height; //stop falling at bottom
                if (jump == true)
                {
                    player.Image = Image.FromFile("stand.png");
                }
                jump       = false;
                doubleJump = false;
            }
            else
            {
                player.Top += 5;
            }

            /*
             * if (sy.JumpState == true)
             * {
             *
             *  if (sy.picture.Location.Y > 100)
             *  {
             *      sy.Dy = -7;
             *      sy.move();
             *  }
             *  if(sy.picture.Location.Y<=100)
             *  {
             *      sy.JumpState = false;
             *  }
             * }
             * if (sy.JumpState == false)
             * {
             *  if (sy.picture.Location.Y < 200)
             *  {
             *      sy.Dy = +7;
             *      sy.move();
             *  }
             * }
             */
            Item temp;


            for (int i = itemList.Count - 1; i >= 0; i--)
            {
                temp = itemList[i];

                if (sy.checkCollision(temp))
                {
                    sy.Hp      -= 1;
                    label1.Text = sy.Hp.ToString();

                    //충돌시 picture 이미지 삭제 및 itemList에서 제거
                    // temp.picture.Dispose();
                    temp.picture.Location = new System.Drawing.Point(1000, 150);
                    itemList.Remove(temp);

                    if (sy.Hp == 90)
                    {
                        this.Visible = false;
                        DataInsert dataIn = new DataInsert();
                        dataIn.Show();
                    }
                }

                if (temp.picture.Location.X < 100)
                {
                    // picture 이미지 삭제 및 itemList에서 제거
                    //  temp.picture.Dispose();
                    temp.picture.Location = new System.Drawing.Point(1000, 150);
                    itemList.Remove(temp);
                }
                else
                {
                    temp.Dx = -5;
                    temp.move();
                }
            }

            if (itemList.Count == 0)
            {
                for (int i = 0; i < 10; i++)
                {
                    itemList.Add(new Item(soju[i]));
                    itemList.Add(new Item(hotsix[i]));
                    itemList.Add(new Item(book[i]));
                }
                this.ItemInitVer1();
            }
        }//timer1_tick()