using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace youxisnakes
{
public partial class Form1 : Form
{
public Queue<Point> queue = new Queue<Point>();
public int speed = 1;
public int node = 3;
public int direction =39;
public Point food = new Point(0, 0);
public bool eated = false;
int score = 0;
public Graphics g;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
protected override bool ProcessDialogKey(Keys keyData)
{
if (keyData == Keys.Enter)
timer1.Start();
if (keyData == Keys.Space)
timer1.Stop();
int key_direction = Math.Abs((int)direction - (int)keyData);
if(key_direction==1||key_direction==3)
{
switch (keyData)
{
case Keys.Up: direction = 38; break;
case Keys.Left: direction = 37; break;
case Keys.Right: direction = 39; break;
case Keys.Down: direction = 40; break;
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace youxisnakes
{
public partial class Form1 : Form
{
public Queue<Point> queue = new Queue<Point>();
public int speed = 1;
public int node = 3;
public int direction =39;
public Point food = new Point(0, 0);
public bool eated = false;
int score = 0;
public Graphics g;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
protected override bool ProcessDialogKey(Keys keyData)
{
if (keyData == Keys.Enter)
timer1.Start();
if (keyData == Keys.Space)
timer1.Stop();
int key_direction = Math.Abs((int)direction - (int)keyData);
if(key_direction==1||key_direction==3)
{
switch (keyData)
{
case Keys.Up: direction = 38; break;
case Keys.Left: direction = 37; break;
case Keys.Right: direction = 39; break;
case Keys.Down: direction = 40; break;
}