Giter VIP home page Giter VIP logo

crazy_layer's People

Contributors

chongin12 avatar ehdgks0627 avatar jwoo619 avatar kookk avatar rlfdldjaak22 avatar waitle avatar yayoung avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crazy_layer's Issues

이가영 타이머

using System;
using System.Windows.Forms;

namespace Timer_oo
{
    public partial class Form1 : Form
    {
        private int Timer2Count = 0;
        int i=2;

        public Form1()
        {
            InitializeComponent();
            this.Load += new System.EventHandler(this.Form1_Load);
            this.timer2.Tick += new EventHandler(timer2_Tick);  
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            timer2.Interval = 1000;
        }

        private void 게임시작_Click(object sender, EventArgs e)
        {
            Timer2Count = 59;
            timer2.Start();
        }
        
        private void timer2_Tick(object sender, EventArgs e)
        {
            label2.Text = Timer2Count--.ToString();
            label1.Text = i.ToString();
            if (Timer2Count == -1)
            {
                
                Timer2Count = 59;
                label1.Text = i.ToString();
                i--;
            }
               
            if (i==-1)
            {
                timer2.Stop();
                MessageBox.Show("Finish.");
                
            }
        }

        private void기_Click(object sender, EventArgs e)
        {
            label2.Text =0.ToString();
            timer2.Stop();
        } 
    }
}

방향키 동시 키입력 제한

image
배열이라 temp2에 i+1위치 넣어서 비교하려고하는데 터진다. . 왜그런지 아시는분? 다른 좋은 아이디어도 괜찮음

채팅박스 참조 도와줘 앙망함

namespace Crazy
{
    public partial class Choose_Room : Form
    {
        int key;
        Thread t;
        send_sock chat_send;
        listen_sock chat_listen;
        public Choose_Room(int k = 0)
        {
            chat_send = new send_sock("239.0.0.222", 2222);
            chat_listen = new listen_sock("239.0.0.222", 2222);
            t = new Thread(chat_listen.listen);
            t.Start();
            InitializeComponent();
            key = k;
        }

        public static int Check_chatting = 0;

        private void textBox1_KeyUp(object sender, KeyEventArgs e)
        {
            if (textBox1.Text.Length != 0 && e.KeyCode == Keys.Enter)
            {
                chat_send.sendbuf(textBox1.Text);
                textBox1.Text = "";
                Chatting_Box.SelectedIndex = Chatting_Box.Items.Count - 1;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Search_Room frm = new Search_Room(key);
            frm.Owner = this;
            frm.Show();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Make_Room frm = new Make_Room(key);
            frm.Owner = this;
            frm.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            Shop frm = new Shop();
            frm.Owner = this;
            frm.Show();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (Check_chatting == 0)
            {
                textBox1.Text = "";
                Check_chatting = 1;
            }
        }

        public static int Page_Num = 1;

        private void button4_Click(object sender, EventArgs e)
        {
            Page_Num--;
            label2.Text = "" + Page_Num;
            this.Visible = false;
            Choose_Room frm = new Choose_Room();
            frm.Owner = this;
            frm.Show();
        }

        private void button5_Click(object sender, EventArgs e)
        {

            Page_Num++;
            label2.Text = "" + Page_Num;
            this.Visible = false;
            Choose_Room frm = new Choose_Room();
            frm.Owner = this;
            frm.Show();

        }

        private void PictureBox_Num(object sender, EventArgs e)
        {
            Console.WriteLine("{0}", sender);
            this.Visible = false;
            before_game frm = new before_game(key);
            frm.Owner = this;
            frm.Show();
        }

        private void Quit_Button_Click(object sender, EventArgs e)
        {
            Quit_ask frm = new Quit_ask(); // 새 폼 생성
            frm.Owner = this; // 새 폼의 오너를 현재 폼으로
            frm.Show();
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            start frm = new start(); // 새 폼 생성
            frm.Show();
            this.Close();
        }

    }
    public class send_sock
    {
        public UdpClient udpclient = null;
        private IPAddress multiaddress;
        private IPEndPoint remoteEP;
        byte[] buffer = null;
        public send_sock(string ip, int port)
        {
            udpclient = new UdpClient();
            multiaddress = IPAddress.Parse(ip);
            udpclient.JoinMulticastGroup(multiaddress);
            remoteEP = new IPEndPoint(multiaddress, port);
        }
        public bool sendbuf(string message)
        {
            buffer = Encoding.Unicode.GetBytes(message);
            udpclient.Send(buffer, buffer.Length, remoteEP);
            return true;
        }
        public void closesock()
        {
            if (udpclient != null)
                udpclient.Close();
            else
                MessageBox.Show("서버 안열림여");
        }
    }
    public class listen_sock
    {
        public UdpClient udpclient = null;
        public IPAddress multiaddress;
        private IPEndPoint localEp;
        public listen_sock(string ip, int port)
        {
            udpclient = new UdpClient();

            udpclient.ExclusiveAddressUse = false;
            localEp = new IPEndPoint(IPAddress.Any, 2222);

            udpclient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
            udpclient.ExclusiveAddressUse = false;

            udpclient.Client.Bind(localEp);

            multiaddress = IPAddress.Parse("239.0.0.222");
            udpclient.JoinMulticastGroup(multiaddress);
        }
        public void listen()
        {
            while (true)
            {
                byte[] data = udpclient.Receive(ref localEp);
                string strData = Encoding.Unicode.GetString(data);

                if (strData == "quit")
                    break;
            }
        }
        public void close()
        {
            udpclient.Close();
        }
    }
}

listen() 함수에서 Chatting_Box.Add(strData); 해야되는데 채팅박스 참조가 앙대여

다트 관련 함수

if (temp.key == Keys.Shift)
                    {   
                        if (temp.stat == 1)
                        {

                            if (((moveit.Size.Width / 15) * (hero.pb_hero.Location.X / (moveit.Size.Width / 15))) + (moveit.Size.Width / 30) > hero.pb_hero.Location.X && (((moveit.Size.Height / 15) * (hero.pb_hero.Location.X / (moveit.Size.Height / 15))) + (moveit.Size.Height / 30) > hero.pb_hero.Location.X))
                            {
                                Thread thread_Dart = new Thread(shoot_Dart(check_Direction(preX, preY, X, Y)));
                                thread_Dart.Start();
                            }
                            else if (((moveit.Size.Width / 15) * (hero.pb_hero.Location.X / (moveit.Size.Width / 15))) + (moveit.Size.Width / 30) < hero.pb_hero.Location.X && (((moveit.Size.Height / 15) * (hero.pb_hero.Location.X / (moveit.Size.Height / 15))) + (moveit.Size.Height / 30) < hero.pb_hero.Location.X))
                            {
                                Thread thread_Dart = new Thread(shoot_Dart(check_Direction(preX, preY, X, Y)));
                                thread_Dart.Start();
                            }
                        }


int check_Direction(int preX, int preY, int X, int Y){
//Right = 0, Left = 1, Up = 2, Down = 3
    if(preX - X > 0 && preY = Y)
        return 0;

    else if(preX - X < 0 && preY = Y)
        return 1;
    else if(preX = X && preY - Y > 0)
        return 2;
    else if(preX = X && preY - Y < 0)
        return 3;
}

void shoot_Dart(int direction, int heroX, int heroY){
    switch(direction){
        case 0:
            PictureBox Dart = new PictureBox;

            Dart.Location = new Point(heroX, heroY);
            Dart.Size = new Size(40, 40);
            Dart.Image = Properties.Resources.Dart_Right
            Dart.Sizemode = PictureBoxSizeMode.StretchImage;
            Dart.Sizemode = True;

            Controls.Add(Dart);

            for(Dart.Location.X; Dart.Location.X < 920;){
                if(map[Dart.Location.X / 40, Dart.Location.Y / 40] == 1){
                    pung(Dart.Location.X, Dart.Location.Y);
                    break;
                }

                Dart.Location = new Point(Dart.Location.X + 50, Dart.Location.Y);
                Sleep(200);
            }
            break;

        case 1:
            PictureBox Dart = new PictureBox;

            Dart.Location = new Point(heroX, heroY);
            Dart.Size = new Size(40, 40);
            Dart.Image = Properties.Resources.Dart_Right
            Dart.Sizemode = PictureBoxSizeMode.StretchImage;
            Dart.Sizemode = True;

            Controls.Add(Dart);

            for(Dart.Location.X; Dart.Location.X > 0;){
                if(map[Dart.Location.X / 40, Dart.Location.Y / 40] == 1){
                    pung(Dart.Location.X, Dart.Location.Y);
                    break;
                }

                Dart.Location = new Point(Dart.Location.X - 50, Dart.Location.Y);
                Sleep(200);
            }
            break;

        case 2:
            PictureBox Dart = new PictureBox;

            Dart.Location = new Point(heroX, heroY);
            Dart.Size = new Size(40, 40);
            Dart.Image = Properties.Resources.Dart_Right
            Dart.Sizemode = PictureBoxSizeMode.StretchImage;
            Dart.Sizemode = True;

            Controls.Add(Dart);

            for(Dart.Location.Y; Dart.Location.Y > 0;){
                if(map[Dart.Location.X / 40, Dart.Location.Y / 40] == 1){
                    pung(Dart.Location.X, Dart.Location.Y);
                    break;
                }
                    
                Dart.Location = new Point(Dart.Location.X, Dart.Location.Y - 50);
                Sleep(200);
            }
            break;

        case 3:
            PictureBox Dart = new PictureBox;

            Dart.Location = new Point(heroX, heroY);
            Dart.Size = new Size(40, 40);
            Dart.Image = Properties.Resources.Dart_Right
            Dart.Sizemode = PictureBoxSizeMode.StretchImage;
            Dart.Sizemode = True;

            Controls.Add(Dart);

            for(Dart.Location.Y; Dart.Location.Y < 940;){
                if(map[Dart.Location.X / 40, Dart.Location.Y / 40] == 1){
                    pung(Dart.Location.X, Dart.Location.Y);
                    break;
                }
                    
                Dart.Location = new Point(Dart.Location.X, Dart.Location.Y + 50);
                Sleep(200);
            }
            break;
    }
    Controls.Remove(Dart);
    thread_Dart.Abort;
}

check_Direction 다트 날릴 방향 체크
shoot_Dart 다트 이동 및 물풍선 폭발 체크

택서 해야할꺼

해야할것

  • 캐릭터 생성 및 이동
  • 물풍선 생성 및 파기
  • 물풍선 생성 위치
  • 캐릭터 이동 위치 제한
  • 물풍선 충돌처리-한길

어려운점

  • 터질때 블럭충돌처리
  • 동시키입력 대각선처리
  • 클래스를 어떻게객체처럼 사용?<-이거되면 다해결

doing

  • 캐릭터 이동방향제한(이동부터 구현해야함

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.