28-03-2019, Saat: 15:24
(Son Düzenleme: 28-03-2019, Saat: 15:34, Düzenleyen: Cem.
Sebep: Yazım hatası.
)
Kod:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
Rigidbody2D physic;
Vector3 vec;
float horizontal = 0;
bool onceJump = true;
void Start()
{
physic = GetComponent<Rigidbody2D>();
}
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
if (onceJump)
{
physic.AddForce(new Vector2(0, 500));
onceJump = false;
}
}
}
void FixedUpdate()
{
characterMoving();
}
void characterMoving()
{
horizontal = Input.GetAxisRaw("Horizontal");
vec = new Vector3(horizontal * 10, physic.velocity.y, 0);
physic.velocity = vec;
}
void OnCollisionEnter2D(Collision2D col)
{
onceJump = true;
}
}
Arkadaşlar Merhaba.
Ben Unity'de programlamada yeniyim de bir sorunumu çözemedim.
Top rampadan aşağı inerken lacivert noktada zıplayıp turuncu çizgideki gibi gitmesini istiyordum. Fakat yeşil çizginin doğrultusunda gidiyor.
Nasıl lacivert noktada topu zıplatıp sonra turuncu çizgi üzerinden gidebilir top?