Bug with sprite movment and conditionals

Student project

I want jack and sally to move only in a certain range and to stop at a certain point. When I press keydown I want them to stop moving in that range.

Hi @marci.cabrera,

Very seasonal project! The first step is to break down the issue:

Although there are many ways to approach it, I think using the same strategy I shared in your question yesterday to get the star to shrink and grow would work well. You would replace .scale with .x (to move left and/or right) and replace the shrink variable with a move variable.

  1. Create another variable that will toggle: move
  2. If sally.x is > 100 AND move == right, then the counter pattern (here is the documentation on the counter pattern) should move sally to the right
  3. If sally.x is < 300 AND move == left, then the counter pattern should move sally to the left
  4. Set another set of if statements to change the value of move when sally.x gets too far left or right.

I hope that helps get you started!

1 Like

Thank you so much for your reply and suggestions!