Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asteroids
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hexboard-games
asteroids
Commits
09073852
Commit
09073852
authored
9 years ago
by
Joseph Walton-Rivers
Browse files
Options
Downloads
Patches
Plain Diff
clamed speed to prevent ship from accerlating infinately
parent
51911457
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/battle/NeuroShip.java
+9
-1
9 additions, 1 deletion
src/battle/NeuroShip.java
with
9 additions
and
1 deletion
src/battle/NeuroShip.java
+
9
−
1
View file @
09073852
...
...
@@ -25,9 +25,10 @@ public class NeuroShip extends GameObject {
// define how quickly the ship will rotate
static
double
steerStep
=
10
*
Math
.
PI
/
180
;
static
double
maxSpeed
=
3
;
// this is the friction that makes the ship slow down over time
static
double
loss
=
0.99
5
;
static
double
loss
=
0.99
;
double
releaseVelocity
=
0
;
double
minVelocity
=
2
;
...
...
@@ -109,8 +110,15 @@ public class NeuroShip extends GameObject {
v
.
y
+=
gravity
;
// v.x = 0.5;
v
.
mul
(
loss
);
// This is fairly basic, but it'll do for now...
v
.
x
=
clamp
(
v
.
x
,
-
maxSpeed
,
maxSpeed
);
v
.
y
=
clamp
(
v
.
y
,
-
maxSpeed
,
maxSpeed
);
s
.
add
(
v
);
System
.
out
.
println
(
v
);
return
this
;
}
...
...
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