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

#1 2012-09-02 22:52:06

Harmione
New Scratcher
Registered: 2012-08-21
Posts: 11

How do you make game where there are many levels?

I was wondering how you would make a game that one sprite touches another sprite and you move on to the next level.
Also, while I have your attention. How would I make a sprite jump? Thanks so much!

Offline

 

#2 2012-09-02 22:59:36

stevetheipad
Scratcher
Registered: 2011-08-06
Posts: 1000+

Re: How do you make game where there are many levels?

Scratch doesn't come equipped with a level system (which is good) so you have to build your own. Most people use backgrounds as levels so you can do something like this:

When flag clicked
If <[sprite 1] touching [sprite 2]>
Broadcast [level up]

when I receive [level up]
Set background to [level 2]
Since you will have more than just a background for each scenes, use a variable to save what level you are currently on, and then use if blocks to say "if the variable says it's level two, get all the level two enemies in place (broadcast)".


http://i.imgur.com/0x8ia.jpg
gone

Offline

 

#3 2012-09-02 23:04:24

Harmione
New Scratcher
Registered: 2012-08-21
Posts: 11

Re: How do you make game where there are many levels?

I'm still really knew to Scratch, so can you explain variables to me a bit more?

Offline

 

#4 2012-09-02 23:14:15

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: How do you make game where there are many levels?

A variable is like a slot where you can store a number or a word (also called a string).  You can read the value of the variable, or change the value of the variable.  You can take the variable, and compare it with another value...

<(variable) > ()>
<(variable) = ()>
<(variable) < ()>
You can also perform arithmetic operations on a variable, using the () + (), () - (), (etc.) blocks. 

You can set the value of a variable either with
set [variable v] to []
... or change its value (set it to itself + value)
change [variable v] by []
Your project can have an indefinite number of variables.  They are useful if you need to store current game statistics.  For example, the player's health, attack strength, level, etc.  Storing data and then recalling it -- or using it somewhere in the program -- is the basis for programming in any language.

Last edited by amcerbu (2012-09-02 23:15:47)

Offline

 

#5 2012-09-02 23:18:44

Harmione
New Scratcher
Registered: 2012-08-21
Posts: 11

Re: How do you make game where there are many levels?

Okay, but my problem is more along the lines of:
If I want to say something like:
If sprite 1 touching sprite 2
then

And then that's where I want to find away to switch to another background or level and make "obstacles" or enemies appear.

(By the way, thanks you guys for the help. It means a lot)

Offline

 

#6 2012-09-02 23:24:49

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: How do you make game where there are many levels?

Here's the simplest way to do this:
Put this script in "Sprite1":

when gf clicked
forever
if < touching [Sprite2 v]?>
broadcast [ChangeBG1 v]
end
end
And then put this script in the stage:
when I receive [ChangeBG1 v]
switch to background [BG1 v]

Last edited by amcerbu (2012-09-02 23:37:59)

Offline

 

#7 2012-09-05 21:16:20

Harmione
New Scratcher
Registered: 2012-08-21
Posts: 11

Re: How do you make game where there are many levels?

Thank you! That makes so much more sense!!

Offline

 

#8 2012-09-06 07:42:11

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: How do you make game where there are many levels?


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#9 2012-09-06 14:49:00

JamieBruce
Scratcher
Registered: 2012-08-05
Posts: 52

Re: How do you make game where there are many levels?

stevetheipad wrote:

Scratch doesn't come equipped with a level system (which is good) so you have to build your own. Most people use backgrounds as levels so you can do something like this:

When flag clicked
If <[sprite 1] touching [sprite v]>
Broadcast [level up v]

when I receive [level up v]
Set background to [level 2 v]
Since you will have more than just a background for each scenes, use a variable to save what level you are currently on, and then use if blocks to say "if the variable says it's level two, get all the level two enemies in place (broadcast)".

just a fix!  cool


help my project "the adventures of oreo,sandstone and flopsy"
[url=file:///C:/Users/Jamie/Desktop/JBcaptain/JBcaptain.htmL[/url]

Offline

 

#10 2012-09-07 00:07:44

tree-hugger
Scratcher
Registered: 2011-11-19
Posts: 38

Re: How do you make game where there are many levels?

4 jumping: Find a platform game where you like how the avatar moves (specifically jumps) and use that engine (moving script) in your game, just give credit to the person you took the engine from. You can make a avatar jump a lot of ways so I suggest finding a way that you like. If ur confused with something just tell me  wink
4 next level thing:
You'll need a variable (like this):

(level)
Once you've made that you can get started. Here's ur script:
when gf clicked
set [level v] to (0)
forever
   if <touching [exit door v]?>
      change [level v] by (1)
   end
end
you might also want this script, it goes to the background:
when gf clicked
if <(level) = (1)>
   switch to background [level1]
end
Duplicate the if part 4 each level. Improvise a script like this 4 other sprites (telling the avatar where to go at the start of a level, telling the exit door where to move, instructing baddies to be on the scene etc.). Good Luck  smile

Last edited by tree-hugger (2012-09-07 00:08:36)


http://oi48.tinypic.com/1y7tjr.jpghttp://oi50.tinypic.com/28tb34j.jpg                     http://oi50.tinypic.com/21c6v74.jpg                    ...ya, I'm weird... REAL weird...
BITBOT ALL THE WAY!!!     Only the WEIRDEST games!     (that's just  a Tree-Hugger thing)

Offline

 

#11 2012-09-07 00:25:57

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: How do you make game where there are many levels?

tree-hugger wrote:

4 jumping: Find a platform game where you like how the avatar moves (specifically jumps) and use that engine (moving script) in your game, just give credit to the person you took the engine from. You can make a avatar jump a lot of ways so I suggest finding a way that you like. If ur confused with something just tell me  wink
4 next level thing:
You'll need a variable (like this):

(level)
Once you've made that you can get started. Here's ur script:
when gf clicked
set [level v] to (0)
forever
   if <touching [exit door v]?>
      change [level v] by (1)
wait until <not <touching [exit door v]?>>
end
you might also want this script, it goes to the background:
when gf clicked
forever
if <(level) = (1)>
   switch to background [level1]
end
Duplicate the if part 4 each level. Improvise a script like this 4 other sprites (telling the avatar where to go at the start of a level, telling the exit door where to move, instructing baddies to be on the scene etc.). Good Luck  smile

Fixed.


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

Board footer