new file: Assets/Animations/Jump0.anim

new file:   Assets/Animations/Jump0.anim.meta
	renamed:    Assets/Sprites/Shooting.anim -> Assets/Animations/Shooting.anim
	renamed:    Assets/Sprites/Shooting.anim.meta -> Assets/Animations/Shooting.anim.meta
	modified:   Assets/Animations/megaman.controller
	modified:   Assets/Scenes/XavierScene.unity
	modified:   Assets/Scripts/Animations.cs
	modified:   Assets/Scripts/Control.cs
	modified:   Assets/Scripts/Gravity.cs
	modified:   Assets/Scripts/Jump.cs
	new file:   Assets/Scripts/MainCamera.cs
	new file:   Assets/Scripts/MainCamera.cs.meta
	modified:   Assets/Sprites/mm.png.meta
	modified:   ProjectSettings/TagManager.asset
This commit is contained in:
Xavier314 2015-11-07 20:35:49 -05:00
parent b3732e2aab
commit a201fdc345
14 changed files with 142 additions and 86 deletions

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a078ad8c97314a34d9ecd3e37dae2156
timeCreated: 1446945210
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Binary file not shown.

View File

@ -4,8 +4,10 @@ using System.Collections;
public class Animations : MonoBehaviour {
private Animator anim;
private bool isShooting;
// Use this for initialization
void Start () {
@ -31,10 +33,13 @@ public class Animations : MonoBehaviour {
isShooting = false;
} // if
anim.SetFloat("SpeedX", Mathf.Abs(mouvementX));
anim.SetBool("isShooting", isShooting);
}
}

View File

@ -5,12 +5,17 @@ public class Control : MonoBehaviour {
public Transform thingsToMove;
public int speed;
public float speed;
private int eulerAngle;
// Use this for initialization
void Start () {
}
eulerAngle = 0;
}
// Update is called once per frame
void Update () {
@ -18,20 +23,11 @@ public class Control : MonoBehaviour {
float mouvement = Input.GetAxis ("Horizontal");
/*
if ( mouvement!= 0)
{
thingsToMove.Translate(new Vector2(mouvement * speed, 0));
}
*/
// aller vers la gauche
if (mouvement > 0.0)
{
thingsToMove.Translate(new Vector2(mouvement * speed, 0));
transform.eulerAngles = new Vector2(0, 0);
thingsToMove.Translate(new Vector2(mouvement * speed, 0)); // bouger le player
eulerAngle = 0;
} // if
@ -40,11 +36,11 @@ public class Control : MonoBehaviour {
if (mouvement < 0.0)
{
thingsToMove.Translate(new Vector2(-(mouvement * speed), 0));
transform.eulerAngles = new Vector2(0, 180);
thingsToMove.Translate(new Vector2(-(mouvement * speed), 0)); // bouger le player
eulerAngle = 180;
} // if
transform.eulerAngles = new Vector3(0, eulerAngle, 0); // gauche = sprite effet miroir, droite = sprite normal
}
}

View File

@ -4,6 +4,7 @@ using System.Collections;
public class Gravity : MonoBehaviour {
public Character player;
void Start()
{
player = new Character(1, 10, 10, false);

View File

@ -3,34 +3,58 @@ using System.Collections;
public class Jump : MonoBehaviour {
public int timeJump;
public Rigidbody2D player; // le player
public float playerSpeedY; // la vitesse de saut
private bool isOnGround; // somme nous sur le sol?
public Transform player;
private bool isJumping;
// Use this for initialization
void Start () {
isJumping = false;
timeJump = 0;
isOnGround = false;
}
// Update is called once per frame
void Update () {
if (Input.GetButton("Fire1") && isJumping == false)
if (Input.GetButton("Fire1") && isOnGround == true)
{
timeJump = 10;
isJumping = true;
player.velocity = new Vector2(player.velocity.x, playerSpeedY);
}
if (timeJump > 0) {
player.Translate(0, 0.4f, 0);
timeJump--;
}
else
{
isJumping = false;
}
}
void OnTriggerStay2D(Collider2D other)
{
if (other.gameObject.tag == "Floor")
{
isOnGround = true;
}
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.tag == "Floor")
{
isOnGround = true;
}
}
void OnTriggerExit2D(Collider2D other)
{
if (other.gameObject.tag == "Floor")
{
isOnGround = false;
}
}
}

View File

@ -0,0 +1,29 @@
using UnityEngine;
using System.Collections;
public class MainCamera : MonoBehaviour {
// le player
public Rigidbody2D player;
private float positionPlayerX; // position du player en X
private float positionPlayerY; // // position du player en Y
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
// definir la position du player
positionPlayerX = player.GetComponent<Rigidbody2D>().position.x;
positionPlayerY = player.GetComponent<Rigidbody2D>().position.y;
// ajuster la camera selon la position du player
transform.position = new Vector3(positionPlayerX, positionPlayerY + 3.5F, -10);
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c729e4edf3bf65d4fa14333e02f090e0
timeCreated: 1446932586
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 14370da66867eeb479e470bd4bb068f7
timeCreated: 1446690230
timeCreated: 1446945412
licenseType: Free
TextureImporter:
fileIDToRecycleName:
@ -22,6 +22,7 @@ TextureImporter:
21300030: Jumping3
21300032: Jumping4
21300034: Shooting
21300036: Jump3
serializedVersion: 2
mipmaps:
mipMapMode: 0
@ -148,56 +149,6 @@ TextureImporter:
alignment: 0
pivot: {x: .5, y: .5}
border: {x: 0, y: 0, z: 0, w: 0}
- name: Jumping0
rect:
serializedVersion: 2
x: 261
y: 13
width: 16
height: 24
alignment: 0
pivot: {x: .5, y: .5}
border: {x: 0, y: 0, z: 0, w: 0}
- name: Jumping1
rect:
serializedVersion: 2
x: 313
y: 13
width: 12
height: 24
alignment: 0
pivot: {x: .5, y: .5}
border: {x: 0, y: 0, z: 0, w: 0}
- name: Jumping2
rect:
serializedVersion: 2
x: 361
y: 13
width: 17
height: 24
alignment: 0
pivot: {x: .5, y: .5}
border: {x: 0, y: 0, z: 0, w: 0}
- name: Jumping3
rect:
serializedVersion: 2
x: 408
y: 13
width: 21
height: 24
alignment: 0
pivot: {x: .5, y: .5}
border: {x: 0, y: 0, z: 0, w: 0}
- name: Jumping4
rect:
serializedVersion: 2
x: 458
y: 13
width: 21
height: 24
alignment: 0
pivot: {x: .5, y: .5}
border: {x: 0, y: 0, z: 0, w: 0}
- name: Shooting
rect:
serializedVersion: 2
@ -208,6 +159,36 @@ TextureImporter:
alignment: 0
pivot: {x: .5, y: .5}
border: {x: 0, y: 0, z: 0, w: 0}
- name: Jump0
rect:
serializedVersion: 2
x: 357
y: 107
width: 25
height: 30
alignment: 0
pivot: {x: .5, y: .5}
border: {x: 0, y: 0, z: 0, w: 0}
- name: Jump1
rect:
serializedVersion: 2
x: 412
y: 123
width: 16
height: 17
alignment: 0
pivot: {x: .5, y: .5}
border: {x: 0, y: 0, z: 0, w: 0}
- name: Jump3
rect:
serializedVersion: 2
x: 461
y: 112
width: 16
height: 22
alignment: 0
pivot: {x: .5, y: .5}
border: {x: 0, y: 0, z: 0, w: 0}
spritePackingTag:
userData:
assetBundleName:

Binary file not shown.