ehdgks0627 / crazy_layer Goto Github PK
View Code? Open in Web Editor NEWwhat do you want?
License: GNU General Public License v3.0
what do you want?
License: GNU General Public License v3.0
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();
}
}
}
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
스톱워치가 안걸린다..
user moveing(up&down)
bubble explosion
splash effect
-damage to user and block
multi-user
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.