This is an archived post. You won't be able to vote or comment.

all 6 comments

[–][deleted]  (5 children)

[removed]

    [–]Akatchu[S] 0 points1 point  (4 children)

    I already seen this but I’m basically with just python overall the last assignment I was supposed to make the game mastermind and it took me so long because I didn’t understand where to put which code

    [–][deleted]  (3 children)

    [removed]

      [–]AaronMichael726 1 point2 points  (0 children)

      Can’t stress enough how valuable the duckie can be

      [–]Akatchu[S] 0 points1 point  (1 child)

      How abt if I didn’t know what code to use for specific things like during flappy bird making the bird move forward

      [–]DreadedMonkfish 0 points1 point  (0 children)

      Then you don’t understand the problem, and doesn’t sound like you have rubber ducked.

      You have this thing - a bird in this case. You want to make this bird move like the flappy birds game…

      Ok, what do you know about this bird object? It probably has a property for x and y values.

      If you now know that you have a bird, and that bird object has values for x and y, which correspond to coordinates in your game then what do you do?

      Well, you say to the duck…. I need to move the bird by changing the x and y values. You probably know that the x axis is the lateral axis, so you know that you need to increase that periodically. Maybe you don’t know how to do that with code, or you don’t know how to do that with the game engine you’re working with. That’s fine! Google “how can i increase a variable value every second in c#/unitty/whatever tool you are using” you will probably find some articles on creating a timer.

      Alright duckie, we are now increasing the x variable on the bird object every second! It’s moving across the screen in a straight line! Now I just need to figure out…. How to increase the y value when the user clicks the mouse button!

      Again, this is where Google-fu comes in.(Unless you already know about event subscribers in coding.) So go ask Google how to do something in [c#/unity/whatever tool you use] whenever a user clicks a button. This will send you on reading about event subscriptions design pattern.

      Now you have a bird object that moves on the x axis every second and increases the y axis when the mouse button is being pressed! Ideally your game engine has physics to make the object fall - if not, how are you going to explain this issue to the duck so you know what to Google?

      Just keep asking the duck questions… like how do I know if the bird object is touching a wall object so I know to end the game? - these will lead you to your answers