コード例 #1
0
ファイル: Player.cs プロジェクト: coler706/CaveStory
 public Player(ContentManager Content, ParticleTools particleTools, GameUnit x, GameUnit y)
     : base(CollisionType.StickyCollision)
 {
     sprites = new Dictionary<SpriteState, Sprite>();
     InitializeSprites(Content);
     this.particleTools = particleTools;
     kinematicsX = new Kinematics(x, 0);
     kinematicsY = new Kinematics(y, 0);
     accelerationX = 0;
     horizontalFacing = SpriteState.HorizontalFacing.Left;
     intendedVerticalFacing = SpriteState.VerticalFacing.Horizontal;
     walkingAnimation = new WalkingAnimation();
     maybeGroundTile = null;
     jumpActive = false;
     playerHealth = new PlayerHealth(Content);
     interacting = false;
     invincibleTimer = new Timer(InvincibleTime);
     damageText = new FloatingNumber(Content, FloatingNumber.NumberType.Damage);
     experienceText = new FloatingNumber(Content, FloatingNumber.NumberType.Experience);
     gunExperienceHud = new GunExperienceHud(Content);
     polarStar = new PolarStar(Content);
     collisionRectangle = new CompositeCollisionRectangle(new Rectangle((int)Math.Round(CollisionTopLeft), (int)Math.Round(CollisionYTop),
         (int)Math.Round(CollisionTopWidth), (int)Math.Round(CollisionYHeight / 2)),
         new Rectangle((int)Math.Round(CollisionBottomLeft), (int)Math.Round(CollisionYTop + CollisionYHeight / 2),
         (int)Math.Round(CollisionBottomWidth), (int)Math.Round(CollisionYHeight / 2)),
         new Rectangle(6, 10, 10, 12),
         new Rectangle(16, 10, 10, 12));
 }
コード例 #2
0
ファイル: Health.cs プロジェクト: coler706/CaveStory
 public Health(ContentManager Content)
 {
     damage = 0;
     damageTimer = new Timer(PlayerHealth.DamageDelay);
     maxHealth = 6;
     currentHealth = 6;
 }
コード例 #3
0
ファイル: FloatingNumber.cs プロジェクト: coler706/CaveStory
 public FloatingNumber(ContentManager Content, NumberType type)
 {
     this.Content = Content;
     shouldRise = true;
     timer = new Timer(DamageTime);
     this.type = type;
     offsetY = 0;
     val = 0;
     centerX = 0;
     centerY = 0;
 }
コード例 #4
0
 public PowerDoritoPickup(ContentManager Content, GameUnit centerX, GameUnit centerY, SizeType size)
     : base(CollisionType.BouncingCollision)
 {
     kinematicsX = new Kinematics(centerX - Units.HalfTile, (Game1.Random.Next(0, 11) - 5) * 0.025f);
     kinematicsY = new Kinematics(centerY - Units.HalfTile, (Game1.Random.Next(0, 11) - 5) * 0.025f);
     sprite = new AnimatedSprite(Content, SpriteName,
         Units.TileToPixel(SourceX), Units.TileToPixel(SourceYs[(int)size]),
         Units.TileToPixel(SourceWidth), Units.TileToPixel(SourceHeight),
         Fps, NumFrames);
     this.size = size;
     timer = new Timer(LifeTime, true);
 }
コード例 #5
0
ファイル: AnimatedSprite.cs プロジェクト: coler706/CaveStory
 public AnimatedSprite(ContentManager Content,
     string fileName,
     PixelUnit sourceX, PixelUnit sourceY,
     PixelUnit width, PixelUnit height,
     int fps, FrameUnit numberOfFrames)
     : base(Content, fileName, sourceX, sourceY, width, height)
 {
     frameTimer = new Timer(TimeSpan.FromMilliseconds(1000 / fps));
     this.numberOfFrames = numberOfFrames;
     currentFrame = 0;
     numCompletedLoops = 0;
 }
コード例 #6
0
 public HeadBumpParticle(ContentManager Content,
     GameUnit centerX, GameUnit centerY)
 {
     this.centerX = centerX;
     this.centerY = centerY;
     sprite = new Sprite(Content, "Caret",
         Units.GameToPixel(SourceX), Units.GameToPixel(SourceY),
         Units.GameToPixel(Width), Units.GameToPixel(Height));
     timer = new Timer(LifeTime, true);
     particleA = new PolarVector(0, Game1.Random.Next(0, 360));
     maxOffsetA = 4 + Game1.Random.Next(0, 16);
     particleB = new PolarVector(0, Game1.Random.Next(0, 360));
     maxOffsetB = 4 + Game1.Random.Next(0, 16);
 }
コード例 #7
0
 public GunExperienceHud(ContentManager Content)
 {
     experienceBarSprite = new Sprite(Content, SpriteName,
         Units.GameToPixel(ExperienceBarSourceX), Units.GameToPixel(ExperienceBarSourceY),
         Units.GameToPixel(ExperienceBarSourceWidth), Units.GameToPixel(ExperienceBarSourceHeight));
     levelSprite = new Sprite(Content, SpriteName,
         Units.TileToPixel(LevelSourceX), Units.GameToPixel(LevelSourceY),
         Units.TileToPixel(LevelSourceWidth), Units.GameToPixel(LevelSourceHeight));
     flashSprite = new Sprite(Content, SpriteName,
         Units.GameToPixel(FlashSourceX), Units.TileToPixel(FlashSourceY),
         Units.GameToPixel(ExperienceBarSourceWidth), Units.GameToPixel(ExperienceBarSourceHeight));
     fillSprite = new VaryingWidthSprite(Content, SpriteName,
         Units.TileToPixel(FillSourceX), Units.TileToPixel(FillSourceY),
         Units.GameToPixel(ExperienceBarSourceWidth), 0,
         Units.GameToPixel(ExperienceBarSourceHeight));
     maxSprite = new Sprite(Content, SpriteName,
         Units.GameToPixel(MaxSourceX), Units.GameToPixel(MaxSourceY),
         Units.GameToPixel(ExperienceBarSourceWidth), Units.GameToPixel(ExperienceBarSourceHeight));
     flashTimer = new Timer(FlashTime);
     number = NumberSprite.HudNumber(Content, 0, 2);
 }
コード例 #8
0
ファイル: FlashingPickup.cs プロジェクト: coler706/CaveStory
 private FlashingPickup(ContentManager Content,
     GameUnit centerX, GameUnit centerY,
     TileUnit sourceX, TileUnit sourceY,
     Rectangle rectangle,
     int value, Pickup.PickupType type)
 {
     sprite = new Sprite(Content, SpriteName,
         Units.TileToPixel(sourceX), Units.TileToPixel(sourceY),
         Units.TileToPixel(1), Units.TileToPixel(1));
     flashSprite = new Sprite(Content, SpriteName,
         Units.TileToPixel(sourceX + 1), Units.TileToPixel(sourceY),
         Units.TileToPixel(1), Units.TileToPixel(1));
     dissipatingSprite = new Sprite(Content, SpriteName,
         Units.TileToPixel(DissipatingSourceX), Units.TileToPixel(DissipatingSourceY),
         Units.TileToPixel(1), Units.TileToPixel(1));
     x = centerX - Units.HalfTile;
     y = centerY - Units.HalfTile;
     timer = new Timer(LifeTime, true);
     flashPeriod = StartPeriod;
     this.rectangle = rectangle;
     this.value = value;
     this.type = type;
 }
コード例 #9
0
ファイル: Player.cs プロジェクト: coler706/CaveStory
 public WalkingAnimation()
 {
     frameTimer = new Timer(TimeSpan.FromMilliseconds(1000 / WalkFps));
     currentFrame = 0;
     forward = true;
 }