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
dbd944a9
Commit
dbd944a9
authored
Jun 06, 2015
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make aim direction independent of localScale
parent
f4e923ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
PlayerControl.cs
Assets/Scripts/PlayerControl.cs
+16
-3
No files found.
Assets/Scripts/PlayerControl.cs
View file @
dbd944a9
...
...
@@ -96,6 +96,7 @@ public class PlayerControl : MonoBehaviour
velocity
.
y
=
0
;
updateDashDirection
();
updateAimDirection
();
if
(
canDash
()
&&
inputMapping
.
isDashPressed
())
{
...
...
@@ -242,6 +243,7 @@ public class PlayerControl : MonoBehaviour
private
int
powerUpType
=
POWERUP_NONE
;
private
bool
coolingDown
=
false
;
private
float
aimDirection
=
1.0f
;
public
float
coolDownTime
=
2.0f
;
...
...
@@ -258,17 +260,28 @@ public class PlayerControl : MonoBehaviour
}
private
void
updateAimDirection
()
{
if
(
inputMapping
.
isRightPressed
())
{
aimDirection
=
1.0f
;
}
else
if
(
inputMapping
.
isLeftPressed
())
{
aimDirection
=
-
1.0f
;
}
}
private
void
shoot
()
{
float
dir
=
-
Mathf
.
Sign
(
transform
.
localScale
.
x
);
Vector2
pos
=
((
Vector2
)
transform
.
position
)
+
new
Vector2
(
dir
*
spawnDistance
,
bulletYOffset
);
Vector2
pos
=
((
Vector2
)
transform
.
position
)
+
new
Vector2
(
aimDirection
*
spawnDistance
,
bulletYOffset
);
switch
(
powerUpType
)
{
case
POWERUP_HEALINGBULLET
:
GameObject
bullet
=
Instantiate
(
healingBulletPrefab
,
pos
,
transform
.
rotation
)
as
GameObject
;
bullet
.
transform
.
parent
=
deleteAllChildrenAtRestart
;
bullet
.
GetComponent
<
Bullet
>().
shoot
(
new
Vector2
(
dir
,
0
));
bullet
.
GetComponent
<
Bullet
>().
shoot
(
new
Vector2
(
aimDirection
,
0
));
break
;
default
:
break
;
...
...
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