Picking by radius or "Volume Box"

Get help using Construct 2

Post » Wed Sep 19, 2012 6:17 pm

Hello

I need advice on what would be best approach for this example.

When character has magnet mode on, if there are Type: Large Metallic objects in certain radius player will be drawn to it, and if there are Type: Small metallic objects in radius they will be drawn to player.

there is only 1 character and could be many metallic objects, should i attempt radius calculations or try whats seems to be simpler attach volume box to character and try picking overlapping objects?
B
24
S
7
G
3
Posts: 138
Reputation: 2,795

Post » Wed Sep 19, 2012 6:56 pm

Either way really. The only issue is when using system expressions to pick, you will need to use a for each on the object that will do the picking.
For each magnet distance(self.x,self.y,annode.x,annode.y) < n do stuff.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Wed Sep 19, 2012 7:15 pm

oh thanks!
I didn't know there was distance expression.

i came up with something of my own, and just out of curiosity can't figure out why its wrong ;/


:D my idea was that if difference between X was larger than radius (6) it would return positive amount and when added to Objects X the result would be automatically more then Objects X and event would not trigger.

oh nvm figured out
it was to be greater then or equal tohellwalker2012-09-19 19:20:34
B
24
S
7
G
3
Posts: 138
Reputation: 2,795

Post » Wed Sep 19, 2012 7:24 pm

Well that's just x. If you want to go that way then I would suggest the overlapping at offset condition.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Wed Sep 19, 2012 7:40 pm

nah distance is cleaner thanks :D

I was just curious why it didn't work at first



ended up with something like this, now Just have to figure out how to stop objects pushing when they already collided with target "Magnet"
otherwise smaller objects fly the robot offscreen :D
B
24
S
7
G
3
Posts: 138
Reputation: 2,795

Post » Wed Sep 19, 2012 8:01 pm

hm weird, when I use distance all objects regardless of distance are affected, when using X comparison with combo with Y comparison
only objects close enough get impulse
I got i must use picking command in combo with distance but not sure how :S

hellwalker2012-09-19 20:03:18
B
24
S
7
G
3
Posts: 138
Reputation: 2,795


Return to How do I....?

Who is online

Users browsing this forum: h1k3, Unconnected, Yahoo [Bot] and 0 guests