Discuss Scratch

cubby208
Scratcher
99 posts

Unfortunately I have another set of bugs :(

I fear that my code is having issues understanding the enourmous ammount of rules. Both they bugs are surronded by the 9th button from the left. They are explained in great detail here.

http://scratch.mit.edu/projects/12145121/

As always you can join the hall of fame on the project page with the others!

Also I do happen to need an idea of the rules of the last button I'm out of ideas. I need something grand, or cool. Any ideas are helpful and will get you hall of fame status.
scubajerry
Scratcher
1000+ posts

Unfortunately I have another set of bugs :(

Not sure why, but they are all the clones are stuck in the if touching edge part of GRAVIT 9

For debugging purposes, make a global variable called debug. Move a change debug by 1 to various parts of the program. For example, put it in the main WHEN I START AS A CLONE FOREVER LOOP. In most gravits you will see it clounting away. When you go to GRAVIT 9, it stops. That tells you that either it is stuck in GRAVIT9, or the clone has been deleted. In this case, it is stuck in GRAVIT9

Now move it to different places in GRAVIT9 and see where it starts counting again.
DadOfMrLog
Scratcher
1000+ posts

Unfortunately I have another set of bugs :(

Hi again,

You've got some nice effects in there!

The main problem you have with gravit=9 is that you have a blank costume (which is as I suggested, to increase speed with all your rotations, so that's fine) - but it means touching edge and touching other sprites won't work correctly.

A couple of things:

1. You don't want to use custom block “bounce” when it hits the ‘paddles’ - the “bounce” script only makes a change to the direction when it is at an edge of the screen, but you want it to bounce when it hits the paddles (i.e. before hitting an edge).
Since the checks for touching the paddle sprites won't work, you should instead check if your x position is greater than a certain amount (maybe around 200ish?), and check if abs of (your y position minus the right paddle's y position) is within half the height of the right paddle. Then you know you've hit the right paddle, and you can set the direction to (0-direction), just as in the “bounce” script. Similarly for the left paddle (check if x position is less than -200ish, and abs(y-position minus y-position of left paddle)<half height of left paddle).
That should get the paddle bounces working correctly.

2. I'm not clear what you want to happen when the particle touches the various edges of the screen. I'd suggest having it bounce if it hits top or bottom (which will never happen at the moment, though, because you always have it travelling horizontally - but I'm assuming you'll change that), and maybe have it ‘restart’ in the middle if it goes off right or left edge…?
You need to do the position checking for these in the same way as in custom block “bounce”. For the top/bottom edge hit, the test and the change are exactly the same as in “bounce”, but obviously what happens for the left/right edge is different (if you follow my suggestion, then just set x:0 y:0, and maybe a random direction that's not too close to 0 or 180, so it's not going vertically).

Hope that helps!

Last edited by DadOfMrLog (Sept. 6, 2013 09:53:24)



Alternate account: TheLogFather –– HowTos and useful custom blocks (see studio). Examples below…


- String manipulation - - - X to power of Y - - - Clone point to clone - Detect New Scratcher - Speed tests studio -

Psiborg
Scratcher
500+ posts

Unfortunately I have another set of bugs :(

You also have two sprites called Sprite1 with very similar code - except that one does not have Gravit9. This is very confusing!

Save the world from giant ants in a classic tower defense: Antfestation
Protect the Minions from the Purples in Minion Push
Collect treasure across the beautiful islands of Mylands
Guard your gold in The Hoard++
Remake of a classic arcade game: Descentipede

DadOfMrLog
Scratcher
1000+ posts

Unfortunately I have another set of bugs :(

Psiborg wrote:

You also have two sprites called Sprite1 with very similar code - except that one does not have Gravit9. This is very confusing!
Oh, weird - I'd missed that!

Yeah, it looks like the first one is not really doing much, while the one further down is. But the first one does appear to be the one that's working for gravit 9 (the other doesn't have the scripts for it, so hardly surprising), so you should copy those scripts into the second sprite1 and probably ditch the first sprite1.

But you should also look through the first sprite1 and check if you've got other newer scripts in there that you should copy over to the other sprite1 before you ditch it…!

Last edited by DadOfMrLog (Sept. 6, 2013 09:50:47)



Alternate account: TheLogFather –– HowTos and useful custom blocks (see studio). Examples below…


- String manipulation - - - X to power of Y - - - Clone point to clone - Detect New Scratcher - Speed tests studio -

cubby208
Scratcher
99 posts

Unfortunately I have another set of bugs :(

Lo

DadOfMrLog wrote:

Psiborg wrote:

You also have two sprites called Sprite1 with very similar code - except that one does not have Gravit9. This is very confusing!
Oh, weird - I'd missed that!

Yeah, it looks like the first one is not really doing much, while the one further down is. But the first one does appear to be the one that's working for gravit 9 (the other doesn't have the scripts for it, so hardly surprising), so you should copy those scripts into the second sprite1 and probably ditch the first sprite1.

But you should also look through the first sprite1 and check if you've got other newer scripts in there that you should copy over to the other sprite1 before you ditch it…!
lol that happened due to a glitch ish thing that happened when I was working on it while server was down.
cubby208
Scratcher
99 posts

Unfortunately I have another set of bugs :(

DadOfMrLog wrote:

Hi again,

You've got some nice effects in there!

The main problem you have with gravit=9 is that you have a blank costume (which is as I suggested, to increase speed with all your rotations, so that's fine) - but it means touching edge and touching other sprites won't work correctly.

A couple of things:

1. You don't want to use custom block “bounce” when it hits the ‘paddles’ - the “bounce” script only makes a change to the direction when it is at an edge of the screen, but you want it to bounce when it hits the paddles (i.e. before hitting an edge).
Since the checks for touching the paddle sprites won't work, you should instead check if your x position is greater than a certain amount (maybe around 200ish?), and check if abs of (your y position minus the right paddle's y position) is within half the height of the right paddle. Then you know you've hit the right paddle, and you can set the direction to (0-direction), just as in the “bounce” script. Similarly for the left paddle (check if x position is less than -200ish, and abs(y-position minus y-position of left paddle)<half height of left paddle).
That should get the paddle bounces working correctly.

2. I'm not clear what you want to happen when the particle touches the various edges of the screen. I'd suggest having it bounce if it hits top or bottom (which will never happen at the moment, though, because you always have it travelling horizontally - but I'm assuming you'll change that), and maybe have it ‘restart’ in the middle if it goes off right or left edge…?
You need to do the position checking for these in the same way as in custom block “bounce”. For the top/bottom edge hit, the test and the change are exactly the same as in “bounce”, but obviously what happens for the left/right edge is different (if you follow my suggestion, then just set x:0 y:0, and maybe a random direction that's not too close to 0 or 180, so it's not going vertically).

Hope that helps!
That should solve everything… Except one issue. On my screen only one clone shows up on level 9. . I have no clue, the right ammount were working just fine on all other levels!
DadOfMrLog
Scratcher
1000+ posts

Unfortunately I have another set of bugs :(

cubby208 wrote:

That should solve everything… Except one issue. On my screen only one clone shows up on level 9. . I have no clue, the right ammount were working just fine on all other levels!

Yes, that's because of the two “sprite1”s you have. It's only the first “sprite1” that has “gravit9”, but that one doesn't get as far as making any clones of itself (one of the things you tell it to do when you press green flag is to “stop other scripts in this sprite”).

You really need to compare your two “sprite1”s and figure out which one you want to keep, and which scripts (if any) you want to copy over from the one you're getting rid of to the one you're keeping. And if you keep the first “sprite1”, then git rid of that “stop other scripts…”, so it does everything it's supposed to.


Alternate account: TheLogFather –– HowTos and useful custom blocks (see studio). Examples below…


- String manipulation - - - X to power of Y - - - Clone point to clone - Detect New Scratcher - Speed tests studio -

scubajerry
Scratcher
1000+ posts

Unfortunately I have another set of bugs :(

If you move the GRAVIT9 script to the 2nd sprite1, and deleting the 1st sprite1 script made everything work. Just deleting the second sprite1 sprite did not. If you are not already periodically saving a copy of your project, you should start now.

I did this in a remix http://scratch.mit.edu/projects/12206784/

Last edited by scubajerry (Sept. 6, 2013 14:48:00)

Powered by DjangoBB