Commit 10e1d148 by Alisa Jung
parents e8a6f296 840d7973
fileFormatVersion: 2 fileFormatVersion: 2
guid: 561019a7f49ce2d40b44edc6a0980c4a guid: 75ab554038a08ae479d95e7be9fcd332
timeCreated: 1433442216 timeCreated: 1433442334
licenseType: Free licenseType: Free
NativeFormatImporter: NativeFormatImporter:
userData: userData:
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: fabe126e7eaf2e14fb0f3cd99ea811f1 guid: fabe126e7eaf2e14fb0f3cd99ea811f1
timeCreated: 1433438084 timeCreated: 1433442353
licenseType: Free licenseType: Free
NativeFormatImporter: NativeFormatImporter:
userData: userData:
......
...@@ -24,11 +24,33 @@ public class PlayerControl : MonoBehaviour ...@@ -24,11 +24,33 @@ public class PlayerControl : MonoBehaviour
[HideInInspector] [HideInInspector]
public Vector3 velocity; public Vector3 velocity;
public int playerNumber = 1; //gibt an, ob es sich um player one, player two, etc. handelt. sollte nicht 0 sein;
KeyCode goRightKeyCode, goLeftKeyCode, jumpKeyCode;
void Awake() void Start()
{ {
_controller = GetComponent<CharacterController2D>(); _controller = GetComponent<CharacterController2D>();
_controller.onControllerCollidedEvent += onControllerCollider; _controller.onControllerCollidedEvent += onControllerCollider;
switch (playerNumber)
{
case 1:
setKeyCodes(KeyCode.D,KeyCode.A,KeyCode.W);
break;
case 2:
setKeyCodes(KeyCode.RightArrow, KeyCode.LeftArrow, KeyCode.UpArrow);
break;
//TODO player 3 and 4
default:
break;
}
}
private void setKeyCodes(KeyCode right, KeyCode left, KeyCode up)
{
goRightKeyCode = right;
goLeftKeyCode = left;
jumpKeyCode = up;
} }
...@@ -51,7 +73,8 @@ public class PlayerControl : MonoBehaviour ...@@ -51,7 +73,8 @@ public class PlayerControl : MonoBehaviour
if (_controller.isGrounded) if (_controller.isGrounded)
velocity.y = 0; velocity.y = 0;
if (Input.GetKey(KeyCode.RightArrow))
if (Input.GetKey(goRightKeyCode))
{ {
normalizedHorizontalSpeed = 1; normalizedHorizontalSpeed = 1;
if (transform.localScale.x < 0f) if (transform.localScale.x < 0f)
...@@ -59,7 +82,7 @@ public class PlayerControl : MonoBehaviour ...@@ -59,7 +82,7 @@ public class PlayerControl : MonoBehaviour
//if (_controller.isGrounded) //if (_controller.isGrounded)
} }
else if (Input.GetKey(KeyCode.LeftArrow)) else if (Input.GetKey(goLeftKeyCode))
{ {
normalizedHorizontalSpeed = -1; normalizedHorizontalSpeed = -1;
if (transform.localScale.x > 0f) if (transform.localScale.x > 0f)
...@@ -75,7 +98,7 @@ public class PlayerControl : MonoBehaviour ...@@ -75,7 +98,7 @@ public class PlayerControl : MonoBehaviour
} }
if (Input.GetKeyDown(KeyCode.UpArrow)) if (Input.GetKeyDown(jumpKeyCode))
{ {
//to avoid DOUBLE JUMP //to avoid DOUBLE JUMP
if (_controller.isGrounded) if (_controller.isGrounded)
......
...@@ -30,7 +30,7 @@ TextureImporter: ...@@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048 maxTextureSize: 2048
textureSettings: textureSettings:
filterMode: -1 filterMode: -1
aniso: -1 aniso: 16
mipBias: -1 mipBias: -1
wrapMode: 1 wrapMode: 1
nPOTScale: 0 nPOTScale: 0
...@@ -43,7 +43,7 @@ TextureImporter: ...@@ -43,7 +43,7 @@ TextureImporter:
alignment: 0 alignment: 0
spritePivot: {x: .5, y: .5} spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100 spritePixelsToUnits: 400
alphaIsTransparency: 1 alphaIsTransparency: 1
textureType: 8 textureType: 8
buildTargetSettings: [] buildTargetSettings: []
......
...@@ -30,7 +30,7 @@ TextureImporter: ...@@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048 maxTextureSize: 2048
textureSettings: textureSettings:
filterMode: -1 filterMode: -1
aniso: -1 aniso: 16
mipBias: -1 mipBias: -1
wrapMode: 1 wrapMode: 1
nPOTScale: 0 nPOTScale: 0
...@@ -43,7 +43,7 @@ TextureImporter: ...@@ -43,7 +43,7 @@ TextureImporter:
alignment: 0 alignment: 0
spritePivot: {x: .5, y: .5} spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100 spritePixelsToUnits: 400
alphaIsTransparency: 1 alphaIsTransparency: 1
textureType: 8 textureType: 8
buildTargetSettings: [] buildTargetSettings: []
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment