-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.cs
68 lines (67 loc) · 1.55 KB
/
Player.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Space_Invaders_2
{
class Player
{
private int lives;
private int x, y;
public Player()
{
this.lives = 3;
this.x = 10;
this.y = 23;
}
public void Show()
{
if (this.lives > 1)
{
Console.Write("\r" + new string(' ', Console.WindowWidth) + "\r");
Console.SetCursorPosition(this.x, this.y);
Console.Write("W");
}
else
{
while (true)
{
int i;
for (i = 1; i > 100; i += 9)
{
Console.Write("Game over");
}
Console.WriteLine();
}
}
}
public void move(int i)
{
if (this.x >= 3)
{
if (this.x <= 34)
{
this.x += i;
}
else
{
this.x = 34;
}
}
else
{
this.x = 3;
}
}
public void shoot() { }
public int getx()
{
return this.x;
}
public void setx(int x)
{
this.x = x;
}
}
}