0% found this document useful (0 votes)
105 views13 pages

Week 6 Pass Task 5.1

Uploaded by

annabel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views13 pages

Week 6 Pass Task 5.1

Uploaded by

annabel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

SWE20001 DP1 (100083700)

Week 5 Pass Task 5.1


Pass Task 5.1 Battleship Project Meeting

I have conducted a second meeting for the Battleship Project. My


group members have completed their tasks that have assigned to
them in the previous week respectively. In the following week, tasks
involved will be following up the tasks that have not been completed
from the past week. In the end, an updated meeting agenda and
meeting minutes have been created. Both the agenda and meeting
minutes are attached below.

Meeting Minutes:

Date/Location: 03-OCT-2019, A308


Attendees: Tan Yan Ting, Eric Kong, Ricky Su
Start Time: 3.55PM
End Time: 4.30PM

Decisions
=========
* Update the coding standard on wiki page, [EK], 11-OCT,2019
* Use Slack fully for daily scrum meetings

 What have you done?


 What obstacles have you met?
 What do you plan to do next?

Actions
=======
* Update the coding standard on wiki page --- [EK], 11-OCT,2019
* Implement new features,
1. Level of Difficulty --- [YT], 16-OCT-2019
The difficulty level of the game could be more challenging.
2. Sound effects could be more attractive --- [EK] 16-OCT-2019

1
SWE20001 DP1 (100083700)

The game sound effects could be improved to be more attractive,


to increase the interactivity to be more fun.
3. Background of the game could be change into something brighter
--- [RS] 16-OCT-2019
The background of the game is suggested to be more attractive and
not dull, as players might get bored and no interest to play the
game.

* Fix functional issues, assigned again, 14-OCT-2019


1. Error Message: When press the automatically position for the
ship, it will have error message “There is already a ship at
[2,5]” --- [EK] 16-OCT-2019
2. Position Error: When move the ship to the position that we want,
the ship will go to another position. --- [EK] 16-OCT-2019
3. Score Error: When we quit the game and re-enter the game, all the
previous score lost. --- [YT] 16-OCT-2019
4. Rotation Error: The ship cannot rotate once click the rotate
button. --- [RS] 16-OCT-2019

2
SWE20001 DP1 (100083700)

Meeting Agenda:
Date/Location: 03-OCT-2019 at 15:30 in A308
Information Updates/Reminders
=============================
* The next two weeks are going to be about understanding the code
base so that we can plan for the work to fix and improve it.
* Everyone should be able to use git, github wiki’s and Trello. Ask
for help if that is a problem.
* We will be using toggl.com to keep track of time.
* The Programming Help Desk (Block G Level 9) is available to help us
with programming for this unit.
Decisions Needed
================
* None (only general items requiring Actions this week)
General Items
=============
* Update the coding standard on wiki page
* Implement new features, such increasing level of difficulty,
implement sound effects, and change background of the gameboard.

* Fix functional issues, such as position error of the ship, score


error and rotation error.

3
SWE20001 DP1 (100083700)

In Pass Task 4.1, the files (GameLogic.cs, GameResources.cs and GameState.cs)


had been solved to be able to run. In this week meeting minutes, some bugs had
fixed and implemented an extra feature which is changing the battleship menu
image.

//GameResources.cs file
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using SwinGameSDK;

public static class GameResources


{
private static Dictionary<string, Bitmap> _Images = new Dictionary<string, Bitmap>
();
private static Dictionary<string, Font> _Fonts = new Dictionary<string, Font> ();
private static Dictionary<string, SoundEffect> _Sounds = new Dictionary<string,
SoundEffect> ();

private static Dictionary<string, Music> _Music = new Dictionary<string, Music>


();
private static Bitmap _Background;
private static Bitmap _Animation;
private static Bitmap _LoaderFull;
private static Bitmap _LoaderEmpty;
private static Font _LoadingFont;

private static SoundEffect _StartSound;

private static void LoadFonts()


{
NewFont("ArialLarge", "arial.ttf", 80);
NewFont("Courier", "cour.ttf", 14);
NewFont("CourierSmall", "cour.ttf", 8);
NewFont("Menu", "ffaccess.ttf", 8);
}

private static void LoadImages()


{
//Backgrounds
NewImage("Menu", "main.jpg");
NewImage("Discovery", "discover.jpg");
NewImage("Deploy", "deploy.jpg");

//Deployment
NewImage("LeftRightButton", "deploy_dir_button_horiz.png");
NewImage("UpDownButton", "deploy_dir_button_vert.png");
NewImage("SelectedShip", "deploy_button_hl.png");
NewImage("PlayButton", "deploy_play_button.png");
NewImage("RandomButton", "deploy_randomize_button.png");

//Ships

4
SWE20001 DP1 (100083700)

int i = 0;
for (i = 1; i <= 5; i++) {
NewImage("ShipLR" + i, "ship_deploy_horiz_" + i + ".png");
NewImage("ShipUD" + i, "ship_deploy_vert_" + i + ".png");
}

//Explosions
NewImage("Explosion", "explosion.png");
NewImage("Splash", "splash.png");

private static void LoadSounds()


{
NewSound("Error", "Mummy.wav");
NewSound("Hit", "Metal.wav");
NewSound("Sink", "sink.wav");
NewSound("Siren", "siren.wav");
NewSound("Miss", "watershot.wav");
NewSound("Winner", "winner.wav");
NewSound("Lose", "lose.wav");
}

private static void LoadMusic()


{
NewMusic("Background", "horrordrone.mp3");
}

/// <summary>
/// Gets a Font Loaded in the Resources
/// </summary>
/// <param name="font">Name of Font</param>
/// <returns>The Font Loaded with this Name</returns>

public static Font GameFont(string font)


{
return _Fonts[font];
}

/// <summary>
/// Gets an Image loaded in the Resources
/// </summary>
/// <param name="image">Name of image</param>
/// <returns>The image loaded with this name</returns>

public static Bitmap GameImage(string image)


{
return _Images[image];
}

/// <summary>
/// Gets an sound loaded in the Resources
/// </summary>
/// <param name="sound">Name of sound</param>
/// <returns>The sound with this name</returns>

public static SoundEffect GameSound(string sound)


{

5
SWE20001 DP1 (100083700)

return _Sounds[sound];
}

/// <summary>
/// Gets the music loaded in the Resources
/// </summary>
/// <param name="music">Name of music</param>
/// <returns>The music with this name</returns>

public static Music GameMusic(string music)


{
return _Music[music];
}

/// <summary>
/// The Resources Class stores all of the Games Media Resources, such as Images,
Fonts
/// Sounds, Music.
/// </summary>

public static void LoadResources()


{
int width = 0;
int height = 0;

width = SwinGame.ScreenWidth();
height = SwinGame.ScreenHeight();

SwinGame.ChangeScreenSize(800, 600);

ShowLoadingScreen();

ShowMessage("Loading fonts...", 0);


LoadFonts();
SwinGame.Delay(100);

ShowMessage("Loading images...", 1);


LoadImages();
SwinGame.Delay(100);

ShowMessage("Loading sounds...", 2);


LoadSounds();
SwinGame.Delay(100);

ShowMessage("Loading music...", 3);


LoadMusic();
SwinGame.Delay(100);

SwinGame.Delay(100);
ShowMessage("Game loaded...", 5);
SwinGame.Delay(100);
EndLoadingScreen(width, height);
}

private static void ShowLoadingScreen()


{
_Background = SwinGame.LoadBitmap(SwinGame.PathToResource("SplashBack.png",
ResourceKind.BitmapResource));

6
SWE20001 DP1 (100083700)

SwinGame.DrawBitmap(_Background, 0, 0);
SwinGame.RefreshScreen();
SwinGame.ProcessEvents();

_Animation = SwinGame.LoadBitmap(SwinGame.PathToResource("SwinGameAni.jpg",
ResourceKind.BitmapResource));
_LoadingFont = SwinGame.LoadFont(SwinGame.PathToResource("arial.ttf",
ResourceKind.FontResource), 12);
_StartSound =
Audio.LoadSoundEffect(SwinGame.PathToResource("SwinGameStart.ogg",
ResourceKind.SoundResource));

_LoaderFull =
SwinGame.LoadBitmap(SwinGame.PathToResource("loader_full.png",
ResourceKind.BitmapResource));
_LoaderEmpty =
SwinGame.LoadBitmap(SwinGame.PathToResource("loader_empty.png",
ResourceKind.BitmapResource));

PlaySwinGameIntro();
}

private static void PlaySwinGameIntro()


{
const int ANI_X = 143;
const int ANI_Y = 134;
const int ANI_W = 546;
const int ANI_H = 327;
const int ANI_V_CELL_COUNT = 6;
const int ANI_CELL_COUNT = 11;

Audio.PlaySoundEffect(_StartSound);
SwinGame.Delay(200);

int i = 0;
for (i = 0; i <= ANI_CELL_COUNT - 1; i++) {
SwinGame.DrawBitmap(_Background, 0, 0);
SwinGame.DrawBitmapPart(_Animation, (i / ANI_V_CELL_COUNT) * ANI_W,
(i % ANI_V_CELL_COUNT) * ANI_H, ANI_W, ANI_H, ANI_X, ANI_Y);
SwinGame.Delay(20);
SwinGame.RefreshScreen();
SwinGame.ProcessEvents();
}

SwinGame.Delay(1500);

private static void ShowMessage(string message, int number)


{
const int TX = 310;
const int TY = 493;
const int TW = 200;
const int TH = 25;
const int STEPS = 5;
const int BG_X = 279;
const int BG_Y = 453;

7
SWE20001 DP1 (100083700)

int fullW = 0;

fullW = 260 * number / STEPS;


SwinGame.DrawBitmap(_LoaderEmpty, BG_X, BG_Y);
SwinGame.DrawBitmapPart(_LoaderFull, 0, 0, fullW, 66, BG_X, BG_Y);

SwinGame.DrawTextLines(message, Color.White, Color.Transparent,


_LoadingFont, FontAlignment.AlignCenter, TX, TY, TW, TH);

SwinGame.RefreshScreen();
SwinGame.ProcessEvents();
}

private static void EndLoadingScreen(int width, int height)


{
SwinGame.ProcessEvents();
SwinGame.Delay(500);
SwinGame.ClearScreen();
SwinGame.RefreshScreen();
SwinGame.FreeFont(_LoadingFont);
SwinGame.FreeBitmap(_Background);
SwinGame.FreeBitmap(_Animation);
SwinGame.FreeBitmap(_LoaderEmpty);
SwinGame.FreeBitmap(_LoaderFull);
Audio.FreeSoundEffect(_StartSound);
SwinGame.ChangeScreenSize(width, height);
}

private static void NewFont(string fontName, string filename, int size)


{
_Fonts.Add(fontName, SwinGame.LoadFont(SwinGame.PathToResource(filename,
ResourceKind.FontResource), size));
}

private static void NewImage(string imageName, string filename)


{
_Images.Add(imageName,
SwinGame.LoadBitmap(SwinGame.PathToResource(filename, ResourceKind.BitmapResource)));
}

private static void NewTransparentColorImage(string imageName, string fileName,


Color transColor)
{
_Images.Add(imageName,
SwinGame.LoadBitmap(SwinGame.PathToResource(fileName, ResourceKind.BitmapResource), true,
transColor));
}

private static void NewTransparentColourImage(string imageName, string fileName,


Color transColor)
{
NewTransparentColorImage(imageName, fileName, transColor);
}

private static void NewSound(string soundName, string filename)


{
_Sounds.Add(soundName,
Audio.LoadSoundEffect(SwinGame.PathToResource(filename, ResourceKind.SoundResource)));

8
SWE20001 DP1 (100083700)

private static void NewMusic(string musicName, string filename)


{
_Music.Add(musicName, Audio.LoadMusic(SwinGame.PathToResource(filename,
ResourceKind.SoundResource)));
}

private static void FreeFonts()


{
foreach (Font obj in _Fonts.Values) {
SwinGame.FreeFont(obj);
}
}

private static void FreeImages()


{
foreach (Bitmap obj in _Images.Values) {
SwinGame.FreeBitmap(obj);
}
}

private static void FreeSounds()


{
foreach (SoundEffect obj in _Sounds.Values) {
Audio.FreeSoundEffect(obj);
}
}

private static void FreeMusic()


{
foreach (Music obj in _Music.Values) {
Audio.FreeMusic(obj);
}
}

public static void FreeResources()


{
FreeFonts();
FreeImages();
FreeMusic();
FreeSounds();
SwinGame.ProcessEvents();
}
}

//=======================================================
//Service provided by Telerik (www.telerik.com)
//Conversion powered by NRefactory.
//Twitter: @telerik
//Facebook: facebook.com/telerik
//=======================================================

9
SWE20001 DP1 (100083700)

//GameLogic.cs

using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using SwinGameSDK;
static class GameLogic
{
public static void Main()
{
//Opens a new Graphics Window
SwinGame.OpenGraphicsWindow("Battle Ships", 800, 600);

//Load Resources
GameResources.LoadResources();

SwinGame.PlayMusic(GameResources.GameMusic("Background"));

//Game Loop
do {
GameController.HandleUserInput();
GameController.DrawScreen();
} while (!(SwinGame.WindowCloseRequested() == true |
GameController.CurrentState == GameState.Quitting));

SwinGame.StopMusic();

//Free Resources and Close Audio, to end the program.


GameResources.FreeResources();
}
}

//=======================================================
//Service provided by Telerik (www.telerik.com)
//Conversion powered by NRefactory.
//Twitter: @telerik
//Facebook: facebook.com/telerik
//=======================================================

10
SWE20001 DP1 (100083700)

Figure 1: Slack meeting

Figure 2: Slack meeting

11
SWE20001 DP1 (100083700)

Figure 3: Time used to add extra feature

Extra feature implemented in the screenshot below of GameResources.cs file

Figure 4: Changing menu image

12
SWE20001 DP1 (100083700)

Figure 5: new image inserted

Figure 6: Network graph of commits in github

13

You might also like