somethings can't be done within construct 2

Just started using Construct 2? Post your questions here

Post » Thu Jun 23, 2016 3:25 pm

Hello

I have some square sprites
with random colors (red or green) only
check this image : http://i.imgur.com/zszA9ay.png
when user click on a square , I need to flip the color of the rounded sprites
for example (if the user clicked on the square with index 8)
it should flip the color of the rounded squares
the rounded squares (8 squares) for a square with index 8
1-top-left one with index (8 - (columns count - 1))
2-top one with index (8 - columns count)
3-top-right one with index (8 - (columns count + 1))
4-left-one with index (8-1)
5-right-one with index (8+1)
6-bottom-left one with index (8 + (columns count - 1))
7-bottom one with index (8 + columns count)
8-bottom-right one with index (8 + (columns count + 1))

this image is my try : http://i.imgur.com/M2pSw8t.jpg
I tried too many - but not works
it's very easy to do that with some coding
but I can't do that with construct 2
it need coding to be done , or what ??
B
16
S
6
G
2
Posts: 31
Reputation: 2,196

Post » Thu Jun 23, 2016 3:40 pm

I don't think that's how Uid's work.
Try assigning a variable to each instance, and picking by that.
Image ImageImage
B
168
S
50
G
164
Posts: 8,231
Reputation: 105,581

Post » Fri Jun 24, 2016 9:04 pm

Construct will require a bit of different thinking than normal if you come from another programming/scripting language.

There are generally many ways to do any given task, but I find that using invisible helper sprites can solve most picking issues so I always recommend that. Here is an example - https://www.dropbox.com/s/48m3q1xuhf0vb ... .capx?dl=0

Edit: Just in case you are not familiar with picking, I'm going to leave this little bit of required reading here as well - https://www.scirra.com/manual/75/how-events-work
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Fri Jun 24, 2016 11:31 pm

@frodoe7

Is this what you want to do ?

https://www.dropbox.com/s/hkcb2k5w9raid ... .capx?dl=0
B
33
S
18
G
28
Posts: 2,474
Reputation: 20,912

Post » Sat Jun 25, 2016 12:34 am

Yes
all these solutions worked well
I will try to understand how these events/actions work to can complete the game well
B
16
S
6
G
2
Posts: 31
Reputation: 2,196

Post » Sat Jun 25, 2016 1:14 am

you are calling a function with a parameter, but not using said parameter.

create a local variable in your function, and assign it to param(0)
B
41
S
17
G
8
Posts: 484
Reputation: 8,261

Post » Sat Jun 25, 2016 9:03 am

I mad a few dumb mistakes. Here goes.

https://www.dropbox.com/s/scbly2vm4k4ny ... .capx?dl=0
B
33
S
18
G
28
Posts: 2,474
Reputation: 20,912


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest