I have trouble with repeat blocks or values


So this is the weirdest thing. I was making a realistic background for a game I'm making and it's supposed to have a road right in the middle. I used values to determine were the gray road part would be and reappeat blank times blocks for how long it would last, it worked at first, but I made a slight change for the amount of times it happened and it wouldn't work anymore. Does anyone know how to fix this?


Hm, @SummarianStudios, can you post some pictures of your code? Maybe then it would be easier for me to what's wrong.

P. S Welcome to the forum!!


How do you post a picture heh heh...


@SummarianStudios no problem! Just click on the little upload button:

(Or if you're on mobile view there'll be a button in the corner of your post that just says Upload)


I temporarily published it. You can look at the code because the pictures for some reason wouldn't upload


The link has expired. You unpublished it? I think that you should take a screen shot.


Hi @SummarianStudios
It looks to work fine to me. Is this what you were expecting?

Here's what it drew for me


No, That was only the last line of the road. It was supposed to start farther down and work it's way up to that point


I'll see what I can do. Oh, I gotta go, sorry. Brb.


Hi @SummarianStudios Sorry it took so long for me to respond again. Sometimes life gets in the way :confused:

I had a chance to look through your code this morning. You're problem is one of timing.

To troubleshoot, I added 3 new text objects with code like this

Try this and make one for Place, Clone, and Clone range. This will allow you to see the values of the variables while the background is drawing.

With those "watches", you should be able to see why the Check if else isn't going the code to draw the road.

Give it try and I'll help more if you need. And after you try, if you want, I'll show you a more direct way to get the result you want.


I hadn't thought of that, good thinking. I'll try it @ThinBuffalo


It worked! I just need to add the yellow dotted lines. Does it look realistic?


That looks good. I like the textured appearance.

Can I make some suggestions?


Yes of course. Open for criticism!


No criticisms. Just a few suggestions to hopefully help.

The project has lag that doesn't improve when the background drawing is done.

How do I know? Add a FPS meter with a new text object and code like this:

FPS is frames per second. This will show you how fast or slow (laggy) the project is at any given time. Hopscotch is designed to run at 60 fps, but lots of clones all doing something at the same time cause lag. However when the background is drawn, the fps stays low.

Do you see why?


Yes I do. I could never think of that. You are very smart.


I'm sure you're very smart too! I just have more experience :wink:

To allow the FPS to go back up when the background drawing was done, did you remove this Repeat Forever?

It's not needed, right? Since both paths under the Check If Else draw a full row repeating more drawing isn't needed and will only make the rest of the game laggy.


Here's a couple more suggestions to think about

If you use (self) Y Position, then this block & When aren't needed. You're also less likely to have timing problems. Just change the 150 & 400 to whatever you want.

Have fun with your project :grinning:


@SummarianStudios Are you coding on an iPhone 5?

Just curious because of the 320 x 568 screen resolution in your project...


I am yes.