Code Help Please!



I’m coding a project where I need a text object to fill in a shape with dots of a trail. I tried using a set pos block but that just sent the dots to the centre, not all over the shape like I wanted. I need to know how to do all shapes please! Please help- credit will be given :blush:
I know there is a variable for iPad width and height- is there one for shapes?


Hmm… Can you explain a little further? :D


I think that I can help you, but…


@CreationsOfaNoob and @William04GamerA
I’m trying a new type of trail art. I want to make pictures out of dots in a pointillism style. I thought it would be easier if I used shapes and then sent the text blocks there to make a trail. I’m having trouble getting the text blocks to go all over the shapes to make dots, not just to the middle.


Um what shape? then I can help


Kind of all shapes. I’ve got some shaky code for a circle ( moving forwards and backwards a certain amount and then turning) but that wouldn’t work for any other shapes.


Okey! Hold on a sec let me do some code…


You could use variables or repeat blocks.


Could you show me the code please- it’s been a while!


You could use variables but without lists you’d need a very large amount of them.


Here is a link to a square and platform and you can use my code to make those shapes and more!



Thanks, although I kinda already had that. Do you know of a way that I could just use a shape and not have to code the positions for each one?


Are you using clones? If so I think I had a similar problem with objects not going where theyre supposed to.


No, it’s not really that, it’s just I don’t have a clue how to easily cover the area of the shape!


Maybe you could have something like this code:
When the play button is tapped
Repeat (whatever you want) times:
Create a clone of this character
Increase value X by (whatever you want)
Wait 500 milliseconds

When character is cloned
Change X by X
Change Y by Y
Draw a trail color (whatever you want)

When X equals a specific number when a new row will be drawn:
Set value X to 0
Increase value Y by (whatever you want)

This will, (I think), create clones and each time increase a value called X. When the value increases or changes, the next point will be drawn at a new position. The value Y is used to give the code the ability to draw multiple lines. You have to calibrate this code so that all the numbers are correct. If you want any help or if I have been writing the wrong code (because I haven’t tested it in HS), please let me know :slight_smile:


I think @laser_eyed_puppy has the right idea here :smiley: You can make “functions” on Hopscotch with abilities (please read this if you haven’t already, it’s pretty cool!)

You can easily change the set position variables by doing this:

(Set position: x(random (Xrandom1) to (Xrandom2)) y(random (Yrandom1) to (Yrandom2))

This allows you to easily change where and how large the square is. Just make sure to change the variables’ values before adding the ability.

Of course, this isn’t the most efficient way of making shapes like this, I think. It takes a while to load, and since you can’t have the Repeat Forever block there (if you want certain shapes behind/above one another) you’ll have to find a good number that almost always fills up the whole shape.

@William04GamerA that’s a good idea!!

Set position: x(X) + (text 5 x position) y(Y) + (text 5 y position)

In the time it takes the pink square to load the purple one isn’t near finished:

Even when the purple one is complete it doesn’t look as nice as the pink one.

When I halved all of the values (X to 5, Y to 5) it looked like this:

But I wouldn’t really call that stippling right? :thinking:

Anyway, @IKeudin, you can use either method, but I think the pink one using clones is much easier and faster. :smile:


Oh ok.

Whatever my ideas the above people are probably more helpful :joy:


Thanks @William04GamerA and @Intellection74, I’ll give them a go :grinning:


I don’t know whether I misunderstood or whether HS is playing up, but I got this:

Then I just get a dot…
Also, ignore that it says self, that’s a typo and it works the same with the right code.


You could have this code in “when object is cloned”:
Change X by X
Change Y by Y
And then the drawing code.
Also, you should add “Set value X to 0” in the rule “When X = 10”.