using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class TOP : MonoBehaviour
{
public Rigidbody2D rb;
public float hiz;
public float gol_1,gol_2;
public Text gol1,gol2;
// Start is called before the first frame update
void Start()
{
hiz = 180f;
gol_1=0;
gol_2=0;
}
// Update is called once per frame
void Update()
{
}
public void OnCollisionStay2D(Collision2D temas) {
if(temas.gameObject.tag =="Oyuncu2") {
if(Input.GetKey(KeyCode.K)){
if(Input.GetKey(KeyCode.UpArrow)){
rb.AddForce(Vector2.up * hiz);
}
if(Input.GetKey(KeyCode.DownArrow)){
rb.AddForce(Vector2.down * hiz);
}
if(Input.GetKey(KeyCode.RightArrow)){
rb.AddForce(Vector2.right * hiz);
}
if(Input.GetKey(KeyCode.LeftArrow)){
rb.AddForce(Vector2.left * hiz);
}
}
}
if(temas.gameObject.tag =="Oyuncu1") {
if(Input.GetKey(KeyCode.Space)){
if(Input.GetKey(KeyCode.W)){
rb.AddForce(Vector2.up * hiz);
}
if(Input.GetKey(KeyCode.S)){
rb.AddForce(Vector2.down * hiz);
}
if(Input.GetKey(KeyCode.D)){
rb.AddForce(Vector2.right * hiz);
}
if(Input.GetKey(KeyCode.A)){
rb.AddForce(Vector2.left * hiz);
}
}
}
}
public void OnCollisionEnter2D(Collision2D kale_gol){
if(kale_gol.gameObject.tag=="Kale1"){
gol_1 += 1;
gol2.text = gol_1.ToString();
}
}
}