Skip to content

Conversation

@molly-moen
Copy link
Contributor

Add the option to show or hide paint buckets on the screen. The client will call neighborhood.setBucketVisiblity(boolean) to show or hide buckets on the screen. When we see that call, we will iterate over all the cells and redraw any that contain active paint buckets. In addition, when drawing a cell we check the bucket visibility boolean to decide whether to show or hide the bucket.

The asset name we were already using was paintCan, but I named the functions with bucket because that is what we are using on the code-dot-org and javabuilder side.

I also updated the README to include instructions for running maze with local Code Studio.

@molly-moen molly-moen requested review from a team and hannahbergam June 13, 2022 18:10
Copy link
Contributor

@hannahbergam hannahbergam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just trying to fully understand how the paint count works in a couple questions in reset. Otherwise, looks good!

* Calls resetTile for each tile in the grid, clearing all paint.
*/
resetTiles() {
this.showBuckets = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does a reset show the buckets again because a student is starting over, so paint is restored to the bucket? Does the paint count (cell.getCurrentValue) change somewhere else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep! reset returns the map to its original state. It eventually calls subtype.getCell() which gets the original value for the cell.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh okay awesome. Thanks!

if (cell.getOriginalValue() > 0) {
const newValue = cell.getCurrentValue() > 0 ? cell.getCurrentValue() : "";
// drawImage_ calls getAsset. If currentValue() is 0, getAsset will return
// The new value is the number of paint units to show on the screen. If we have > 0 units and we
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you help me understand when a reset wouldn't restore the value to the originalValue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reset should always restore the value to originalValue. This function (updateItemImage) is called when we change the cell mid-run

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦🏻‍♀️I still had reset() in my brain. Perfect:)

@hannahbergam hannahbergam self-requested a review June 14, 2022 17:16
Copy link
Contributor

@hannahbergam hannahbergam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@molly-moen molly-moen merged commit 5fd1208 into main Jun 14, 2022
@molly-moen molly-moen deleted the molly/neighborhood-buckets branch June 14, 2022 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants