C'est encore moi et j'ai un autre problème... Je suis en train de créer un pong pour m'entrainer sur Unity 2D, et je suis bloqué pour faire déplacer mon joueur sur l'axe Y ( un pong quoi). J'ai testé plusieurs code mais aucun ne marche... Le dernier que j'ai essayé est celui-ci :
Code : Tout sélectionner
using UnityEngine;
using System.Collections;
public class PlayerControls : MonoBehaviour {
Vector3 move = new Vector3();
void Update () {
if (Input.GetKey ("up")) {
move.y += 9f;
}
}
}
Code : Tout sélectionner
using UnityEngine;
using System.Collections;
public class PlayerControls : MonoBehaviour {
public float speed = 10;
void Update () {
if (Input.GetKey ("up")) {
transform.position = new Vector2(0f, speed);
}
}
}
Merci d'avance,