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

#1 2010-09-03 23:20:58

M303MTL
New Scratcher
Registered: 2010-09-03
Posts: 12

Scoring

I apologize for posting another topic so soon after my last one, but I've spent the better part of an hour trying to find a solution for what seems like it should be really simple.  Basically, in this same pong clone I made the last topic about, I want a player's score to go up by 1 when the ball hits the wall behind the enemy's bar.  No matter what I try, I can't get the number to go up.  I've tried making a colored bar as a goal of sorts and increasing the variable when they touch, and I've tried broadcasting a switch upon contact with the goal.  Even trying to just put it as a score whenever it hits any edge doesn't change the score variable for some reason.

I'm sure it's really simple but has somehow deceived me, but how do I make it so when it hits the goal the score goes up?

Offline

 

#2 2010-09-03 23:23:57

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Scoring

Hm… It sounds to me as though that would work, too. Could you post the script here so we can take a look at it and make any changes or improvements that may be necessary? thanks!

Offline

 

#3 2010-09-03 23:31:51

M303MTL
New Scratcher
Registered: 2010-09-03
Posts: 12

Re: Scoring

[blocks]<if><touching color[ goal color ]
<broadcast[ Score on 1 ][/blocks]


and i've tried replacing that "if" bracket with a "forever if" bracket

Then in the stage script (it could be in any, right?)

[/blocks]<when I receive[ Score on 1 ]
<change{ P2 }by(1)[/blocks]

Offline

 

#4 2010-09-03 23:40:12

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Scoring

Interesting… And you have the green flag atop the first script, correct?

Make sure the first script is a "forever if" - and insidei it, place this script:

Change score by 1
Wait until <not <touching colour of goal> >

And everything should work… You don't need to use broadcasts.

Offline

 

#5 2010-09-03 23:46:16

M303MTL
New Scratcher
Registered: 2010-09-03
Posts: 12

Re: Scoring

Thanks a lot for the help man, sorry for my incompetence  sad

Offline

 

#6 2010-09-03 23:49:42

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Scoring

M303MTL wrote:

Thanks a lot for the help man, sorry for my incompetence  sad

Are you kidding? Don't bring yourself down- everyone has to learn at some point! People aren't just born able to do things! Don't be so hard on yourself  smile


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#7 2010-09-04 05:48:22

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Scoring

M303MTL wrote:

Thanks a lot for the help man, sorry for my incompetence  sad

No problem - but you're nowhere near being incompetent. Keep in mind that my first game was absolute rubbish, and look at my last game, and you'll see where learning takes you.

Offline

 

Board footer