fakewarder
Centipat
- Katılım
- 2 Temmuz 2022
- Mesajlar
- 153
- Çözümler
- 1
Daha fazla
- Cinsiyet
- Erkek
Using System. Collections;
Using System. Collections. Generic;
Using unityengine;
Public class movement: Monobehaviour
{
Rigidbody2D RB;
Private float horizontal;
Public float Speed;
Bool jump;
Public float jumpforce;
Bool turnright = true;
Vector3 scale;
Void Start()
{
RB = gameObject.GetComponent<Rigidbody2D>();
}
Void FixedUpdate()
{
Horizontal = ınput. Getaxisraw("horizontal");
RB. Velocity = New Vector2(horizontal * Speed [I]250[/I] time. Deltatime, RB. Velocity. Y);
İf (ınput. Getkeydown(keycode. Space)&&jump ==true)
{
RB. Addforce(New Vector2(0, jumpforce));
Jump = false;
}
İf (horizontal <0 turnright == true)
(
Çevir();
)
İf (horizontal> 0 && turnright == false)
(
Çevir();
)
}
Private Void oncollisionenter2D(collision2D collision)
{
İf (collision. Gameobject. Tag =="platform")
{
Jump = true;
}
}
Void Çevir()
(
Turnright =!turnright;
Scale = gameobject. Transform. Localscale;
Scale. X = scale. X* -1;
Gameobject. Transform. Localscale= scale;
)
}
Kodlar bunlar ama ben ne yaptıysam düzeltemedim.