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

#1 2012-04-30 15:29:52

dracolich101
New Scratcher
Registered: 2012-03-02
Posts: 2

Scrabble

Hi guys,

So a friend and i have been trying to create a scrable game in scratch, but we're having quite a hard time figuring out how to do some things, so we were wondering if someone on here could help us. There are three things we're having a hard time with.

1. How can we make the sprites snap into the squares that are meant for them?
2. How can we make a script that senses whether 2 or more blocks are touching each other?
3. How can we make a script that checks whether the words that are made exist in our wordbook (A list of the words that can be made)?

If i didn't formulate the questions clearly enough please say so and i shall try my best ex make a more detailed

Offline

 

#2 2012-04-30 17:06:26

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: Scrabble

Hey there!  smile
1) you can tell the blocks to go to a rounded position instead of the real position, which gives the impression of the blocks 'snapping' together.

(Round (mouse x / 15)) x 15

Replace the 15 here with the length of your squares for the letter blocks. See if that works  smile

2) For 2, im not completely sure what you're asking for  tongue

3) Make a list and add to it the entire word bank, one word per item. Then use an if statement which checks if the wordbank list 'contains' item (word) - if so its all good, if not the word doesn't exist or isn't in the word bank  smile

I hope some of this helps you, good luck with your game guys!  smile


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

#3 2012-05-01 01:48:55

dracolich101
New Scratcher
Registered: 2012-03-02
Posts: 2

Re: Scrabble

Thanks a lot  big_smile

I'm just going to formulate question 2 differently.

2. Since we have different sprites for each of the letters that you have, we need to find a way to make sure that all the sprites that connect make a word, not just, let's say, 2 of them. So we need to find a way to make the game sense, that there are more than 2 letters in this word.

Hope that makes the question more understandable  tongue

Offline

 

#4 2012-05-02 18:17:17

BetaSmozzick
Scratcher
Registered: 2012-02-25
Posts: 51

Re: Scrabble

...That's still pretty hard to understand.

Do you mean that it needs to detect if a placed tile sprite is helping to form more than one word?

If so then I recommend storing every letter that you place in a list so that you can check if the space above, to the left, to the right, or above contains a letter and, if it does, check if the word exists for each.

If not so then I have no idea what you are saying o.O

Last edited by BetaSmozzick (2012-05-02 18:17:24)

Offline

 

#5 2012-05-06 08:17:52

alhadream
Scratcher
Registered: 2012-05-05
Posts: 25

Re: Scrabble

Prestige wrote:

Hey there!  smile
1) you can tell the blocks to go to a rounded position instead of the real position, which gives the impression of the blocks 'snapping' together.

(Round (mouse x / 15)) x 15 
Replace the 15 here with the length of your squares for the letter blocks. See if that works  smile

2) For 2, im not completely sure what you're asking for  tongue

3) Make a list and add to it the entire word bank, one word per item. Then use an if statement which checks if the wordbank list 'contains' item (word) - if so its all good, if not the word doesn't exist or isn't in the word bank  smile

I hope some of this helps you, good luck with your game guys!  smile

fixed


http://chzgifs.files.wordpress.com/2012/05/funny-gifs-how-to-get-your-cat-off-the-ipad.gifhttp://images1.wikia.nocookie.net/__cb20110430014360/mspaintadventures/images/thumb/5/57/ERIDANSLUSUS.gif/180px-ERIDANSLUSUS.gif

Offline

 

#6 2012-05-07 01:31:09

Happypieman
Scratcher
Registered: 2010-09-28
Posts: 100+

Re: Scrabble

I can just imagine how complicated this is going to be. Maybe for 3, could you use the 'If distance to' block, and you then cannot place the tiles in a diagonal because a diagonal path is longer than a straight one if you are using any angle.


2012--The biggest troll ever.

Offline

 

#7 2012-05-07 06:09:12

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: Scrabble

If I understand correctly for your second question you want to make the game sense the word that the player is creating? Indeed this is tricky. If you have 1 sprite for the letter, with all the letters as different costumes you can name all of the costumes the letter the represent (eg name the costume for D, D). You could then try and use something like this when checking if the word exists.

When the player puts down their letter, add them to a list called "word". Get the player to add letters in the order of the word, so 'carrot' would be c,a,r,r,o,t and not t,o,r,r,a,c. Add the costume to the list 'word' by [add 'costume of letter' to 'word']. Then once the word is complete (make 2 new variables called 'word check' and counter);

set counter to 1
repeat length of 'list word'
set 'word check' to JOIN 'wordcheck' and item 'counter' of word
change counter by 1

if 'list word bank' contains word check
     word is ok
else
    word doesn't exist

I cannot help you too much more here because its hard for me to visualise when writing it but you're going to have to have a play around. Let me know if you come up with anything  smile

Last edited by Prestige (2012-05-07 06:10:36)


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

Board footer