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

#1 2012-02-13 15:21:19

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Would this make my games faster?

Let's say I had a lot of sprites that had to be active at certain points throughout the game. In the instances where the sprites aren't needed any longer, could I have something like this for all of the said sprites?;

when gf clicked
forever
if < [level] = [3] >  // or whatever level the sprite is called into action
execute actions here
else
stop script
end
Feedback much appreciated. Thank you for your time!

Last edited by Zparx (2012-02-13 15:23:00)


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#2 2012-02-13 15:22:31

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Would this make my games faster?

Yep. The less scripts are running, the faster the project will run.

Last edited by RedRocker227 (2012-02-13 15:22:48)


Why

Offline

 

#3 2012-02-13 15:23:24

Borrego6165
Scratcher
Registered: 2011-03-10
Posts: 1000+

Re: Would this make my games faster?

Zparx wrote:

Let's say I had a lot of sprites that had to be active at certain points throughout the game. In the instances where the sprites aren't needed any longer, could I have something like this for all of the said sprites?;

when gf clicked
if < [level] = [3] >
execute actions here
else
stop script
end

put a forever statement around it, otherwise it would act once. There's more information about that particular script on a guide a made on the Help with Scripts section.


Generation:4001 Build a beautiful city, with over 50 objects and over 10000 tiles per city! This simulates traffic, pollution, tourism, crime and more!

Offline

 

#4 2012-02-13 15:23:48

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: Would this make my games faster?

RedRocker227 wrote:

Yep. The less scripts are running, the faster the project will run.

Sweet, thanks. I'll definitely have to keep that in mind (:


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#5 2012-02-13 15:47:23

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: Would this make my games faster?

This would work, but as Borrego6165 said, you would need to put a forever block, or else the actions would only repeat one time.


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

Board footer