Георгий Цырков
8 years ago
6 changed files with 168 additions and 21 deletions
@ -1,23 +1,72 @@ |
|||||||
using System; |
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
|
||||||
namespace theGame |
namespace theGame |
||||||
{ |
{ |
||||||
public class Game |
public class Game |
||||||
{ |
{ |
||||||
public bool GameOver; |
public bool GameOver; |
||||||
|
|
||||||
private int hitCount; |
|
||||||
|
|
||||||
public PlayerCraft playerCraft; |
public PlayerCraft playerCraft; |
||||||
|
|
||||||
|
public int ViewWidth; |
||||||
|
public int ViewHeight; |
||||||
|
|
||||||
|
public List<Item> rocks; |
||||||
|
|
||||||
public Game() |
public Game() |
||||||
{ |
{ |
||||||
this.GameOver = false; |
this.GameOver = false; |
||||||
|
|
||||||
this.hitCount = 0; |
this.ViewWidth = 78; |
||||||
|
this.ViewHeight = 20; |
||||||
|
|
||||||
this.playerCraft = new PlayerCraft(); |
this.playerCraft = new PlayerCraft(); |
||||||
playerCraft.positionX = 10; |
playerCraft.positionX = 7; |
||||||
playerCraft.positionY = 12; |
playerCraft.positionY = 12; |
||||||
|
|
||||||
|
rocks = new List<Item>(); |
||||||
|
|
||||||
|
Item rock1 = new Item(); |
||||||
|
rock1.points.Add(new ItemPoint() { relativeCordX = 0, relativeCordY = 0, symbol = '#' }); |
||||||
|
rock1.points.Add(new ItemPoint() { relativeCordX = -1, relativeCordY = 0, symbol = '#' }); |
||||||
|
rock1.points.Add(new ItemPoint() { relativeCordX = 1, relativeCordY = 0, symbol = '#' }); |
||||||
|
rock1.points.Add(new ItemPoint() { relativeCordX = 0, relativeCordY = 1, symbol = '#' }); |
||||||
|
rock1.points.Add(new ItemPoint() { relativeCordX = 0, relativeCordY = -1, symbol = '#' }); |
||||||
|
rock1.positionX = 80; |
||||||
|
rock1.positionY = 5; |
||||||
|
|
||||||
|
Item rock2 = new Item(); |
||||||
|
rock2.points.Add(new ItemPoint() { relativeCordX = 0, relativeCordY = 0, symbol = '#' }); |
||||||
|
rock2.points.Add(new ItemPoint() { relativeCordX = -1, relativeCordY = 0, symbol = '#' }); |
||||||
|
rock2.points.Add(new ItemPoint() { relativeCordX = 1, relativeCordY = 0, symbol = '#' }); |
||||||
|
rock2.points.Add(new ItemPoint() { relativeCordX = 0, relativeCordY = 1, symbol = '#' }); |
||||||
|
rock2.points.Add(new ItemPoint() { relativeCordX = 0, relativeCordY = -1, symbol = '#' }); |
||||||
|
rock2.positionX = 85; |
||||||
|
rock2.positionY = 13; |
||||||
|
|
||||||
|
Item rock3 = new Item(); |
||||||
|
rock3.points.Add(new ItemPoint() { relativeCordX = 0, relativeCordY = 0, symbol = '#' }); |
||||||
|
rock3.points.Add(new ItemPoint() { relativeCordX = -1, relativeCordY = 0, symbol = '#' }); |
||||||
|
rock3.points.Add(new ItemPoint() { relativeCordX = 1, relativeCordY = 0, symbol = '#' }); |
||||||
|
rock3.points.Add(new ItemPoint() { relativeCordX = 0, relativeCordY = 1, symbol = '#' }); |
||||||
|
rock3.points.Add(new ItemPoint() { relativeCordX = 0, relativeCordY = -1, symbol = '#' }); |
||||||
|
rock3.positionX = 75; |
||||||
|
rock3.positionY = 17; |
||||||
|
|
||||||
|
rocks.Add(rock1); |
||||||
|
rocks.Add(rock2); |
||||||
|
rocks.Add(rock3); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public void DoMoves() |
||||||
|
{ |
||||||
|
for (int i = 0; i < rocks.Count; i++) |
||||||
|
{ |
||||||
|
rocks[i].positionX--; |
||||||
|
} |
||||||
|
|
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -0,0 +1,17 @@ |
|||||||
|
using System; |
||||||
|
namespace theGame |
||||||
|
{ |
||||||
|
public class ItemPoint |
||||||
|
{ |
||||||
|
public int relativeCordX; |
||||||
|
public int relativeCordY; |
||||||
|
public char symbol; |
||||||
|
|
||||||
|
public ItemPoint() |
||||||
|
{ |
||||||
|
this.relativeCordX = 0; |
||||||
|
this.relativeCordY = 0; |
||||||
|
this.symbol = '*'; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,12 +1,26 @@ |
|||||||
using System; |
using System; |
||||||
|
using System.Collections.Generic; |
||||||
namespace theGame |
namespace theGame |
||||||
{ |
{ |
||||||
public class PlayerCraft : Item |
public class PlayerCraft : Item |
||||||
{ |
{ |
||||||
int Health; |
public int Health; |
||||||
|
|
||||||
public PlayerCraft() |
public PlayerCraft() |
||||||
{ |
{ |
||||||
Health = 100; |
this.Health = 100; |
||||||
|
|
||||||
|
// _ |
||||||
|
// \___\_> |
||||||
|
|
||||||
|
this.points = new List<ItemPoint>(); |
||||||
|
this.points.Add(new ItemPoint() { relativeCordX = 0, relativeCordY = 0, symbol = '>' }); |
||||||
|
this.points.Add(new ItemPoint() { relativeCordX = -1, relativeCordY = 0, symbol = '_' }); |
||||||
|
this.points.Add(new ItemPoint() { relativeCordX = -2, relativeCordY = 0, symbol = '\\' }); |
||||||
|
this.points.Add(new ItemPoint() { relativeCordX = -3, relativeCordY = 0, symbol = '_' }); |
||||||
|
this.points.Add(new ItemPoint() { relativeCordX = -4, relativeCordY = 0, symbol = '_' }); |
||||||
|
this.points.Add(new ItemPoint() { relativeCordX = -5, relativeCordY = 0, symbol = '\\' }); |
||||||
|
this.points.Add(new ItemPoint() { relativeCordX = -6, relativeCordY = -1, symbol = '_' }); |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue