-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.cs
More file actions
41 lines (34 loc) · 1.02 KB
/
Player.cs
File metadata and controls
41 lines (34 loc) · 1.02 KB
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
using System;
using System.Drawing; // Bitmap, Graphics,GraphicsUnit, Rectangle
class Player : Unit
{
static Bitmap[] sBM = { new Bitmap( "player.png" ), new Bitmap( "player2.png" ) };
static Rectangle sRect = new Rectangle( 0, 0, 8, 8 );
public int mType;
public Player( int type ) : base( 0.5f, 14.5f, 1.0f / 16, 0 )
{
mType = type;
}
public void draw( Graphics g )
{
sRect.X = ( (int)( mX * 8 ) & 1 ) * DOT;
sRect.Y = Math.Sign( mDX ) * DTH + DTH;
g.DrawImage( sBM[ mType ], mX * DOT - DTH, mY * DOT - DTH, sRect, GraphicsUnit.Pixel );
}
public void jump()
{
if( mGround ){ // 接地中の場合
jump( -7.0f / 16 );
}
}
public override void step()
{
base.step();
if( mX <= 0.5f || mX >= 14.5f ){
mDX = Math.Sign( Map.sMap.GetLength( 1 ) / 2 - mX ) / 16.0f;
}
if( mY < 1 ){
JumpAct3.sStageClear = true;
}
}
}