Help with Pixel Art?! ( Solved )


#22

That is really strange..I have a pixel art with repeats in it but it's been working fine.
Try dragging the set value block into that piece of code with your pixel value.


#23

She posted the link above your post.


#24

I know. But in the link all working well I think.


#25

Yeah sorry I deleted the project to see if the bug would still be there, also I tried to duplicate the project but it didnt change anything....
Here is the link! And thanks for trying to help!


#26

Hi, I played with code and I didn't see anything that might be effecting the problem. I am going to work with it a little more in a couple minutes


#27

Thanks, I actually really think that it's a real bug.... :ant:
@BB-Box Did you find anything???
By the way to everyone : I really appreciate the help!!


#28

Take out move forward -1 because that causes the problem


#29

ha, I also tried this


and this

and it still doesn't work.
I think it's a glitch. I will work on it more later.


#30

I dont think that that's the problem.... :pensive:
@CatWithABrush Thanks for helping!


#31

@CatWithABrush is correct. In the last block pixel needs to multiplied by 2. The drawer/pen needs to move past itself AND into the next space.
So what's been happening is: the second dot is being drawn over the first. Hope this helps
Please reply if you don't understand, I'll try and do better explanation.:slight_smile:


#32

Please use the updated OMTL.


#33

I made it move forward the width of the pixel and then created another one, I'm no the sure if what you said wouldn't work....


#34

@MelodiousParrot thanks, it finally worked :sweat_smile::laughing:
For some reson though I had the same code with another piece without doing what you said and it worked.....


#35

Do move forward pixel (value of size) x 2


#36

Thanks, I have tried x3 and it has worked!
I'm now just wondering why I have to it with this but not the other piece of code.... just so I won't get muddled up in future! :slight_smile:


#37

I think the problem is that when game starts, the value of pixel isn't 10 right away. It takes a little while for the value to be set to 10. At first the value of pixel is 0. So you have two "when game starts" rules, and one of them takes a moment to set pixel to 10, while the other one tries to use pixel right away, and it ends up using the value of 0 before it gets set to 10 by the first rule.

This is a really hard issue to get around. An easy but not reliable solution is to make the second rule wait before using the pixel value (something like "wait 1,000" at the top would be enough). A more complex solution would be to use a rule that doesn't run until pixel has a value other than 0, but that would take longer to explain. I could make a demo project if you are interested in this.


#38

Did you set the value for "Pixel"?


#39

Thanks very much!! I would love if you would be able to explain it by creating a project with the code within it. As I don't completely understand the second solution by what you said, I can't use the hopscotch app right now but when I do I'll probably be able to work it out.
If not I can try to get around this using the first solution you mentioned.
Thanks very much for the help!!


#40

Yes I did, but I know realise what was wrong with the code by what Montoya said. :slight_smile:


#41

Hi, here is a project demonstrating the issue & solution: https://c.gethopscotch.com/p/ygoxut9jj

The text object sets a value "Distance" to 160 in a When Game Starts, but after a Wait block. The first jeep has When Game Starts -> Move Forward [ Distance ]. The second jeep has When [ Distance ] =/= 0 -> Move Forward [ Distance ]. The first jeep moves forward 0, the second jeep moves forward 160. This is because at the time the game starts, the value of Distance is 0. You have to wait for that value to change before moving forward to move with the correct value, 160.

An aside: since the rule "When [ Distance ] =/= 0" will keep evaluating over and over, I stuck a Repeat Forever at the end so it would get stuck there, but there are more elegant ways to handle this.

Hope this helps!