How can we make this rube goldberg to work?

4 months ago by

Hey Chris, can you help me with this program and fix it, so it can do what we want it to do.

I assume that you know whats supposed to happen because we talked about it last week.  If not here's what its supposed to do: once ball2 goes down in a hill kind of way to the right, ball will come right after it (the blue one) falling down in a hill kind of way as well to the left, then the flag will be raised up until the end of the gray pole.

Here is the link:

modified 4 months ago by Chris Smith   • written 4 months ago by Alyssa Ann Dilan  

1 Answer

4 months ago by

In this:

I just made these three changes:

  1. I finished the raise function that you started.  To raise a flag, if it's not all the way up, it goes up at its current velocity.  If it is already up, it doesn't change.  To write a function that says that, I used guards.
  2. In your step function, I changed ff to raise(ff, dt), telling the simulation that raising the flag is part of what it does.
  3. In initialFlagF, I set the initial y velocity to 0, so that the flag starts out still, and only starts moving when triggered starts it.

And that's all you need!

written 4 months ago by Chris Smith  

Thank You!!!!!

written 4 months ago by Alyssa Ann Dilan  
Please log in to add an answer/comment or follow this question.

Similar posts:
Search »