Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TDT4240 Tank Wars
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
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
Snorre Skjellestad Kristiansen
TDT4240 Tank Wars
Merge requests
!11
Tank collision
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Tank collision
move_tank
into
main
Overview
0
Commits
5
Pipelines
2
Changes
2
Merged
Magnus Segtnan Skjølberg
requested to merge
move_tank
into
main
2 years ago
Overview
0
Commits
5
Pipelines
2
Changes
2
Expand
0
0
Merge request reports
Compare
main
version 1
94a5efdd
2 years ago
main (base)
and
latest version
latest version
6d63ea25
5 commits,
2 years ago
version 1
94a5efdd
4 commits,
2 years ago
2 files
+
10
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
frontend/core/src/com/game/tankwars/model/Tank.java
+
8
−
0
Options
package
com.game.tankwars.model
;
import
com.badlogic.gdx.Gdx
;
import
com.badlogic.gdx.graphics.Texture
;
import
com.badlogic.gdx.math.Rectangle
;
import
com.badlogic.gdx.math.Vector2
;
@@ -55,5 +56,12 @@ public class Tank {
position
.
x
-=
TANK_MOVESPEED
;
}
public
boolean
detectCollisionLeft
()
{
return
position
.
x
<
0
;
}
public
boolean
detectCollisionRight
()
{
return
Gdx
.
graphics
.
getWidth
()
/
2.0f
-
bounds
.
getWidth
()
/
2.0f
-
50
<
position
.
x
;
}
}
Loading