fratalkanan
Femtopat
- Katılım
- 9 Eylül 2023
- Mesajlar
- 7
Daha fazla
- Cinsiyet
- Erkek
Arkadaşlar o kadar kod yazdım ettim. Ancak CS1002 expected diyor kodlar burada yardım.
Kod:
Using System. Collections;
Using System. Collections. Generic;
Using unityengine;
Public class top: Monobehaviour.
{
Public rigidbody2D rb;
Public float hiz;
Public float gol_1, gol_2;
Public textmeshpro gol1, gol2;
// Start is called before the first frame Update.
Void Start()
{
Hiz = 180F;
}
// Update is called once per frame.
Void Update()
{
}
Public Void oncollisionstay2D(collision2D temas) {
İf(temas. Gameobject. Tag =="oyuncu2") {
İf(ınput. Getkey(keycode. K)){
İf(ınput. Getkey(keycode. Uparrow)){
Rb. Addforce(Vector2.up * hiz);
}
İf(ınput. Getkey(keycode. Downarrow)){
Rb. Addforce(Vector2.down * hiz);
}
İf(ınput. Getkey(keycode. Rightarrow)){
Rb. Addforce(Vector2.right * hiz);
}
İf(ınput. Getkey(keycode. Leftarrow)){
Rb. Addforce(Vector2.left * hiz);
}
}
}
İf(temas. Gameobject. Tag =="oyuncu1") {
İf(ınput. Getkey(keycode. Space)){
İf(ınput. Getkey(keycode. W)){
Rb. Addforce(Vector2.up * hiz);
}
İf(ınput. Getkey(keycode. S)){
Rb. Addforce(Vector2.down * hiz);
}
İf(ınput. Getkey(keycode. D)){
Rb. Addforce(Vector2.right * hiz);
}
İf(ınput. Getkey(keycode. A)){
Rb. Addforce(Vector2.left * hiz);
}
}
}
}
Public Void oncollisionenter2D(collision2D kale_gol){
İf(kale_gol. Gameobject. Tag=="kale1"){
Gol_1 += 1;
Gol2.text = gol_1 ToString();
}
}