Array Pattern Check

For questions about using Classic.

Post » Sat Feb 09, 2013 7:29 pm

[quote]--------------------------------------------------------------
"Unfortunately I usually only reply after implementing a solution that works."

I don't know if that was a jab at me personally, but

If not:
-----> I think the best method to help teach people is one of cooperation and joint trial and error. Teach a man to fish and all that.

if so:
----->go &*@# yourself.

-------------------[/quote]
There was no jab intended. I was simply stating how I operate.

EDIT:
@RandomDood here is the flood fill cap example:
http://dl.dropbox.com/u/5426011/examples16/floodfill.capR0J0hound2013-02-09 19:47:54
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Sat Feb 09, 2013 8:46 pm

well then I'm sorry for any perceived ill will.

I know feeling in text can be easily misunderstood

thus my boolean responseBartosh2013-02-09 20:48:08
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

Post » Sat Feb 09, 2013 9:15 pm

Both of you helped me out a lot. I am actually going to see if I can use both of these. I'm an artist and not very good with programming so R0J0hound's example is a bit easier to understand. But I do have some basic programming knowledge and experience with arrays so I have an idea how I can use arrays to add in a bonus feature I have been thinking about.

I may have more array questions down the road though.

Just out of curiosity, does it make a difference when using either an object focused "coding" or an array/programmer focused "coding" in construct 2 and or classic? Is one faster than the other, less errors, less processor heavy, or more optimized?

Thanks again
B
3
S
1
Posts: 59
Reputation: 568

Post » Sat Feb 09, 2013 9:36 pm

Using an array would be faster for the flood fill, but it may take more events.
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Sun Feb 10, 2013 1:51 am

Cool It works. Now all i need to do is figure out a way to group the objects if they are matching and I'll be done.(mostly) Kind of like:

http://www.scirra.com/forum/picking_topic62950.html?KW=pick

but updating each block to a group in real time.

Edit: This is possible right? It would make me feel better knowing I have just be doing something and not something impossible.

Update: Finally figured out something that works. Its not perfect but at least its something.

Thanks again for your help.RandomDood2013-02-10 07:50:34
B
3
S
1
Posts: 59
Reputation: 568

Post » Sat Feb 16, 2013 4:08 am

I actually got a little off topic from this post title. How would I go about getting an array to reading a bunch of different patterns? Would I have multiple .txt files each with a pattern in it?
IE.

file 1
-111-
--1--
-111-


file 2
11111
1----
111--

etc.

Also I am assuming it is possible to offset the pattern check right?

IE.

Pattern
1---1
11-11
-111-

Array with the pattern.
-------
-------
--1---1
--11-11
---111-RandomDood2013-02-16 04:09:50
B
3
S
1
Posts: 59
Reputation: 568

Post » Sat Feb 16, 2013 7:09 pm

You could use separate txt files or one text file with the patterns comma separated. There is also ini files or using this utility to load directly into an array:
http://www.scirra.com/forum/utility-2d-array-editor_topic41701.html

If you don't want external files then you could use python or a text object with all the text.

Here I used a text object with the patterns comma separated. The only quirk I had to deal with is getting rid of the LineFeeds. In windows pressing enter adds 2 characters: a newline and a linefeed.
http://dl.dropbox.com/u/5426011/examples16/pattern_match.cap
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Sat Feb 16, 2013 9:29 pm

WHAO! This array editor is amazingly nice and convenient.
B
3
S
1
Posts: 59
Reputation: 568

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests