Discuss Scratch

Reev0102
Scratcher
1000+ posts

Bug in my project

I'm making a pen platformer, but when I move past a certain point on the screen, it fills the whole screen with pen and lags like crazy. Can you please help? https://scratch.mit.edu/projects/563553702
Cartoon_Magic
New to Scratch
1 post

Bug in my project

Yup will help you..
Cartoon_Magic.
Don't forget to check my profile..
Will make projects soon..

Last edited by Cartoon_Magic (Aug. 28, 2021 05:59:45)

deck26
Scratcher
1000+ posts

Bug in my project

Your filledRect custom block seems to assume x and x1 will be integer values but that is not necessarily true. Perhaps repeat until fillindex > x1 + 0.999 instead of fillindex=x1+1..

Last edited by deck26 (Aug. 28, 2021 10:20:01)

Reev0102
Scratcher
1000+ posts

Bug in my project

deck26 wrote:

Your filledRect custom block seems to assume x and x1 will be integer values but that is not necessarily true. Perhaps repeat until fillindex > x1 + 0.999 instead of fillindex=x1+1..
That breaks the whole project.
deck26
Scratcher
1000+ posts

Bug in my project

Reev0102 wrote:

deck26 wrote:

Your filledRect custom block seems to assume x and x1 will be integer values but that is not necessarily true. Perhaps repeat until fillindex > x1 + 0.999 instead of fillindex=x1+1..
That breaks the whole project.
Well if you check the values you'll see they're not always integers so you end up with an infinite repeat until loop. So you need to fix that regardless of whether that means there are further problems to fix.
Reev0102
Scratcher
1000+ posts

Bug in my project

deck26 wrote:

Reev0102 wrote:

deck26 wrote:

Your filledRect custom block seems to assume x and x1 will be integer values but that is not necessarily true. Perhaps repeat until fillindex > x1 + 0.999 instead of fillindex=x1+1..
That breaks the whole project.
Well if you check the values you'll see they're not always integers so you end up with an infinite repeat until loop. So you need to fix that regardless of whether that means there are further problems to fix.
Then I won't use X velocity, so the player will only travel left or right at a constant speed.
deck26
Scratcher
1000+ posts

Bug in my project

Reev0102 wrote:

deck26 wrote:

Reev0102 wrote:

deck26 wrote:

Your filledRect custom block seems to assume x and x1 will be integer values but that is not necessarily true. Perhaps repeat until fillindex > x1 + 0.999 instead of fillindex=x1+1..
That breaks the whole project.
Well if you check the values you'll see they're not always integers so you end up with an infinite repeat until loop. So you need to fix that regardless of whether that means there are further problems to fix.
Then I won't use X velocity, so the player will only travel left or right at a constant speed.
If you prefer but my original suggeston should have worked - you just need to not be checking for one value being an exact interger amount above the other.

Powered by DjangoBB