Comparing locations

Get help using Construct 2

Post » Wed Nov 20, 2013 5:40 pm

Hi
I have three sprites and I'd like to compare the X values of each (to see if they're in a line). I've had a look at "for each" and other methods but can't seem to make it work. Is there any way to compare 3 instances in this way?

Thanks!
Matthew
B
12
S
3
Posts: 37
Reputation: 1,111

Post » Wed Nov 20, 2013 6:05 pm

This is one way, but there are many more!Tobye2013-11-20 18:06:39
B
28
S
8
G
5
Posts: 429
Reputation: 7,007

Post » Wed Nov 20, 2013 6:18 pm

Thanks I'll take a look!
B
12
S
3
Posts: 37
Reputation: 1,111

Post » Wed Nov 20, 2013 7:06 pm

Hi
I've tried that but I'm having issues with the f.param(0) line. I've tried writing this value to a textbox on screen but it's always showing 0. I've added in all of the code and the rest of it seems to work but that. Could you give me any help with this?

Thanks
B
12
S
3
Posts: 37
Reputation: 1,111

Post » Wed Nov 20, 2013 7:37 pm

Why not just use 2 conditions instead?

a.x = b.x
b.x = c.x

or if it is the same object, something like:

pick the one sprite you wanna check, set a local variable to the x of the sprite

after that

pick all
pick by comparison, x = localvariable
if sprite.pickedcount = 3: do stuffmindfaQ2013-11-20 19:49:07
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Wed Nov 20, 2013 7:48 pm

Thanks - I think I've got it working with the function.
B
12
S
3
Posts: 37
Reputation: 1,111


Return to How do I....?

Who is online

Users browsing this forum: Elliott, kellehk, rollyzz, Voytek and 21 guests