Skip to content

Commit

Permalink
Mainly bug fixes
Browse files Browse the repository at this point in the history
- Tweak some keybindings to resemble the original game's
  - A: attack
  - S: jump
  - Up + A: use subweapon
- Tweak whip position relative to simon at frame 02 of attack animation (since commit 5a52a32)
- Tweak item and powerup bounding box so that player can easily skip that object by jumping over it
- Powerup items are now affected by gravity: the longer the powerup falls the bigger vy is
- Fix simon's speed in go-to-castle cutscene is not restored again after moving to great hall map
- Fix menu screen and gameover screen not drawing at all when changing from gameplay screen abruptly via devtool shortcuts
- Fix money bag text effect diseappear too soon
- Fix cross effect make dead enemies spawn items continously
  • Loading branch information
NearHuscarl committed Jan 5, 2019
1 parent e5a16bd commit 30eef2d
Show file tree
Hide file tree
Showing 30 changed files with 226 additions and 69 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ A remake of Castlevania NES (Block 01) written in C++ and directx 9

## Controls

| Key | Command |
|----------------|----------------------|
| <kbd>←</kbd> | Walk left |
| <kbd>→</kbd> | Walk right |
| <kbd>↑</kbd> | Go upstairs |
| <kbd>↓</kbd> | Go downstairs / Duck |
| <kbd>z</kbd> | Attack |
| <kbd>x</kbd> | Jump |
| <kbd>c</kbd> | Use subweapon |
| <kbd>Esc</kbd> | Toggle devtool |
| Key | Command |
|-----------------------------|----------------------|
| <kbd>←</kbd> | Walk left |
| <kbd>→</kbd> | Walk right |
| <kbd>↑</kbd> | Go upstairs |
| <kbd>↓</kbd> | Go downstairs / Duck |
| <kbd>a</kbd> | Attack |
| <kbd>s</kbd> | Jump |
| <kbd></kbd> + <kbd>a</kbd> | Use subweapon |
| <kbd>Esc</kbd> | Toggle devtool |

### Devtool Control

Expand Down
12 changes: 12 additions & 0 deletions src/GameCuaTao/Castlevania/Content/Items/Axe.atlas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>

<GameContent>

<Spritesheet TexturePath="Axe.png">
<Sprite ID="axe">
<SpriteFrame Left="0" Top="0" Width="30" Height="28" />
<SpriteBoundary Left="12" Top="2" Width="6" Height="26" />
</Sprite>
</Spritesheet>

</GameContent>
12 changes: 12 additions & 0 deletions src/GameCuaTao/Castlevania/Content/Items/Cross.atlas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>

<GameContent>

<Spritesheet TexturePath="Cross.png">
<Sprite ID="cross">
<SpriteFrame Left="0" Top="0" Width="32" Height="32" />
<SpriteBoundary Left="6" Top="6" Width="20" Height="26" />
</Sprite>
</Spritesheet>

</GameContent>
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<Spritesheet TexturePath="Crystal_Ball.png">
<Sprite ID="flash_01">
<SpriteFrame Left="0" Top="0" Width="28" Height="32" />
<SpriteBoundary Left="3" Top="3" Width="22" Height="26" />
<SpriteBoundary Left="2" Top="8" Width="24" Height="24" />
</Sprite>

<Sprite ID="flash_02">
<SpriteFrame Left="28" Top="0" Width="28" Height="32" />
<SpriteBoundary Left="31" Top="3" Width="22" Height="26" />
<SpriteBoundary Left="30" Top="8" Width="24" Height="24" />
</Sprite>
</Spritesheet>

Expand Down
12 changes: 12 additions & 0 deletions src/GameCuaTao/Castlevania/Content/Items/Dagger.atlas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>

<GameContent>

<Spritesheet TexturePath="Dagger.png">
<Sprite ID="dagger">
<SpriteFrame Left="0" Top="0" Width="32" Height="18" />
<SpriteBoundary Left="12" Top="0" Width="8" Height="18" />
</Sprite>
</Spritesheet>

</GameContent>
12 changes: 12 additions & 0 deletions src/GameCuaTao/Castlevania/Content/Items/Double_Shot.atlas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>

<GameContent>

<Spritesheet TexturePath="Double_Shot.png">
<Sprite ID="double_shot">
<SpriteFrame Left="0" Top="0" Width="28" Height="28" />
<SpriteBoundary Left="6" Top="4" Width="16" Height="24" />
</Sprite>
</Spritesheet>

</GameContent>
12 changes: 12 additions & 0 deletions src/GameCuaTao/Castlevania/Content/Items/Holy_Water.atlas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>

<GameContent>

<Spritesheet TexturePath="Holy_Water.png">
<Sprite ID="holy_water">
<SpriteFrame Left="0" Top="0" Width="32" Height="32" />
<SpriteBoundary Left="8" Top="6" Width="12" Height="26" />
</Sprite>
</Spritesheet>

</GameContent>
12 changes: 12 additions & 0 deletions src/GameCuaTao/Castlevania/Content/Items/Invisible_Jar.atlas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>

<GameContent>

<Spritesheet TexturePath="Invisible_Jar.png">
<Sprite ID="invisible_jar">
<SpriteFrame Left="0" Top="0" Width="29" Height="36" />
<SpriteBoundary Left="7" Top="9" Width="11" Height="27" />
</Sprite>
</Spritesheet>

</GameContent>
12 changes: 12 additions & 0 deletions src/GameCuaTao/Castlevania/Content/Items/Large_Heart.atlas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>

<GameContent>

<Spritesheet TexturePath="Large_Heart.png">
<Sprite ID="large_heart">
<SpriteFrame Left="0" Top="0" Width="24" Height="20" />
<SpriteBoundary Left="7" Top="0" Width="10" Height="20" />
</Sprite>
</Spritesheet>

</GameContent>
3 changes: 3 additions & 0 deletions src/GameCuaTao/Castlevania/Content/Items/Money_Bag.atlas.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
<Spritesheet TexturePath="Money_Bag.png">
<Sprite ID="money_bag_red">
<SpriteFrame Left="0" Top="0" Width="30" Height="30" />
<SpriteBoundary Left="8" Top="8" Width="12" Height="22" />
</Sprite>

<Sprite ID="money_bag_blue">
<SpriteFrame Left="31" Top="0" Width="30" Height="30" />
<SpriteBoundary Left="39" Top="8" Width="12" Height="22" />
</Sprite>

<Sprite ID="money_bag_white">
<SpriteFrame Left="62" Top="0" Width="30" Height="30" />
<SpriteBoundary Left="70" Top="8" Width="12" Height="22" />
</Sprite>
</Spritesheet>

Expand Down
12 changes: 12 additions & 0 deletions src/GameCuaTao/Castlevania/Content/Items/Stopwatch.atlas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>

<GameContent>

<Spritesheet TexturePath="Stopwatch.png">
<Sprite ID="stopwatch">
<SpriteFrame Left="0" Top="0" Width="30" Height="32" />
<SpriteBoundary Left="16" Top="6" Width="2" Height="26" />
</Sprite>
</Spritesheet>

</GameContent>
12 changes: 12 additions & 0 deletions src/GameCuaTao/Castlevania/Content/Items/Whip_Powerup.atlas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>

<GameContent>

<Spritesheet TexturePath="Whip_Powerup.png">
<Sprite ID="whip_powerup">
<SpriteFrame Left="0" Top="0" Width="32" Height="32" />
<SpriteBoundary Left="8" Top="6" Width="16" Height="26" />
</Sprite>
</Spritesheet>

</GameContent>
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<property name="Facing" value="Right"/>
</properties>
</object>
<object id="47" name="Entrypoint1" type="Position" gid="4" x="1021" y="288" width="60" height="66">
<object id="47" name="Entrypoint1" type="Position" gid="4" x="1281" y="288" width="60" height="66">
<properties>
<property name="Facing" value="Right"/>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ void Enemy::TakeDamage(int damage)

void Enemy::Die()
{
if (state == ObjectState::DYING)
return;

SetState(ObjectState::DYING);
body.Enabled(false);
Detach<IMovementSystem>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void Fishman::Shoot(std::unique_ptr<RangedWeapon> fireball)
void Fishman::Freeze()
{
velocity = Vector2::Zero();
SetDistance(Vector2::Zero());
SetDistance_Y(0);
SetFishmanState(FishmanState::FALLING);
}

Expand Down
34 changes: 22 additions & 12 deletions src/GameCuaTao/Castlevania/Models/Characters/Player/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,52 +28,52 @@ void Controller::OnKeyDown(int keyCode)
case MoveState::IDLE:
if (keyCode == Button::Jump)
player.Jump();
else if (PressSubweaponKeys(keyCode))
UseSubweapon();
else if (keyCode == Button::Attack)
player.Attack();
else if (keyCode == Button::Throw)
UseSubweapon();
break;

case MoveState::WALKING:
if (IsHoldingLeftAndRight())
player.Idle();
else if (PressSubweaponKeys(keyCode))
UseSubweapon();
else if (keyCode == Button::Jump)
player.Jump();
else if (keyCode == Button::Duck)
player.Duck();
else if (keyCode == Button::Attack)
player.Attack();
else if (keyCode == Button::Throw)
UseSubweapon();
break;

case MoveState::IDLE_UPSTAIRS:
case MoveState::IDLE_DOWNSTAIRS:
if (keyCode == Button::Attack)
player.Attack();
else if (keyCode == Button::Throw)
if (PressSubweaponKeys(keyCode))
UseSubweapon();
else if (keyCode == Button::Attack)
player.Attack();
break;

case MoveState::JUMPING:
case MoveState::HOVERING:
case MoveState::FALLING:
case MoveState::LANDING:
if (keyCode == Button::Attack)
player.Attack();
else if (keyCode == Button::Throw)
if (PressSubweaponKeys(keyCode))
UseSubweapon();
else if (keyCode == Button::Attack)
player.Attack();
break;

case MoveState::DUCKING:
if (keyCode == Button::WalkLeft)
player.SetFacing(Facing::Left);
else if (keyCode == Button::WalkRight)
player.SetFacing(Facing::Right);
else if (PressSubweaponKeys(keyCode))
UseSubweapon();
else if (keyCode == Button::Attack)
player.Attack();
else if (keyCode == Button::Throw)
UseSubweapon();
break;
}
}
Expand Down Expand Up @@ -148,6 +148,16 @@ bool Controller::IsHoldingUpAndDown()
return keyboardState.IsKeyDown(Button::Duck) && keyboardState.IsKeyDown(Button::GoUpstair);
}

bool Controller::PressSubweaponKeys(int keyCode)
{
if (keyCode == Button::Attack)
{
if (keyboardState.IsKeyDown(Button::GoUpstair))
return true;
}
return false;
}

void Controller::UseSubweapon()
{
auto weaponItem = player.GetSubWeapon();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace Castlevania
bool IsHoldingLeftAndRight();
bool IsHoldingUpAndDown();

bool PressSubweaponKeys(int keyCode);
void UseSubweapon();
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ void Player::Stoptime()
if (isStopwatchActive)
return;

data.hearts -= 5;
data.hearts = MathHelper::Max(data.hearts - 5, 0);
Notify(STOPWATCH_POWERUP_ACTIVATED);

if (data.hearts == 0)
Expand Down
Loading

0 comments on commit 30eef2d

Please sign in to comment.