Help with erasing while leaving the grid behind

I have recently created a city builder project, and I am wondering how to erase roads, lakes, and buildings while still leaving the grid behind.
(I really wish there were drawing layers…)

If you think of a solution, I will be happy to credit you in the project. Thanks in advance! :smile:

Here’s the project:
https://c.gethopscotch.com/p/10ddkmaxqt
(As you can see, the code for the eraser is really broken. :stuck_out_tongue:)
@CodeHelp

16 Likes

I am stumped on this one sorry:(
Awesome game though

7 Likes

You’re going to need to make sure none of the grid lines get below y125 (by doing something like when object is cloned check if self y < 125 destroy object.)and you’re going to need to have each building repeatedly draw itself. (In the grid object->)You’ll want to do move all the code from the when object is cloned apart from the destroy block into a when device is pressed. Add two check ifs, for the first one do check once if eraser bar = 1. For the other do check once if clone index > 1.

3 Likes

Maybe make the grid in front of the buildings? (It would take actual clones or repeat forever though…)

3 Likes

Would it be possible to erase the building then redraw the parts of the grid within the area that get erased too? I’m not on an iThingy at the moment but I’ll check it out soon.


This redraws the grid as long as the eraser can be drawing. The redraw grid ability is everything in the when object is cloned except for the destroy block.


You could replace the last touch y > 120 with checks to see if last touch is close to the current clone’s lines. That results in the grid not redrawing in some areas if you erase really quickly. The solution to that is to expand the distance to last touch. 100 is not enough.

5 Likes

Wouldn’t that draw the grid on top of the buildings and roads that are already there, or am I misunderstanding you?

Because I don’t really want that.

3 Likes

That would. You could possibly have objects following the eraser drawing just the grid near it. Or maybe whenever the eraser gets turned off redraw the whole grid then all the buildings. You’ have to have a way to determine which buildings are erased though.

3 Likes

@Silverdolphin