How do I allow any object to be dropped while check if valid

Get help using Construct 2

Post » Sun Mar 27, 2016 12:50 am

I have a game that has multiple like objects, I can get it to validate if I only allow for example animation frame 8 to instance 8 emptyBox. I can drag items of the same angle if I set less than or equal to for the animations frame but when I add the last item it doesn't come back with a completed "I Win".

I am new to construct and normally in java use (1,4) to allow both anim 1 and 4 to be accepted and correct. I'm sure I'm missing something simple but for the life of me I haven't found the correct term to search or more likely I'm making an easy task harder than it needs to be. my capx is attached

https://www.dropbox.com/s/e94d3603lovhs0k/GridsBasic.capx?dl=0

Any help you can provide will be greatly appreciated.
B
29
S
10
G
3
Posts: 69
Reputation: 3,515

Post » Sun Mar 27, 2016 4:21 am

If I'm not wording this correctly please do let me know.
B
29
S
10
G
3
Posts: 69
Reputation: 3,515

Post » Sun Mar 27, 2016 6:39 am

Something like this?

https://www.dropbox.com/s/xme59dsi2yahn ... .capx?dl=0

I think you were looking for the "Or" block, which can be done by right clicking an event condition.

I added a couple other things as well - No two lines can be dropped in the same place, picked up again after being placed correctly, and it doesn't matter which line you place in which position as long as it is the correct angle, it will count towards the goal. I don't know if this is what you want though.

To save some work later, you don't need to give every emptybox/line unique instance variable IDs/animation frames, all the ones with the same orientation can be the same (0, 1, 2, 3, and 4 can just be 0; 5, 6, 7 can be 1; and 8 can be 3). Also, given that all your animation frames are the exact same sprite, you should probably use either the angle of the sprite or another instance variable instead of the animation frame to differentiate between the types of lines.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,579
Reputation: 60,299

Post » Sun Mar 27, 2016 7:16 am

That was exactly what I was looking for, much appreciated and so much more concise than my brain made it. I'm now going to try and wrap my head around what I believe you mean in the last paragraph.

If I understand correctly for say the vertical line emptyBox I could use instance 0 and then just duplicate the number of times needed and the same with the vertical lines themselves thus I could spawn more vertical lines if I wanted and they would work.

Also the set drag drop disabled after drop was something I was trying to figure out since I kept dropping lines into the same containers.

Thanks again for such a concise and well explained fix, as a newbie you are a godsend.
B
29
S
10
G
3
Posts: 69
Reputation: 3,515

Post » Sun Mar 27, 2016 7:48 am

just a thought..

dragLines.capx
Image
B
63
S
23
G
7
Posts: 1,480
Reputation: 10,796

Post » Sun Mar 27, 2016 8:18 am

That is an interesting take as well Korbaach. A major part of my task with this is to have the lines moving but that looks like it should be easy enough though now I have overlapping lines myself when they come back in from out of bounds. One thing I noticed was that second batch of lines was short of the number the master grid was producing is it that the lines produced are possible outside the bounds of the layout? I must add how amazing it is that you guys take the time to work out other peoples issues.
B
29
S
10
G
3
Posts: 69
Reputation: 3,515

Post » Sun Mar 27, 2016 8:53 am

Image
B
63
S
23
G
7
Posts: 1,480
Reputation: 10,796

Post » Wed Mar 30, 2016 10:32 pm

Hey guys, I've been playing around with both of your capx files and both have really awesome features. I have a couple questions on them.
oosyrag I can drag and drop them but when it passes over the first available drop spot it snaps to it and doesn't let me drag it any further, is there a drop only on release option that would let me pick the destination I want to drop the lines?

Korbaach, I love the random create on yours but I can't figure out how after completing the first puzzle it is creating the second puzzle with more lines in the master map than are generated to drag. I have changed both the chooseLine function repeat and the dragline onPlace but it doesn't seem to make any difference minus the number of draggable items that are created.
B
29
S
10
G
3
Posts: 69
Reputation: 3,515

Post » Wed Mar 30, 2016 11:28 pm

yea..sorry..I forgot to set previous lines invisible...
you need to add action:
Image
anyway..I fix the dragLinesBullet.capx and added a new variable lineNumber
so.. every time you solve the "map" ..you get another line...
Image
B
63
S
23
G
7
Posts: 1,480
Reputation: 10,796

Post » Thu Mar 31, 2016 4:09 pm

Thanks, very useful information.
B
29
S
10
G
3
Posts: 69
Reputation: 3,515


Return to How do I....?

Who is online

Users browsing this forum: htmlgames and 5 guests