Just finished the course, Wanted to share and ask a question

Just wanted to mention how good this course was and I plan on adding a bit more to this game as I learn more. From what I learned I was able to implement a little UI element that informs you of what button you’re pressing. Not super useful but something I might use in the future for different styles of games.

One thing specifically I’d like to know if anyone was able to implement was the ability to bring the saucer to a complete stop? I tried subtracting the force applied with a different button but that obviously just made it go backward or what ever the opposite of the current force was. I’m wondering if anyone could lead me towards a solution for this.

1 Like

Glad you’re enjoying things!

That’s an interesting idea. From a physics perspective, this is what linear damping does over time - you can find this at RigidBody2D–>Linear–>Damp. Based on that, it turns out there’s actually a pretty simple way to create something like a car brake:

  • Map a button to a “Brake” action. You will then need control flow (if-statements) to do something when the button is pressed, and again when the button is [released | not pressed]. I wrote it this way because there is more than one way you could do that.
  • Right-click the Damp variable in the Inspector and select Copy Property Path. Paste this in your script and you can modify the value in code.

This should get you moving (rather, stopping) in the right direction without giving the whole thing away =)

1 Like

Thanks for this!

Here’s what I ended up doing your guidance was great.

1 Like

Awesome to hear, glad you got it! ^v^

One thing I really should mention though: “break” means to break something in half; the spelling you want is “brake.” Doesn’t change anything in your game of course, just makes things less confusing for anyone who looks at your code later =)

1 Like

Haha, thanks a lot of good years of ESL classes did for me :sweat_smile:

1 Like

I know you’re joking, but they certainly did; you’re coding, in English right now. It’s hard enough for native speakers to do that :+1:

1 Like

Privacy & Terms