Skip to content

Commit 8bbc701

Browse files
committed
Finished help menu, add slime, slime movements, scorebar and timebar
1 parent 156bb9a commit 8bbc701

39 files changed

+888
-184
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

CYPVP/.vs/CYPVP/v17/.suo

8.5 KB
Binary file not shown.

CYPVP/CYPVP.csproj

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
</ItemGroup>
4848
<ItemGroup>
4949
<Compile Include="AudioManager.cs" />
50+
<Compile Include="Character.cs" />
5051
<Compile Include="Form1.cs">
5152
<SubType>Form</SubType>
5253
</Compile>
@@ -70,6 +71,7 @@
7071
<Compile Include="MainMenu.cs" />
7172
<Compile Include="Program.cs" />
7273
<Compile Include="Properties\AssemblyInfo.cs" />
74+
<Compile Include="Slime.cs" />
7375
<EmbeddedResource Include="Form1.resx">
7476
<DependentUpon>Form1.cs</DependentUpon>
7577
</EmbeddedResource>
@@ -80,7 +82,7 @@
8082
<DependentUpon>HelpWindow.cs</DependentUpon>
8183
</EmbeddedResource>
8284
<EmbeddedResource Include="Properties\Resources.resx">
83-
<Generator>ResXFileCodeGenerator</Generator>
85+
<Generator>PublicResXFileCodeGenerator</Generator>
8486
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
8587
<SubType>Designer</SubType>
8688
</EmbeddedResource>
@@ -201,5 +203,29 @@
201203
<ItemGroup>
202204
<None Include="assets\player_movements\up\up_standing.png" />
203205
</ItemGroup>
206+
<ItemGroup>
207+
<None Include="Resources\slime.gif" />
208+
</ItemGroup>
209+
<ItemGroup>
210+
<None Include="Resources\slime_left.gif" />
211+
</ItemGroup>
212+
<ItemGroup>
213+
<None Include="Resources\slime_right.gif" />
214+
</ItemGroup>
215+
<ItemGroup>
216+
<None Include="Resources\1_statusbar.png" />
217+
</ItemGroup>
218+
<ItemGroup>
219+
<None Include="Resources\2_statusbar.png" />
220+
</ItemGroup>
221+
<ItemGroup>
222+
<None Include="Resources\3_statusbar.png" />
223+
</ItemGroup>
224+
<ItemGroup>
225+
<None Include="Resources\4_statusbar.png" />
226+
</ItemGroup>
227+
<ItemGroup>
228+
<None Include="Resources\5_statusbar.png" />
229+
</ItemGroup>
204230
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
205231
</Project>

CYPVP/Character.cs

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Drawing;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using System.Windows.Forms;
8+
9+
namespace CYPVP
10+
{
11+
public class Character
12+
{
13+
public PictureBox CharacterSkin { get; set; }
14+
public bool CanMoveUp { get; set; }
15+
public bool CanMoveDown { get; set; }
16+
public bool CanMoveRight { get; set; }
17+
public bool CanMoveLeft { get; set; }
18+
public Character(PictureBox Character)
19+
{
20+
CharacterSkin = Character;
21+
CharacterSkin.BackColor = Color.Transparent;
22+
}
23+
public void Move(String Position,int Speed,int Height,int Width,int x,int y)
24+
{
25+
26+
27+
28+
if (Position == "UP")
29+
{
30+
int NewPosition = CharacterSkin.Location.Y - Speed;
31+
if (NewPosition >= 40)
32+
{
33+
34+
35+
CharacterSkin.Location = new Point(CharacterSkin.Location.X, NewPosition);
36+
37+
38+
}
39+
40+
}
41+
else if (Position == "DOWN")
42+
{
43+
int NewPosition = CharacterSkin.Location.Y + Speed;
44+
if (NewPosition < Height - 100)
45+
{
46+
47+
CharacterSkin.Location = new Point(CharacterSkin.Location.X, NewPosition);
48+
49+
50+
}
51+
52+
}
53+
else if (Position == "RIGHT")
54+
{
55+
int NewPosition = CharacterSkin.Location.X + Speed;
56+
if (NewPosition < Width - 70)
57+
{
58+
59+
CharacterSkin.Location = new Point(NewPosition, CharacterSkin.Location.Y);
60+
61+
62+
}
63+
64+
}
65+
else if (Position == "LEFT")
66+
{
67+
int NewPosition = CharacterSkin.Location.X - Speed;
68+
if (NewPosition >= 10)
69+
{
70+
71+
CharacterSkin.Location = new Point(NewPosition, CharacterSkin.Location.Y);
72+
73+
74+
75+
}
76+
}
77+
78+
79+
80+
}
81+
public bool Check()
82+
{
83+
return CanMoveDown == false && CanMoveUp == false && CanMoveLeft == false && CanMoveRight == false;
84+
}
85+
}
86+
}

CYPVP/Game.cs

Lines changed: 26 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -9,63 +9,44 @@ namespace CYPVP
99
{
1010
public class Game
1111
{
12-
public bool CanMoveUp { get; set; }
13-
public bool CanMoveDown { get; set; }
14-
public bool CanMoveRight { get; set; }
15-
public bool CanMoveLeft { get; set; }
16-
public int NewPosition { get; set; }
17-
public int Height { get; set; }
18-
public int Width { get; set; }
19-
public Game(int height,int width) {
20-
CanMoveDown = false;
21-
CanMoveLeft = false;
22-
CanMoveRight=false;
23-
CanMoveUp = false;
24-
Height=height;
25-
Width=width;
12+
public Character MainCharacter { get; set; }
13+
14+
public Slime MainSlime { get; set; }
15+
public int Score { get; set; }
16+
public int Time { get; set; }
17+
18+
19+
20+
public Game(int height,int width,PictureBox mainCharacter,PictureBox mainSlime) {
21+
MainCharacter = new Character(mainCharacter);
22+
MainSlime=new Slime(mainSlime);
23+
Time = 90;
24+
Score = 0;
2625
}
27-
public void MoveCharachter(PictureBox Charachter,string Position,int Speed)
26+
27+
internal void MoveCharacter(int Height,int Width)
2828
{
29-
if (Position == "UP")
29+
if (MainCharacter.CanMoveUp)
3030
{
31-
NewPosition = Charachter.Location.Y - Speed;
32-
if (NewPosition >= 40)
33-
{
34-
Charachter.Location = new Point(Charachter.Location.X, NewPosition);
35-
}
36-
31+
MainCharacter.Move("UP", 15, Height, Width,MainSlime.SlimeSkin.Location.X, MainSlime.SlimeSkin.Location.Y);
3732
}
38-
else if(Position == "DOWN")
33+
else if (MainCharacter.CanMoveDown)
3934
{
40-
NewPosition = Charachter.Location.Y + Speed;
41-
if (NewPosition < Height-100)
42-
{
43-
Charachter.Location = new Point(Charachter.Location.X, NewPosition);
44-
}
45-
35+
MainCharacter.Move("DOWN", 15, Height, Width, MainSlime.SlimeSkin.Location.X, MainSlime.SlimeSkin.Location.Y);
4636
}
47-
else if(Position == "RIGHT")
37+
else if (MainCharacter.CanMoveLeft)
4838
{
49-
NewPosition = Charachter.Location.X + Speed;
50-
if(NewPosition < Width-70)
51-
{
52-
Charachter.Location = new Point(NewPosition, Charachter.Location.Y);
53-
}
54-
39+
MainCharacter.Move("LEFT", 15, Height, Width, MainSlime.SlimeSkin.Location.X, MainSlime.SlimeSkin.Location.Y);
5540
}
56-
else if(Position == "LEFT")
41+
else if (MainCharacter.CanMoveRight)
5742
{
58-
NewPosition = Charachter.Location.X - Speed;
59-
if (NewPosition >= 10)
60-
{
61-
Charachter.Location = new Point(NewPosition, Charachter.Location.Y);
62-
63-
}
43+
MainCharacter.Move("RIGHT", 15, Height, Width, MainSlime.SlimeSkin.Location.X, MainSlime.SlimeSkin.Location.Y);
6444
}
6545
}
66-
public bool Check()
46+
47+
internal void MoveSlime()
6748
{
68-
return CanMoveDown == false && CanMoveUp == false && CanMoveLeft == false && CanMoveRight == false;
49+
MainSlime.Move((int)MainCharacter.CharacterSkin.Location.X, (int)MainCharacter.CharacterSkin.Location.Y);
6950
}
7051
}
7152
}

CYPVP/GameWindow.Designer.cs

Lines changed: 71 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)