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

#1 2009-07-25 15:31:26

Larry828
Scratcher
Registered: 2007-05-30
Posts: 100+

How make the Score change only 1 unit at a time?

A dot is moving to the right on the screen and hits a red rectangle. Here's the problem I keep finding: as long as the dot is "touching" the rectangle the Score keeps rolling upwards!! If the dot hits the rectangle I'd like the score to change only by +1 or -1, depending on the game. And I want the dot to keep on going, because there are other rectangles to meet. But as the dot emerges from the rectangle the score might have gone from 0 to 118!!!! Reducing the size of the Sprites hasn't solved the problem; the score still rolls up because the Sprites are touching for more than an instant. Solutions would be MUCH appreciated!!!

Offline

 

#2 2009-07-25 15:46:43

The-Whiz
Scratcher
Registered: 2007-07-09
Posts: 1000+

Re: How make the Score change only 1 unit at a time?

Code:

[if <touching [rectangle]>]
[change [score] by (1)]
[wait until <not <touching [rectangle]>>]
[end of if]

That should work.

Offline

 

#3 2009-07-25 15:55:01

greenflash
Scratcher
Registered: 2009-05-27
Posts: 1000+

Re: How make the Score change only 1 unit at a time?

I used to have the same problem... ^^ that helps!


http://i48.tinypic.com/2wrkirk.pnghttp://i46.tinypic.com/6r5zk7.pnghttp://i45.tinypic.com/2vtxr1t.png

Offline

 

#4 2009-07-25 15:56:49

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: How make the Score change only 1 unit at a time?

^ That post will help you  smile
|
|
|


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

#5 2009-07-25 16:12:39

Larry828
Scratcher
Registered: 2007-05-30
Posts: 100+

Re: How make the Score change only 1 unit at a time?

The-Whiz wrote:

Code:

[if <touching [rectangle]>]
[change [score] by (1)]
[wait until <not <touching [rectangle]>>]
[end of if]

That should work.

WOW!!!  That works perfectly!  Really amazing.  And I wouldn't have thought of that in a million years.  Thanks so much: my project is working now.

Offline

 

#6 2009-07-25 16:16:04

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: How make the Score change only 1 unit at a time?

Yeah I figured that out a while ago too it helps so much O.o


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

Board footer