Building the game in Unity - Discussion

Hi, Jacob.
Can we pm? Maybe we can do a discord session later today?
Ivo

1 Like

Hi , were getting stuck at 'controlling the character ’ lecture . Get stuck after doing the coding , and can’t find … 'player controller’in the 'add components button . We have gone back to the begining started again , got to the same placevl and still no joy … Aaaarrr lol . We are cracking on with defi course in the mean time.
Many thanks Odin and Pip

Please provide some of your code in so that we can help you!


Thanks loads

Maybe a stupid question, but did you save the file (for example press ctrl+s), because in the screenshot it is not saved.

Please rename the variable moveImput to moveInput !!!

Ha thanks eek lol .we may get somewhere now

Yes got that. Odin didn’t change both . At least we’re laughing here

Hi Dr ,we’re still not working eek


Here’s what we get when we search player controller in add conponent.

Try it without the blank space (playercontroller). Where do you saved the script?

And try to save the c# file as player_controller and not player controller, maybe Unity has a problem with the blank space!

Ok still not working

Hi I am on video 24 and my camera is really messed up. It has a white box around it, indicating where the scene is. How do I get rid of this white box so my camera can cover the tiles outside of it and zoom out

?

my Jumps Allowed not work and i dont see where is the problem, can you help me please?

Untitled-1.fw using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class PlayerController : MonoBehaviour

{

public float speed;

public float jumpForce;

public float jumpsAllowed;

private float timesJumped;

private Rigidbody2D rb;

private float moveInput;

private float jumpInput;

private float previousJumpInput;

// Start is called before the first frame update

void Start()

{

    rb = GetComponent<Rigidbody2D>();

    timesJumped = 0;

    previousJumpInput = 0;

}

void FixedUpdate()

{

    

    moveInput = Input.GetAxis("Horizontal");

    rb.velocity = new Vector2(moveInput*speed, rb.velocity.y);

    jumpInput = Input.GetAxis("Vertical");

    if(jumpInput > 0 && timesJumped < jumpsAllowed && previousJumpInput == 0)

    {

        rb.velocity = new Vector2(rb.velocity.x, jumpForce);

        timesJumped++;

    }

    

    previousJumpInput = jumpInput;

}

void OnCollisionEnter2D(Collision2D other)

{

    if(other.gameObject.CompareTag("Ground"))

    {

        timesJumped = 0;

    }

}

private static float NewMethod()

{

    return Input.GetAxis("Horizontal");

}

// Update is called once per frame

void Update()

{

}

}

1 Like

already passed 6 days nobody answers me ???

already passed 6 days nobody answers me ??? ,

Hey @R.C, hope you are ok.

Sorry for the late reply, now i have checked your function and your jump conditional (IF) looks the same has the video, what do you mean that jumpAllowed does not work? Are you able to jump more than 3 times?

If you have any more questions, please let us know so we can help you! :slight_smile:

Carlos Z.

no nojump, and the code i think its ok

1 Like

Ok and before reaching the Advance Jumping lesson, did you manage it to be able to do the simple jump? I mean there must be something that you are missing in the code that is not working anymore, maybe a mistype on a variable or syntax, it will be good to start over the jump lessons and check which step is exactly going into errors.

If you have any more questions, please let us know so we can help you! :slight_smile:

Carlos Z.

carlos eu fiz tudo como no video tive que parar o video 500xs sempre tive os mesmos resultados que nos videos e so falhou agora,parei o curso por causa disto e gostava de poder avancar com o problema resolvido, ja disponiblizei o codigo nesta pagina da para ver que ta igual ao video

1 Like

Sorry sir, english please :nerd_face:

Carlos Z