Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jay reich sprint1 #91

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d9ba35a
This is a test to make sure that my gitbash is working properly
BlueJayBird11 Oct 15, 2023
880f397
Update README.md
BlueJayBird11 Oct 15, 2023
53e6e29
Added the virual function for character death in Battle Character
njahn88 Oct 18, 2023
775d9f3
Added logic to run Die methods from FrmBattle.cs
njahn88 Oct 18, 2023
3b41695
Removed Implementation until further understanding
njahn88 Oct 18, 2023
8438388
Fully implemented removal of enemy from world after being defeated
njahn88 Oct 18, 2023
e435a89
player.ResetMoveSpeed();
njahn88 Oct 18, 2023
14dc664
first try at fixing movement issues
njahn88 Oct 18, 2023
7afcea6
Added class file for DialogueBox
BlueJayBird11 Oct 18, 2023
1c23c96
Merge branch 'main' of https://github.com/BlueJayBird11/Fall2023_CSC4…
BlueJayBird11 Oct 18, 2023
139af22
This is a test
BlueJayBird11 Oct 18, 2023
4b486c6
Removed temp.txt
BlueJayBird11 Oct 18, 2023
7a5bc20
Created as test file
jojotheboomboy Oct 18, 2023
89bea1d
Merge pull request #1 from jojotheboomboy/main
BlueJayBird11 Oct 18, 2023
d748738
Delete Test.txt
BlueJayBird11 Oct 18, 2023
ec22054
Create Ethan-Test-File.txt
eespeed Oct 18, 2023
57d9c5a
Merge pull request #2 from eespeed/main
eespeed Oct 18, 2023
dd5ed32
Finished implementation of new movement system
njahn88 Oct 18, 2023
f7a822e
Added dialogue_box image to data directory, currently a error with di…
BlueJayBird11 Oct 18, 2023
10b9c76
Added hide/show functionality for dialogueBox as well as a temporary …
BlueJayBird11 Oct 18, 2023
37590da
Added label that will display text, label also has hide/show functions
BlueJayBird11 Oct 19, 2023
86a3cca
DialogueText is now able to be displayed at a specified speed in mill…
BlueJayBird11 Oct 19, 2023
f9e527b
Delete Ethan-Test-File.txt
eespeed Oct 20, 2023
bea584e
Added the ability to click to go to next line and box closes when lin…
BlueJayBird11 Oct 22, 2023
d57bf4c
Added Dialogue class
BlueJayBird11 Oct 22, 2023
1d2e7f4
Added health bar to main screen
eespeed Oct 22, 2023
96e8cc6
Added Overworld and battle music
jojotheboomboy Oct 23, 2023
3846878
Added more Dialogue in FrmLevel.cs
BlueJayBird11 Oct 23, 2023
668709c
Added to Dialogue class and FrmLevel
BlueJayBird11 Oct 25, 2023
dc89da6
Merge pull request #4 from BlueJayBird11/JosiahNorman_Sprint1
jojotheboomboy Oct 25, 2023
d3e763d
Merge branch 'main' into EthanJoyce_Sprint1
jojotheboomboy Oct 25, 2023
599777d
Merge pull request #3 from BlueJayBird11/EthanJoyce_Sprint1
jojotheboomboy Oct 25, 2023
fe55cfe
Quick Fix for Merge Conflict Issue
jojotheboomboy Oct 25, 2023
e2a56a1
Added Dialogue for Enemies
BlueJayBird11 Oct 25, 2023
1e86558
Minor Comments
BlueJayBird11 Oct 25, 2023
72d5ca9
Fixed Bug
BlueJayBird11 Oct 27, 2023
45e7040
Fixed bug
BlueJayBird11 Oct 27, 2023
8f4b686
Small fixes
BlueJayBird11 Oct 27, 2023
e2ab5f8
Changed Dialogue Font Size
BlueJayBird11 Oct 27, 2023
229faaf
Bug Fixes, Space Press
BlueJayBird11 Oct 27, 2023
ac64221
Merge branch 'main' into JayReich_Sprint1
BlueJayBird11 Oct 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,18 @@
</ItemGroup>
<ItemGroup>
<Folder Include="code\" />
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyGameLibrary\MyGameLibrary.csproj">
<Project>{F1E60F80-1868-4FE5-991B-FDDCFAF9B16B}</Project>
<Name>MyGameLibrary</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="data\dialogueBox.jpg" />
<None Include="Resources\dialogue_box.bmp" />
<Content Include="data\battle_music.wav" />
<Content Include="data\overworld_music.wav" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
4 changes: 2 additions & 2 deletions Project/Fall2020_CSC403_Project/FrmBattle.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

198 changes: 114 additions & 84 deletions Project/Fall2020_CSC403_Project/FrmBattle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,90 +3,120 @@
using System;
using System.Drawing;
using System.Media;
using System.Security.Principal;
using System.Windows.Forms;

namespace Fall2020_CSC403_Project {
public partial class FrmBattle : Form {
public static FrmBattle instance = null;
private Enemy enemy;
private Player player;

private FrmBattle() {
InitializeComponent();
player = Game.player;
}

public void Setup() {
// update for this enemy
picEnemy.BackgroundImage = enemy.Img;
picEnemy.Refresh();
BackColor = enemy.Color;
picBossBattle.Visible = false;

// Observer pattern
enemy.AttackEvent += PlayerDamage;
player.AttackEvent += EnemyDamage;

// show health
UpdateHealthBars();
}

public void SetupForBossBattle() {
picBossBattle.Location = Point.Empty;
picBossBattle.Size = ClientSize;
picBossBattle.Visible = true;

SoundPlayer simpleSound = new SoundPlayer(Resources.final_battle);
simpleSound.Play();

tmrFinalBattle.Enabled = true;
}

public static FrmBattle GetInstance(Enemy enemy) {
if (instance == null) {
instance = new FrmBattle();
instance.enemy = enemy;
instance.Setup();
}
return instance;
}

private void UpdateHealthBars() {
float playerHealthPer = player.Health / (float)player.MaxHealth;
float enemyHealthPer = enemy.Health / (float)enemy.MaxHealth;

const int MAX_HEALTHBAR_WIDTH = 226;
lblPlayerHealthFull.Width = (int)(MAX_HEALTHBAR_WIDTH * playerHealthPer);
lblEnemyHealthFull.Width = (int)(MAX_HEALTHBAR_WIDTH * enemyHealthPer);

lblPlayerHealthFull.Text = player.Health.ToString();
lblEnemyHealthFull.Text = enemy.Health.ToString();
}

private void btnAttack_Click(object sender, EventArgs e) {
player.OnAttack(-4);
if (enemy.Health > 0) {
enemy.OnAttack(-2);
}

UpdateHealthBars();
if (player.Health <= 0 || enemy.Health <= 0) {
instance = null;
Close();
}
}

private void EnemyDamage(int amount) {
enemy.AlterHealth(amount);
}

private void PlayerDamage(int amount) {
player.AlterHealth(amount);
}

private void tmrFinalBattle_Tick(object sender, EventArgs e) {
picBossBattle.Visible = false;
tmrFinalBattle.Enabled = false;
using System.Xml.Schema;

namespace Fall2020_CSC403_Project
{
public partial class FrmBattle : Form
{
public static FrmBattle instance = null;
private Enemy enemy;
private AudioManager audioManager;
private Player player;

private FrmBattle()
{
InitializeComponent();
player = Game.player;
audioManager = AudioManager.Instance;
audioManager.AddSound("final_battle", new SoundPlayer(Resources.final_battle));
audioManager.AddSound("battle_music", new SoundPlayer(Resources.battle_music));
audioManager.AddSound("overworld_music", new SoundPlayer(Resources.overworld_music));
}

public void Setup()
{
audioManager.PlaySoundLoop("battle_music");
// update for this enemy
picEnemy.BackgroundImage = enemy.Img;
picEnemy.Refresh();
BackColor = enemy.Color;
picBossBattle.Visible = false;

// Observer pattern
enemy.AttackEvent += PlayerDamage;
player.AttackEvent += EnemyDamage;

// show health
UpdateHealthBars();
}

public void SetupForBossBattle()
{
picBossBattle.Location = Point.Empty;
picBossBattle.Size = ClientSize;
picBossBattle.Visible = true;
tmrFinalBattle.Enabled = true;
audioManager.PlaySound("battle_music");
}

public static FrmBattle GetInstance(Enemy enemy)
{
if (instance == null)
{
instance = new FrmBattle();
instance.enemy = enemy;
instance.Setup();
}
return instance;
}

private void UpdateHealthBars()
{
float playerHealthPer = player.Health / (float)player.MaxHealth;
float enemyHealthPer = enemy.Health / (float)enemy.MaxHealth;

const int MAX_HEALTHBAR_WIDTH = 226;
lblPlayerHealthFull.Width = (int)(MAX_HEALTHBAR_WIDTH * playerHealthPer);
lblEnemyHealthFull.Width = (int)(MAX_HEALTHBAR_WIDTH * enemyHealthPer);

lblPlayerHealthFull.Text = player.Health.ToString();
lblEnemyHealthFull.Text = enemy.Health.ToString();
}

private void btnAttack_Click(object sender, EventArgs e)
{
player.OnAttack(-4);
if (enemy.Health > 0)
{
enemy.OnAttack(-2);
}

UpdateHealthBars();
if (enemy.Health <= 0)
{
enemy.Die();
instance = null;
audioManager.StopSound("battle_music");
Close();
audioManager.PlaySoundLoop("overworld_music");
}
else if (player.Health <= 0)
{
player.Die();
instance = null;
audioManager.StopSound("battle_music");
Close();
audioManager.PlaySoundLoop("overworld_music");
}
}

private void EnemyDamage(int amount)
{
enemy.AlterHealth(amount);
}

private void PlayerDamage(int amount)
{
player.AlterHealth(amount);
}

private void tmrFinalBattle_Tick(object sender, EventArgs e)
{
picBossBattle.Visible = false;
tmrFinalBattle.Enabled = false;
}
}
}
}
Loading