Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Birb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gadig
Birb
Commits
ab2ad127
Commit
ab2ad127
authored
Feb 23, 2017
by
Jordan B Mckenney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit to pull from master
parent
06d1a132
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
Assets/Scripts/Player/Walk.cs
Assets/Scripts/Player/Walk.cs
+14
-3
No files found.
Assets/Scripts/Player/Walk.cs
View file @
ab2ad127
...
...
@@ -9,6 +9,12 @@ public class Walk : AbstractBehavior {
private
float
xScale
;
private
int
rightInt
=
0
;
private
int
leftInt
=
0
;
private
float
rightTime
=
0
;
private
float
leftTime
=
0
;
// Use this for initialization
void
Start
()
{
xScale
=
body
.
transform
.
localScale
.
x
;
...
...
@@ -19,8 +25,10 @@ public class Walk : AbstractBehavior {
Buttons
left
=
inputButtons
[
0
];
Buttons
right
=
inputButtons
[
1
];
int
rightInt
=
0
;
int
leftInt
=
0
;
rightInt
=
0
;
leftInt
=
0
;
//rightTime = inputButtons[0].
if
(
inputState
.
GetButtonValue
(
right
))
rightInt
=
1
;
...
...
@@ -35,7 +43,7 @@ public class Walk : AbstractBehavior {
if
(
collisionState
.
onGround
)
{
body
.
velocity
=
new
Vector2
(
speed
*
(
rightInt
+
leftInt
),
body
.
velocity
.
y
);
}
else
}
else
if
(!
collisionState
.
onWall
)
{
airSpeed
=
body
.
velocity
.
x
;
if
(
inputState
.
GetButtonValue
(
right
)
||
inputState
.
GetButtonValue
(
left
))
...
...
@@ -51,6 +59,9 @@ public class Walk : AbstractBehavior {
}
}
body
.
velocity
=
new
Vector2
(
airSpeed
,
body
.
velocity
.
y
);
}
else
{
}
//change localScale depending on direction
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment