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

#1 2013-04-25 19:24:23

ethwok
Scratcher
Registered: 2012-09-10
Posts: 100+

Level script

I need help finding a level script. Like, say when you reach the purple door, you gain 1 level. Whatever I try, it always goes forward more than one level/background. Help please! Thank you in advance


http://displaypicks.com/wp-content/uploads/2013/01/Animals-12.jpg
I AM ETHWOK

Offline

 

#2 2013-04-27 09:42:30

knifekathikarti
Scratcher
Registered: 2013-02-22
Posts: 3

Re: Level script

Its easy ,try to use variable.If you have doubt in variable ask me

Offline

 

#3 2013-04-27 09:53:21

Liamadams
Scratcher
Registered: 2012-12-08
Posts: 100+

Re: Level script

so, just do this. On the background script,

when gf clicked
set [level v] to [1]
switch to background [background 1 v]
forever
 if <(level) = [2]>
  switch to background [background 2 v]
 end
And on the moving sprite, do this.
when gf clicked
forever
 if <<([background # v] of [stage v]) = [1]> and <touching [door v]?>>
  set [level v] to [2]
  go to x: [0] y: [0]
 end
that should work. Hope this helps!  smile


http://i39.tinypic.com/3309476.jpg

Offline

 

#4 2013-04-27 14:20:49

7734f
Scratcher
Registered: 2010-12-23
Posts: 500+

Re: Level script

Liamadams wrote:

so, just do this. On the background script,

when gf clicked
set [level v] to [1]
switch to background [background 1 v]
forever
 if <(level) = [2]>
  switch to background [background 2 v]
 end
And on the moving sprite, do this.
when gf clicked
forever
 if <<([background # v] of [stage v]) = [1]> and <touching [door v]?>>
  set [level v] to [2]
  go to x: [0] y: [0]
 end
that should work. Hope this helps!  smile

Or you could try this:

when gf clicked
forever
 if <touching [purple door v] ?>
  change [level v] by (1)
  broadcast [change background v]//for the background level changing
  go to x: [230] y: [-90]
 end
Hope that helped!

With regards,
~7734f


http://internetometer.com/image/38992.png   http://i37.tinypic.com/2qixx6c.png

Offline

 

#5 2013-04-27 14:53:07

FriedChickenLA
New Scratcher
Registered: 2013-04-22
Posts: 11

Re: Level script

7734f wrote:

Liamadams wrote:

so, just do this. On the background script,

when gf clicked
set [level v] to [1]
switch to background [background 1 v]
forever
 if <(level) = [2]>
  switch to background [background 2 v]
 end
And on the moving sprite, do this.
when gf clicked
forever
 if <<([background # v] of [stage v]) = [1]> and <touching [door v]?>>
  set [level v] to [2]
  go to x: [0] y: [0]
 end
that should work. Hope this helps!  smile

Or you could try this:

when gf clicked
forever
 if <touching [purple door v] ?>
  change [level v] by (1)
  broadcast [change background v]//for the background level changing
  go to x: [230] y: [-90]
 end
Hope that helped!

With regards,
~7734f

well my post is more specific, the might not know about

when i receive [your text here v]
yet.

Offline

 

#6 2013-04-29 21:14:41

ethwok
Scratcher
Registered: 2012-09-10
Posts: 100+

Re: Level script

Thank you for that, but 7734, yours didn't work. My problem is that when it changes from level 1 to level2, i have the script say, if it's level 1 switch to level 2, and when it's level 2, switch to 3. So the problem is that the script doesnt change my sprites position to not touching the door fast enough, that it triggers level 1 to level 2, and while it's level 2, before it activates moving my character to the edge of the level, it still is touching the door and therefore triggers 2 to 3


http://displaypicks.com/wp-content/uploads/2013/01/Animals-12.jpg
I AM ETHWOK

Offline

 

Board footer