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

#1 2010-12-19 03:29:13

redsox17stev
Scratcher
Registered: 2010-09-01
Posts: 3

Just a quick question about "if" blocks

If i have an if statement and there are a lot of scripts inside the if, do those scripts still cause the game to lag if the conditions of the if aren't met? 

For example, i have an "if mouse down" and a whole bunch of other if statements inside that would normally cause a lot of lag, would my game still be laggy even if the mouse isn't held down?

Offline

 

#2 2010-12-19 05:18:33

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Just a quick question about "if" blocks

I don't think they would contribute to lag in the project since those blocks are not running.  We could set up a small experiment using the timer and see I suppose:

I just put a Reset timer block at the top of the Forever loop and set a variable equal to the timer*1000 at the bottom (so the displayed variable value would be the time needed to travel through the loop once times 1000 to see small values).  Then, I put an If <mouse down> block with a Change Color Effect block and a Turn block inside in the middle of the loop.  The result...the loop ran faster when the mouse was not down so that shows that blocks in an If that is not running do not contribute to lag.

Hope that helps  smile


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2010-12-19 12:23:20

redsox17stev
Scratcher
Registered: 2010-09-01
Posts: 3

Re: Just a quick question about "if" blocks

Yeah, that helps a lot, thanks  smile

Offline

 

Board footer