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

#1 2011-12-24 20:50:09

TSAgal
New Scratcher
Registered: 2011-02-17
Posts: 4

Rock Paper Scissors Woes.

I am horribly complex in my codes so, when i screwed up my current project i am having trouble fixing it. This project is a two player RPS. I love using broadcast so I always use it. This Project is a two player RPS. Well, this does not work with my current project. It wold take to long to put all the blocks in ,but what it does is when my countdown gets to below zero it broadcasts a message of what the player chose as their thing, but since each interacts with all the other items then I have multiple sprites responding to one broadcast and causing a chain reaction. I need something to fix this or an alternate method.

Offline

 

#2 2011-12-25 07:58:57

SJRCS_011
Scratcher
Registered: 2011-02-07
Posts: 1000+

Re: Rock Paper Scissors Woes.

Use variables or broadcasts specific to each sprite.


http://i.imgur.com/vQqtH.png
Learning to Program in a Nutshell:  "You're missing a closing parentheses" - LS97

Offline

 

#3 2011-12-26 13:37:06

TSAgal
New Scratcher
Registered: 2011-02-17
Posts: 4

Re: Rock Paper Scissors Woes.

Well I have a different broadcast, but I think my real problem is determining the outcome.

Offline

 

#4 2011-12-26 22:36:08

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: Rock Paper Scissors Woes.

I don't really think that you're able to do 2 player things on Scratch, so it is better to do it against the computer.
For the computer:
To determine a random outcome, you can do this:
<when green flag clicked>
<switch to costume[ <pick random( 1 )to( 3

Of course, if you want, you can make more things before and after. That code should make it so that it will pick random, (rock, paper, scissors).

If you want to make it always pick the same object, do this:
<when green flag clicked>
<switch to costume[ rock ]

Hope that helps!  smile


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

Board footer