Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dyingIsMainstream
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gamejam-gpn15
dyingIsMainstream
Commits
da640815
Commit
da640815
authored
Jun 05, 2015
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only allow a single dash in the air
parent
26ecec69
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
PlayerControl.cs
Assets/Scripts/PlayerControl.cs
+8
-1
No files found.
Assets/Scripts/PlayerControl.cs
View file @
da640815
...
@@ -36,6 +36,8 @@ public class PlayerControl : MonoBehaviour
...
@@ -36,6 +36,8 @@ public class PlayerControl : MonoBehaviour
public
float
dashCollisionCoolDown
=
1.5f
;
public
float
dashCollisionCoolDown
=
1.5f
;
[
HideInInspector
]
[
HideInInspector
]
public
float
currentDashCoolDown
=
0.0f
;
public
float
currentDashCoolDown
=
0.0f
;
[
HideInInspector
]
public
bool
hasLandedSinceLastDash
=
true
;
// public float jumpWaitTime = 2.0;
// public float jumpWaitTime = 2.0;
[
HideInInspector
]
[
HideInInspector
]
...
@@ -109,6 +111,7 @@ public class PlayerControl : MonoBehaviour
...
@@ -109,6 +111,7 @@ public class PlayerControl : MonoBehaviour
lastDashStart
=
Time
.
time
;
lastDashStart
=
Time
.
time
;
currentDashDirection
=
dashDirection
;
currentDashDirection
=
dashDirection
;
currentDashCoolDown
=
dashCoolDown
;
currentDashCoolDown
=
dashCoolDown
;
hasLandedSinceLastDash
=
false
;
}
}
if
(
isDashing
())
if
(
isDashing
())
...
@@ -118,6 +121,10 @@ public class PlayerControl : MonoBehaviour
...
@@ -118,6 +121,10 @@ public class PlayerControl : MonoBehaviour
else
else
{
{
bool
grounded
=
isGrounded
();
bool
grounded
=
isGrounded
();
if
(
grounded
&&
!
isDashing
())
{
hasLandedSinceLastDash
=
true
;
}
velocity
=
body2D
.
velocity
;
velocity
=
body2D
.
velocity
;
if
(
Input
.
GetKey
(
keyCodes
[(
int
)
Keys
.
Right
]))
if
(
Input
.
GetKey
(
keyCodes
[(
int
)
Keys
.
Right
]))
...
@@ -222,7 +229,7 @@ public class PlayerControl : MonoBehaviour
...
@@ -222,7 +229,7 @@ public class PlayerControl : MonoBehaviour
private
bool
canDash
()
private
bool
canDash
()
{
{
return
getDashTime
()
>=
dashCompletionTime
+
currentDashCoolDown
;
return
hasLandedSinceLastDash
&&
getDashTime
()
>=
dashCompletionTime
+
currentDashCoolDown
;
}
}
/*==========Power Ups // Bullet management ===*/
/*==========Power Ups // Bullet management ===*/
...
...
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