okay so, i’m following a 1 because i’m doing the same project for my exam next week, and i can’t seem to make the platform move as it should.
here’s what i’ve got:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class plataformaascendente : MonoBehaviour
{
float velocidadPlataforma = 2;
bool puntoLLegada;
float puntoPartida;
float puntoLLegadaY;
public int unidadesaMover;
// Use this for initialization
void Start()
{
puntoPartida = transform.position.y ;
puntoLLegadaY = puntoPartida + unidadesaMover;
}
// Update is called once per frame
void Update()
{
if (puntoLLegada)
{
transform.position += Vector3.up * velocidadPlataforma * Time.deltaTime;
}
else
{
transform.position -= Vector3.up * velocidadPlataforma * Time.deltaTime;
}
if (transform.position.y >= puntoLLegadaY)
{
puntoLLegada = false;
}
if (transform.position.y <= puntoLLegadaY)
{
puntoLLegada = true;
}
}
}
again, i’m sorry about the spanish, and thanks for taking the time to read through this!