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

#1 2012-11-28 07:58:15

MarkWilson123
New Scratcher
Registered: 2012-11-28
Posts: 8

Scoring and levels

Hi. I'm in the middle of a Scratch project and I'm having difficulties with one thing.

The objective of my game is to collect a number of items by killing enemies to proceed to the next level. I managed to do it for the first level, but on the next level, the door I use to get to the next level still shows on the second level when I only want to appear when the player collects a number of items. How do I repeat this and the other levels?

Offline

 

#2 2012-11-29 07:53:45

rlojunior
Scratcher
Registered: 2010-08-11
Posts: 59

Re: Scoring and levels

MarkWilson123 wrote:

Hi. I'm in the middle of a Scratch project and I'm having difficulties with one thing.

The objective of my game is to collect a number of items by killing enemies to proceed to the next level. I managed to do it for the first level, but on the next level, the door I use to get to the next level still shows on the second level when I only want to appear when the player collects a number of items. How do I repeat this and the other levels?

Do you mind post the link of your project?
It'll be easier to see what's your question.

Offline

 

#3 2012-11-29 12:07:53

MarkWilson123
New Scratcher
Registered: 2012-11-28
Posts: 8

Re: Scoring and levels

rlojunior wrote:

MarkWilson123 wrote:

Hi. I'm in the middle of a Scratch project and I'm having difficulties with one thing.

The objective of my game is to collect a number of items by killing enemies to proceed to the next level. I managed to do it for the first level, but on the next level, the door I use to get to the next level still shows on the second level when I only want to appear when the player collects a number of items. How do I repeat this and the other levels?

Do you mind post the link of your project?
It'll be easier to see what's your question.

How do I do that?

Offline

 

#4 2012-11-29 12:22:17

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: Scoring and levels

At the top next to file, click "share" and "share this project online". Did you remember to reset the variable every time you start a new level and not just when the green flag is clicked?


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

#5 2012-11-29 16:15:50

MarkWilson123
New Scratcher
Registered: 2012-11-28
Posts: 8

Re: Scoring and levels

Prestige wrote:

At the top next to file, click "share" and "share this project online". Did you remember to reset the variable every time you start a new level and not just when the green flag is clicked?

Alright. And I'm not quite sure how to do that.

Offline

 

#6 2012-11-30 22:24:05

shpeters
Scratcher
Registered: 2011-12-11
Posts: 100+

Re: Scoring and levels

when gf clicked
forever
if <touching [object v]?>
change [var v] by (1)
end
wait until <(var) = (number)>
broadcast [next level v]
You will need to hide the items after they're collected and you may want to change the variable number according to the number of items in the level.


http://i.imgur.com/bboYO.pnghttp://i.imgur.com/66Yki.gifhttp://i.imgur.com/uLUsl.jpg

Offline

 

#7 2012-12-01 20:38:17

MarkWilson123
New Scratcher
Registered: 2012-11-28
Posts: 8

Re: Scoring and levels

shpeters wrote:

when gf clicked
forever
if <touching [object v]?>
change [var v] by (1)
end
wait until <(var) = (number)>
broadcast [next level v]
You will need to hide the items after they're collected and you may want to change the variable number according to the number of items in the level.

Thanks, but what number do I put in the var = bit? Or do I have to create a new variable called "number"?

Offline

 

#8 2012-12-01 20:58:00

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Scoring and levels

MarkWilson123 wrote:

shpeters wrote:

when gf clicked
forever
repeat until <(var) = (number)>
if <touching [object v]?>
change [var v] by (1)
wait until <not (touching [object v]?)>
end
end
set [var v] to (0)//Added.
broadcast [next level v]
You will need to hide the items after they're collected and you may want to change the variable number according to the number of items in the level.

Thanks, but what number do I put in the var = bit? Or do I have to create a new variable called "number"?

I edited the script above ^^ so that it would work.

Anyway, it depends how you look at it. You could, but then you'd need to set (number) to the number of objects in the next level, or you could use a conditional like this:

<<<<(level) = (1)> and <(var) = [number]>> or <<(level) = (2)> and <(var) = [number]>>> or (more...)>

I hope that this helps!


http://i46.tinypic.com/35ismmc.png

Offline

 

#9 2012-12-02 01:05:09

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: Scoring and levels

MarkWilson123 wrote:

Hi. I'm in the middle of a Scratch project and I'm having difficulties with one thing.

The objective of my game is to collect a number of items by killing enemies to proceed to the next level. I managed to do it for the first level, but on the next level, the door I use to get to the next level still shows on the second level when I only want to appear when the player collects a number of items. How do I repeat this and the other levels?

You could do this:

when gf clicked
set [items collected v] to [0]
forever
if <touching [item v]?>
change [items collected v] by (1)
wait until <not<touching [item v]?>>
end

when gf clicked
broadcast [door show v] //this makes the door show
forever
if <(items collected) > (whatever you want)>
broadcast [door hide v]
end
This works only if I understood you right:
You want it so that the door will show, and once you collect a certain amount of items, it'll hide, and not reappear.
If I got it wrong, please explain a little clearer what you want.

Offline

 

#10 2012-12-02 05:45:29

MarkWilson123
New Scratcher
Registered: 2012-11-28
Posts: 8

Re: Scoring and levels

TorbyFork234 wrote:

MarkWilson123 wrote:

Hi. I'm in the middle of a Scratch project and I'm having difficulties with one thing.

The objective of my game is to collect a number of items by killing enemies to proceed to the next level. I managed to do it for the first level, but on the next level, the door I use to get to the next level still shows on the second level when I only want to appear when the player collects a number of items. How do I repeat this and the other levels?

You could do this:

when gf clicked
set [items collected v] to [0]
forever
if <touching [item v]?>
change [items collected v] by (1)
wait until <not<touching [item v]?>>
end

when gf clicked
broadcast [door show v] //this makes the door show
forever
if <(items collected) > (whatever you want)>
broadcast [door hide v]
end
This works only if I understood you right:
You want it so that the door will show, and once you collect a certain amount of items, it'll hide, and not reappear.
If I got it wrong, please explain a little clearer what you want.

Sorry. I meant I want the door to show when I collect a number of items, not hide. I want the door to hide and wait on the next level and when I collect a number of items again, it shows again. Hopefully you've got it now.

Offline

 

#11 2012-12-02 11:21:37

bubby3
Scratcher
Registered: 2012-11-19
Posts: 44

Re: Scoring and levels

when gf clicked
forever
  if <touching [enemy1 v]?>
    change [items v] by 1
    broadcast [enemy 1 defeated v]
  end
  if <touching [enemy2 v]?>
    change [items v] by 1
    broadcast [enemy 2 defeated v]
  end
end
and
when gf clicked
wait until <(items) > (number)>
change [level v] by (1)
set [items v] to 0

Offline

 

#12 2012-12-03 13:17:06

MarkWilson123
New Scratcher
Registered: 2012-11-28
Posts: 8

Re: Scoring and levels

bubby3 wrote:

when gf clicked
forever
  if <touching [enemy1 v]?>
    change [items v] by 1
    broadcast [enemy 1 defeated v]
  end
  if <touching [enemy2 v]?>
    change [items v] by 1
    broadcast [enemy 2 defeated v]
  end
end
and
when gf clicked
wait until <(items) > (number)>
change [level v] by (1)
set [items v] to 0

Thanks, but do these go in the script of the character I'm playing as or the door I use to get to the next level?

Offline

 

#13 2012-12-03 14:25:50

benjamin2
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: Scoring and levels

bubby3 wrote:

when gf clicked
forever
  if <touching [enemy1 v]?>
    change [items v] by 1
    broadcast [enemy 1 defeated v]
  end
  if <touching [enemy2 v]?>
    change [items v] by 1
    broadcast [enemy 2 defeated v]
  end
end
and
when gf clicked
wait until <(items) > (number)>
change [level v] by (1)
set [items v] to 0

That won't work, because as soon as the items are collected, the next level will start without the player needing to go into the door.


http://i.imgur.com/gp6tZ.gif

Offline

 

Board footer