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

#1 2010-02-18 17:22:25

yesscratchthatno
Scratcher
Registered: 2010-01-25
Posts: 1

i need help to make something to keep score

Im trying to make a score keeper tht says when a sprite picks up an item (press space on this item, that item hides) and the variable score changes by 1. the problem with this is that when i press space on the item, the score goes up by 0 or any number higher than 1
Do you have any better ways to keep score??

Offline

 

#2 2010-02-19 00:28:52

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: i need help to make something to keep score

Are you using the [change [Variable] by (1)] block? Make sure it's a 1.

So the score won't change rapidly when you hold space, use a variable to stop you from increasing the score when you've already gotten the item.


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#3 2010-02-20 11:57:04

AmoebaMan
Scratcher
Registered: 2009-01-26
Posts: 500+

Re: i need help to make something to keep score

wait, that didn't work. i wuz trying to use the blocks... alright, i'll write it out for you. here

if the problem is wat it sounds like (score is increasing rapidly cuz the key is held down) then this will fix it for you.  it will increase the score and then wait until the key isn't pressed to change it again

when green flag clicked
  forever
  [
    if <<key (space) pressed> and <touching (object)>>
    [
    change variable (var) by (1)
    wait until <not<touching (object)>>
    ]
  ]


http://i942.photobucket.com/albums/ad269/RyanScathe/AmoebaMan.png

Offline

 

#4 2010-02-20 12:59:01

Greenboi
Scratcher
Registered: 2010-01-30
Posts: 1000+

Re: i need help to make something to keep score

how about:

Code:

When flag clicked
]
Forever-
If-
[Touching object and [key space pressed]
[Change variable score by 1]
[

If that doesn't work, recheck your scripts a couple times.  wink

Offline

 

Board footer