Adım 3: Boşluk çubuğuna basmayı test edin

Artık PlayerController.cs'e atanmış bir mermi hazır yapımız olduğuna göre, oyuncunun onu boşluk çubuğuyla başlatması için bir yola ihtiyacı var.

PlayerController.cs içinde, Update() metodunda, boşluk çubuğuna basmak için bir if ifadesi denetimi ekleyin:

  • if (Input.GetKeyDown(KeyCode.Space)) {
  • if ifadesinin içine, yapmanız gerektiğini söyleyen bir yorum ekleyin // Oyuncudan bir mermi fırlatın

figures

Alt text: Flavour

Lesson discussion

Swap insights and ask questions about Unity Junior Programmer

Be the first to start the discussion

Ask a question or share your thoughts about this lesson.