Hello my dear friend,
I am very new to unity please dont leave it will take just a second.
this is my script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
public Rigidbody2D rb;
public GameObject DaughterR;
public GameObject DaughterL;
public float rspeed = 0.1f;
public float lspeed = 0.1f;
public float Jumpheight = 5f;
public float Jumpdegreeadjustment = 5f;
// Update is called once per frame
void Update()
{
MovementScript();
}
void MovementScript(){
float hDirection = Input.GetAxis("Horizontal");
float vDirection = Input.GetAxis("Vertical");
if(hDirection < 0){
print("hDirection is working in the other direction too boyssssss");
transform.position = Vector3.MoveTowards(transform.position, DaughterL.transform.position, lspeed);
}
if(hDirection > 0){
print("hDirection is working boyssssss");
transform.position = Vector3.MoveTowards(transform.position, DaughterR.transform.position, rspeed);
}
if(vDirection > 0){
print ("vDirection is working too boyssssss");
rb.AddForce(Vector2.up * Jumpheight);
transform.eulerAngles = Vector3.forward * Jumpdegreeadjustment;
}
}
}
My Jump is weird, once I jumped once It never stops, so i fall down slower and stuff.
Is the problem in the code? Is the problem in my unity? What would you suggest? Do you like Orange Juice? I would love an answer, especially for the orange juice question.
xoxo