Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Blaze-Brigade
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Susan Yuen
Blaze-Brigade
Commits
a88b9723
You need to sign in or sign up before continuing.
Commit
a88b9723
authored
8 years ago
by
Susan Yuen
Browse files
Options
Downloads
Patches
Plain Diff
ANIMATING WORKS!! Game class is now a singleton
parent
db30e3c3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Blaze-Brigade/Blaze_Brigade/Game.cs
+9
-0
9 additions, 0 deletions
src/Blaze-Brigade/Blaze_Brigade/Game.cs
src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs
+13
-10
13 additions, 10 deletions
src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs
with
22 additions
and
10 deletions
src/Blaze-Brigade/Blaze_Brigade/Game.cs
+
9
−
0
View file @
a88b9723
...
...
@@ -26,6 +26,13 @@ namespace Controller
#
region
Variables
static
Game
instance
;
public
static
Game
Instance
{
get
{
return
instance
;
}
}
GameMenuState
currentGameState
=
GameMenuState
.
MainMenu
;
// game starts in main menu screen
MainMenu
mMenu
;
// main menu variable
HowToPlay
tut
;
// instruction screen variable
...
...
@@ -44,6 +51,8 @@ namespace Controller
// constructor for game
public
Game
()
{
instance
=
this
;
graphics
=
new
GraphicsDeviceManager
(
this
);
graphics
.
PreferredBackBufferWidth
=
GameState
.
SCREEN_HEIGHT
;
graphics
.
PreferredBackBufferHeight
=
GameState
.
SCREEN_WIDTH
;
...
...
This diff is collapsed.
Click to expand it.
src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs
+
13
−
10
View file @
a88b9723
...
...
@@ -64,7 +64,11 @@ namespace Controller
// if user clicks on a valid end node, move to it
if
(
turnState
==
TurnState
.
Move
)
{
GameState
.
getSelectedUnit
().
setMenuOpen
(
false
);
// remove drop down menu from screen
// remove drop down menu from screen
GameState
.
getSelectedUnit
().
setMenuOpen
(
false
);
Game
.
Instance
.
Tick
();
// set variables for path finding
Node
startNode
=
graph
.
getNode
(
GameState
.
getSelectedUnit
().
getPosition
());
Node
endNode
=
graph
.
getNode
(
mouseClickCoordinates
);
LinkedList
<
Node
>
path
=
GameFunction
.
pathFinder
(
graph
,
GameState
.
getSelectedUnit
(),
startNode
,
endNode
);
...
...
@@ -74,6 +78,7 @@ namespace Controller
{
updateUnitPosition
(
mouseClickCoordinates
,
path
);
}
GameState
.
getSelectedUnit
().
setMenuOpen
(
true
);
// opens drop down menu on screen again
setSelectedUnit
(
null
,
false
);
// unselect the unit
turnState
=
TurnState
.
Wait
;
...
...
@@ -128,15 +133,13 @@ namespace Controller
{
Unit
unit
=
GameState
.
getSelectedUnit
();
// TODO: CALL ANIMATION FUNCTION HERE TO ANIMATE UNIT
// Use path to determine which nodes to move to
//foreach (Node node in path)
//{
// unit.setPosition(node.getPositionX(), node.getPositionY());
//}
// moves the unit to end node
unit
.
setPosition
(
path
.
Last
().
getPositionX
(),
path
.
Last
().
getPositionY
());
// updates the unit's position to each node in the path (node by node)
foreach
(
Node
node
in
path
)
{
unit
.
setPosition
(
node
.
getPositionX
(),
node
.
getPositionY
());
Game
.
Instance
.
Tick
();
Thread
.
Sleep
(
100
);
}
}
// returns a menu button that was clicked; if no menu button was clicked, returns null
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment