Array Checking

Get help using Construct 2

Post » Thu Jul 19, 2012 8:18 pm

My subject probably makes no sense, but I wasn't sure how to explain it.

I'm making a word search game. The game works great right now, but there is a ton of code and I am wondering if there is a way to shrink it.

I'm using an array to store a 1 or 0 value for each letter in the grid.

I am using that to check if a word is formed. When a letter is clicked on, it turns the array index of that letter to a 1.

Say the word is bat at position 1,2,3. I check if array.at(1) and array.at(2) and array.at(3) are = to 1. If so, that word is found. however, I also need a condition if all the other letters are set to 0. So for each word there is 26 lines of actions.

Is there anyway to shrink this? Eventually I would like to just create strings of data to build new boards and have a Key variable has the key for each board.

I hope that makes sense.

B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Thu Jul 19, 2012 8:22 pm

Posting your capx would probably help visualize exactly what you're meaning.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Thu Jul 19, 2012 8:29 pm

Yeah sorry. Completely spaced it

For my sake, I currently don't have any of the Check for 0 conditions, only because it's a ton of work and I wanted to know if there was another way first.

www.edfarias.com/word.capxArcadEd2012-07-19 20:31:02
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Thu Jul 19, 2012 11:03 pm

I'm thinking maybe there isn't an easy way to do this LOL.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Thu Jul 19, 2012 11:15 pm

Instead of checking with events, you could make a variable for your txtWords which stores a list of the txtGame.IIDs then you could just check with a pattern in events.
http://dl.dropbox.com/u/5426011/examples12/ArcadEd.capx r99
edit: The array object isn't used anymore.

Also here is another way of doing something similar:
http://www.scirra.com/forum/word-search-game_topic44971.html
B
79
S
24
G
54
Posts: 4,754
Reputation: 40,771

Post » Thu Jul 19, 2012 11:54 pm

Thanks man, that is really awesome. I'm still trying to wrap my head around exactly what you did. If I have any questions I will post.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Fri Jul 20, 2012 12:00 am

OK, I figured it out. Genius man, I didn't even think of using the instance variables :). Thanks again. I learn so many new things about construct every day.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Fri Feb 01, 2013 9:01 am

@ArcadEd. Hi I just wonder if your word search game was been made?! :) because all the links presented are server error . :((
B
4
Posts: 4
Reputation: 508

Post » Fri Feb 01, 2013 1:44 pm

YEah, it's been on the windows, apple and google stores for several months now. It was the first game I finished and published :).

https://itunes.apple.com/us/app/word-search-4-kids/id564990078?ls=1&mt=8ArcadEd2013-02-01 13:44:33
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Tue Mar 05, 2013 1:13 am

@R0J0hound

Heeeeelp!! What should i do. If all the words were found. How should i put it on next layout?

its system then Compare two values then: " what should i put to know if all the words in 'txtWord' is found "

before i make an action: system go to next layout.

thanks in advance
B
4
Posts: 4
Reputation: 508

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests