mirror of
https://github.com/ConjureETS/Labo_2_Equ_1_a15.git
synced 2026-03-24 10:01:00 +00:00
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
47 lines
973 B
C#
47 lines
973 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class Control : MonoBehaviour {
|
|
|
|
|
|
public Transform thingsToMove;
|
|
|
|
public float speed;
|
|
|
|
private int eulerAngle;
|
|
|
|
// Use this for initialization
|
|
void Start () {
|
|
|
|
eulerAngle = 0;
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update () {
|
|
|
|
float mouvement = Input.GetAxis ("Horizontal");
|
|
|
|
|
|
// aller vers la gauche
|
|
if (mouvement > 0.0)
|
|
{
|
|
thingsToMove.Translate(new Vector2(mouvement * speed, 0)); // bouger le player
|
|
eulerAngle = 0;
|
|
|
|
} // if
|
|
|
|
|
|
// aller vers la droite
|
|
if (mouvement < 0.0)
|
|
{
|
|
|
|
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
|
|
}
|
|
}
|