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

#1 2012-11-25 18:33:57

tman0665
New Scratcher
Registered: 2012-11-07
Posts: 6

Hangman Script Help

So i have this Hangman project due this week. It's suppose to be evil, but i already got that part down(Evil as in keeping the player from winning for as long as possible). There should be 5 Lives. I didn't implement the lives yet. For those 5 lives though, i did make 5 sprites. The Head, body, arms(both together on one spirte), the right leg, and the left leg. Each life taken should make a body part appear. There are 30, 5 letter words in a list that i made called "List of Words". If letter is guessed correctly, that letter should appear in one of the 5 given places. For the letters, i have created 5 separate sprites for each letter, and within those sprites are costumes that are A-Z. I just started doing these type of projects this year, so if you have some constructive criticism you would like to give, i am more than open to them.  smile

Variables i used:
Index
Letter
List Index
Lives
Variable
Word Index

My script so far is below. Note that what i have so far is what makes the script Evil. Like i said above, what makes the script evil is keeping the player from winning for as long as possible, which i have already done below. Now i just need original hangman. My teacher saw my script, and said that i should implement it between the "if else" statement under the If. Thank you for all the help contributed!

repeat until <(length of [possible words v]) = (1)>
ask [letter?] and wait
repeat until <(length of (answer)) = (1)>
ask [letter?] and wait
end
set [list index v] to (length of [possible words v])
repeat until <(list index) = (0)>
set [word index v] to (1)
repeat until <<(letter (word index) of (item (list index) of [possible words v])) = (answer)> or <(word index) > (length of (item (list index) of [possible words v]))>>
change [word index v] by (1)
end
if <(letter (word index) of (item (list index) of [possible words v])) = (answer)>
else //teacher saw script and said that i should implement hangman under the if else statement.
delete (list index) of [possible words v]
end
change [list index v] by (-1)
end
end

Offline

 

#2 2012-11-25 18:37:14

tman0665
New Scratcher
Registered: 2012-11-07
Posts: 6

Re: Hangman Script Help

when i said possible words, i meant "List of words"!

Offline

 

#3 2012-12-12 21:03:29

SheppardProductions
Scratcher
Registered: 2011-08-14
Posts: 100+

Re: Hangman Script Help

that's clever

Offline

 

#4 2012-12-12 21:17:58

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

Re: Hangman Script Help

Do you still need help with this? If yes, then I might be able to help.


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

Offline

 

Board footer