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
f2431858
Commit
f2431858
authored
Jun 05, 2015
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move player initialization into new method
parent
6f542fd8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
24 deletions
+31
-24
PlayerControl.cs
Assets/Scripts/PlayerControl.cs
+31
-24
No files found.
Assets/Scripts/PlayerControl.cs
View file @
f2431858
...
...
@@ -61,32 +61,39 @@ public class PlayerControl : MonoBehaviour
{
body2D
=
GetComponent
<
Rigidbody2D
>();
switch
(
playerNumber
)
{
case
1
:
keyCodes
[(
int
)
Keys
.
Right
]
=
KeyCode
.
D
;
keyCodes
[(
int
)
Keys
.
Left
]
=
KeyCode
.
A
;
keyCodes
[(
int
)
Keys
.
Up
]
=
KeyCode
.
W
;
keyCodes
[(
int
)
Keys
.
Jump
]
=
keyCodes
[(
int
)
Keys
.
Up
];
keyCodes
[(
int
)
Keys
.
Down
]
=
KeyCode
.
S
;
keyCodes
[(
int
)
Keys
.
Dash
]
=
KeyCode
.
Space
;
keyCodes
[(
int
)
Keys
.
Shoot
]
=
KeyCode
.
LeftShift
;
break
;
init
(
playerNumber
);
}
case
2
:
keyCodes
[(
int
)
Keys
.
Right
]
=
KeyCode
.
RightArrow
;
keyCodes
[(
int
)
Keys
.
Left
]
=
KeyCode
.
LeftArrow
;
keyCodes
[(
int
)
Keys
.
Up
]
=
KeyCode
.
UpArrow
;
keyCodes
[(
int
)
Keys
.
Jump
]
=
keyCodes
[(
int
)
Keys
.
Up
];
keyCodes
[(
int
)
Keys
.
Down
]
=
KeyCode
.
DownArrow
;
keyCodes
[(
int
)
Keys
.
Dash
]
=
KeyCode
.
RightControl
;
keyCodes
[(
int
)
Keys
.
Shoot
]
=
KeyCode
.
RightShift
;
break
;
public
void
init
(
int
playerNumber
)
{
this
.
playerNumber
=
playerNumber
;
default
:
Debug
.
LogError
(
"No keys defined for player number "
+
playerNumber
);
break
;
}
switch
(
playerNumber
)
{
case
1
:
keyCodes
[(
int
)
Keys
.
Right
]
=
KeyCode
.
D
;
keyCodes
[(
int
)
Keys
.
Left
]
=
KeyCode
.
A
;
keyCodes
[(
int
)
Keys
.
Up
]
=
KeyCode
.
W
;
keyCodes
[(
int
)
Keys
.
Jump
]
=
keyCodes
[(
int
)
Keys
.
Up
];
keyCodes
[(
int
)
Keys
.
Down
]
=
KeyCode
.
S
;
keyCodes
[(
int
)
Keys
.
Dash
]
=
KeyCode
.
Space
;
keyCodes
[(
int
)
Keys
.
Shoot
]
=
KeyCode
.
LeftShift
;
break
;
case
2
:
keyCodes
[(
int
)
Keys
.
Right
]
=
KeyCode
.
RightArrow
;
keyCodes
[(
int
)
Keys
.
Left
]
=
KeyCode
.
LeftArrow
;
keyCodes
[(
int
)
Keys
.
Up
]
=
KeyCode
.
UpArrow
;
keyCodes
[(
int
)
Keys
.
Jump
]
=
keyCodes
[(
int
)
Keys
.
Up
];
keyCodes
[(
int
)
Keys
.
Down
]
=
KeyCode
.
DownArrow
;
keyCodes
[(
int
)
Keys
.
Dash
]
=
KeyCode
.
RightControl
;
keyCodes
[(
int
)
Keys
.
Shoot
]
=
KeyCode
.
RightShift
;
break
;
default
:
Debug
.
LogError
(
"No keys defined for player number "
+
playerNumber
);
break
;
}
}
void
OnCollisionEnter2D
(
Collision2D
coll
)
...
...
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