This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-11-03 17:55:39

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Repeat loop acting up

http://scratch.mit.edu/projects/firedra … st/2882831Download it.  It won't work.  I commented the code.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#2 2012-11-03 18:13:37

Molybdenum
Scratcher
Registered: 2012-06-17
Posts: 1000+

Re: Repeat loop acting up

You forgot to reset the X values in the nested loop. Put set X to -240 right before the inside loop. Also, Y is incremented. Since you're going down, you need to decrement. Change the change Y by 360 / size to -360.

Last edited by Molybdenum (2012-11-03 18:18:25)


"The Enrichment Center is required to remind you that you will be baked, and then there will be cake."
(|Balls and Platforms: Stay on!|) (|NaOS-H: An operating system... Or is it?|)

Offline

 

#3 2012-11-03 18:16:34

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Repeat loop acting up

Molybdenum wrote:

You forgot to reset the X values in the nested loop. Put set X to -240 right before the inside loop. Also, Y is incremented. Since you're going down, you need to decrement. Change the change Y by 360 / size to -360.

Still's broken.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#4 2012-11-03 18:17:07

Molybdenum
Scratcher
Registered: 2012-06-17
Posts: 1000+

Re: Repeat loop acting up

Firedrake969 wrote:

Molybdenum wrote:

You forgot to reset the X values in the nested loop. Put set X to -240 right before the inside loop. Also, Y is incremented. Since you're going down, you need to decrement. Change the change Y by 360 / size to -360.

Still's broken.

Oh wait. Change the 480/size and -360/size inside the changes to...

Just size.
No wait. The Y needs to be -size.

Last edited by Molybdenum (2012-11-03 18:19:27)


"The Enrichment Center is required to remind you that you will be baked, and then there will be cake."
(|Balls and Platforms: Stay on!|) (|NaOS-H: An operating system... Or is it?|)

Offline

 

#5 2012-11-03 18:22:55

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Repeat loop acting up

Molybdenum wrote:

Firedrake969 wrote:

Molybdenum wrote:

You forgot to reset the X values in the nested loop. Put set X to -240 right before the inside loop. Also, Y is incremented. Since you're going down, you need to decrement. Change the change Y by 360 / size to -360.

Still's broken.

Oh wait. Change the 480/size and -360/size inside the changes to...

Just size.
No wait. The Y needs to be -size.

Wait, what?  Say just what needs to be fixed.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#6 2012-11-03 18:24:45

Molybdenum
Scratcher
Registered: 2012-06-17
Posts: 1000+

Re: Repeat loop acting up

repeat ((360) / (size))
  set x to (-240)
  repeat ((480) / (size))
    change x by (size)
    set [color v] effect to ((x position) * (y position))
    stamp
  end
  change y by ((0) - (size))
end
Replace the bottom with that.

Last edited by Molybdenum (2012-11-03 18:25:35)


"The Enrichment Center is required to remind you that you will be baked, and then there will be cake."
(|Balls and Platforms: Stay on!|) (|NaOS-H: An operating system... Or is it?|)

Offline

 

#7 2012-11-03 18:25:40

coolguy308
Scratcher
Registered: 2012-09-30
Posts: 30

Re: Repeat loop acting up

Molybdenum wrote:

Firedrake969 wrote:

Molybdenum wrote:

You forgot to reset the X values in the nested loop. Put set X to -240 right before the inside loop. Also, Y is incremented. Since you're going down, you need to decrement. Change the change Y by 360 / size to -360.

Still's broken.

Oh wait. Change the 480/size and -360/size inside the changes to...

Just size.
No wait. The Y needs to be -size.

um... im confused

Offline

 

#8 2012-11-03 18:26:24

Molybdenum
Scratcher
Registered: 2012-06-17
Posts: 1000+

Re: Repeat loop acting up

coolguy308 wrote:

Molybdenum wrote:

Firedrake969 wrote:


Still's broken.

Oh wait. Change the 480/size and -360/size inside the changes to...

Just size.
No wait. The Y needs to be -size.

um... im confused

Molybdenum wrote:

repeat ((360) / (size))
  set x to (-240)
  repeat ((480) / (size))
    change x by (size)
    set [color v] effect to ((x position) * (y position))
    stamp
  end
  change y by ((0) - (size))
end
Replace the bottom with that.


"The Enrichment Center is required to remind you that you will be baked, and then there will be cake."
(|Balls and Platforms: Stay on!|) (|NaOS-H: An operating system... Or is it?|)

Offline

 

#9 2012-11-04 22:36:06

thebriculator
Scratcher
Registered: 2011-07-11
Posts: 500+

Re: Repeat loop acting up

awww, It took me a while to get this, but there it is.

Molybdenum is exactly right; but for re-sizing the sprite I used different costumes instead of re-sizing. Great pattern you found!


.     http://tiny.cc/2cwgpw    http://tiny.cc/viwgpw    http://tiny.cc/iwwgpw

Offline

 

#10 2012-12-02 15:06:56

curiouscrab
Scratcher
Registered: 2012-06-25
Posts: 100+

Re: Repeat loop acting up

What's going on here? What happened between Molybdenum and Firedrake969?


http://i50.tinypic.com/dopbtw.png

Offline

 

#11 2012-12-02 15:32:46

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Repeat loop acting up

Closed by request of the topic owner.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

Board footer