Add project files.

This commit is contained in:
maxwes08
2026-01-27 11:02:21 +01:00
parent 266591bbea
commit b6e5c3dfbc
12 changed files with 436 additions and 0 deletions

44
Snake/Game.cs Normal file
View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Snake
{
public class Game
{
//new Cell(10, 10, CellTypes.Snake)
Worm worm;
Directions direction = Directions.Down;
Map map;
Form1 form;
public Game(Form1 form)
{
this.form = form;
}
public void Start()
{
Cell startCell = new Cell(10, 10, CellTypes.Snake);
map = new Map(20, 20);
map.SetCell(startCell);
worm = new Worm(startCell);
}
public void Update()
{
map.Render(form.gamearea.CreateGraphics());
form.Invalidate();
int x = worm.Body[0].X;
int y = worm.Body[0].Y;
Cell snakeCell = map.Cells[x, y];
Cell cellBelow = map.Cells[x, y-1];
map.SwapCells(snakeCell, cellBelow);
}
}
}