Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProgArkProject
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Sixten Müller
ProgArkProject
Commits
077b6894
Commit
077b6894
authored
1 year ago
by
Rebekka Aashaug Stangvik
Browse files
Options
Downloads
Plain Diff
pulled from 2-create-game-model
parents
68fc7867
19905d69
No related branches found
No related tags found
2 merge requests
!22
Resolve "Create game model"
,
!21
Resolve "make setting in "2-create gamemodel"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/src/com/wordbattle/game/controller/GamePlayController.java
+6
-0
6 additions, 0 deletions
...rc/com/wordbattle/game/controller/GamePlayController.java
core/src/com/wordbattle/game/view/GamePlayView.java
+7
-1
7 additions, 1 deletion
core/src/com/wordbattle/game/view/GamePlayView.java
with
13 additions
and
1 deletion
core/src/com/wordbattle/game/controller/GamePlayController.java
+
6
−
0
View file @
077b6894
...
...
@@ -201,9 +201,15 @@ public class GamePlayController {
public
void
update
(
float
dt
)
{
gamePlayView
.
update
(
dt
);
handleInput
();
//Check if gameTimer is up. If so allert database, award player 0 points and go to waitingLobby.
if
(!
gamePlayView
.
isTimerRunning
()){
_FBIC
.
updateFinishedFlag
(
nickname
,
pin
);
state
.
getStateManager
().
setState
(
new
WaitingLobbyState
(
state
.
getStateManager
(),
_FBIC
,
nickname
,
0
,
pin
));
}
}
public
int
calculateScore
(
float
timeLeft
,
float
maxTime
)
{
// Parameters to shape the S-curve
float
steepness
=
10.0f
;
// Change this to make the curve steeper or shallower
...
...
This diff is collapsed.
Click to expand it.
core/src/com/wordbattle/game/view/GamePlayView.java
+
7
−
1
View file @
077b6894
...
...
@@ -102,6 +102,7 @@ public class GamePlayView {
timeLeft
=
0
;
isTimerRunning
=
false
;
// Stop the timer when it reaches 0
// Handle time out logic
}
}
}
...
...
@@ -154,8 +155,9 @@ public class GamePlayView {
letterBounds
[
i
]
=
new
Rectangle
(
x
,
y
-
120
,
120
,
120
);
}
// Draw time
font
.
draw
(
sb
,
"Time: "
+
String
.
format
(
"%
.1f"
,
timeLeft
),
cam
.
viewportWidth
/
2
-
200
,
cam
.
viewportHeight
-
200
);
font
.
draw
(
sb
,
"Time: "
+
String
.
format
(
"%
o"
,
Math
.
round
(
timeLeft
)
)
,
cam
.
viewportWidth
/
2
-
200
,
cam
.
viewportHeight
-
200
);
sb
.
end
();
// End SpriteBatch
...
...
@@ -254,6 +256,10 @@ public class GamePlayView {
isTimerRunning
=
false
;
}
public
boolean
isTimerRunning
()
{
return
isTimerRunning
;
}
public
void
resetTimer
(
float
newTime
)
{
timeLeft
=
newTime
;
}
...
...
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