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

#1 2010-04-27 21:25:01

frozenveinz
Scratcher
Registered: 2010-04-24
Posts: 28

My code is really laggy for some reason, can anyone help?

It is actually quite big, on the order of around two full pages, (not in collumns). I, however, am done making it and stuff, anf from now on am just adding costumes to the background to make more levels. Well, for each level i will add a broadcast to switch levels but whatever. ( actually, i think i have the broadcast set to "next level").

Yep broadcast is next level.
[blocks]
<when green flag clicked>
<forever>
<if><touching color[ yellow
<set{ x speed }to( 0
<set{ y speed }to( 0
<go to x sad  -208 )y sad  -96
<broadcast[ next level

And then the background's part:
<when I receive[ next level
<next costume>
<wait( 1 )secsc>

Uh-oh, i just realized that two of the levels i used seperate broadcasts to use successive platforms:
<when I receive[ level 2
<switch to costume[ background 3

<when I receive[ level 3
<switch to costume[ background 4

<when I receive[ level 4
<switch to costume[ background 5

<when I receive[ button level 1
<switch to costume[ background 7

And for the sprite's part:
<when green flag clicked>
<forever>
<if> <color[ beige ]is over[ orange
<broadcast[ level 2
<if> <color[ beige ]is over[ orange-brown
<broadcast[ level 3
<if> <color[ beige ]is over[ orange
<broadcast[ level 4

<when green flag clicked>
<forever>
<if> <touching color[ green
<broadcast[ button level 1
[/blocks]

I am pretty sure that's it for level transition, so yah, I need help with the lag. Oh wow, I just realized I got carried away on the little detail there ^^. Oh well.


http://i970.photobucket.com/albums/ae184/frozenveinz/RickRoll.gif

Offline

 

#2 2010-04-27 21:29:42

midnightleopard
Scratcher
Registered: 2007-09-13
Posts: 1000+

Re: My code is really laggy for some reason, can anyone help?

hmmm... I have found that lots of brodcasts can lag stuff up... but maybe you should just edit stuff in chunks and then put it all together.


http://pwp.wizards.com/5103673563/Scorecards/Landscape.png

Offline

 

#3 2010-04-30 22:55:49

frozenveinz
Scratcher
Registered: 2010-04-24
Posts: 28

Re: My code is really laggy for some reason, can anyone help?

How do you put it all together? I've tried, but the script ended up not working. Wait, like taking out the scripts like this except for one and adding them all to it?
[blocks]
<when green flag clicked>
<forever>


http://i970.photobucket.com/albums/ae184/frozenveinz/RickRoll.gif

Offline

 

#4 2010-05-01 07:35:01

mwhitey12
Scratcher
Registered: 2009-06-06
Posts: 99

Re: My code is really laggy for some reason, can anyone help?

[img]<head>
<script type="text/javascript">
function show_alert()
{
alert("mwhitey12 in da house");
}
</script>
</head>
<body>

<input type="button" onclick="show_alert()" value="click this" />

</body>[/img]

Offline

 

#5 2010-05-01 07:36:39

mwhitey12
Scratcher
Registered: 2009-06-06
Posts: 99

Re: My code is really laggy for some reason, can anyone help?

http://scratch.mit.edu/forums/viewtopic.php?pid=380415#p380415

Offline

 

#6 2010-05-01 07:40:09

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: My code is really laggy for some reason, can anyone help?

Try not to use broadcasts. There's a 0.05 or so second delay.


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

Board footer