Items moving on conveyor belt

Get help using Construct 2

Post » Tue Mar 07, 2017 5:17 pm

I am trying to make items move along a conveyor belt and stop and queue up behind each other when they have no where to go,

It mostly works with
Code: Select all
item is over lapping belt right
item is overlapping item(Inverted)

set x to self.x+1


This works fine until they need to move again and as they are overlapping the will not move.

i have tried using distance(item.x,item.y,item.x,item.y) < 10 then move but i think i need some sort of picking instance here as it compares itself to itself i assume.

any offer on an efficient way to do this, i have browsed the forums and tried other ways such as line of sight but still no luck
B
3
Posts: 6
Reputation: 187

Post » Wed Mar 08, 2017 10:00 am

John Locke wrote:any offer on an efficient way to do this, i have browsed the forums and tried other ways such as line of sight but still no luck

There is a Pick nearest/furthest condition you could use to select the item closest to the end of the conveyor belt.

So, assuming the belt object has origin in the middle, you could do something like this:
Code: Select all
[event]item is over lapping belt_right
[sub-event]item is overlapping item(Inverted)
or
pick nearest item to (belt_right.X + (belt_right.Width/2), belt_right.Y)

[action]set x to self.x+1
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
33
S
9
G
7
Posts: 450
Reputation: 6,780

Post » Wed Mar 08, 2017 2:27 pm

Hey man thanks for the reply,

This did not work either seems to just move the one closest to the edge and the others stay still until the first one has reached the end.

I tried what you said multiple ways and with/without 'or'

I also tried [pick nearest to (self.x+self.width/2) which also didn't work

Heres a capx if its any help

dropbox.com/s/nojwo9y9fx2jrd4/conveyor2.capx?dl=0
B
3
Posts: 6
Reputation: 187

Post » Wed Mar 08, 2017 2:51 pm

That capx is a bit different to the code you posted, being physics based and seems to work fine.

Anyway, this change using is overlapping at offset should allow the other boxes to move once the one to the right of them has moved away a small distance:
Code: Select all
item is over lapping belt right
item is overlapping item at offset (2,0) [Inverted]

set x to self.x+1
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
33
S
9
G
7
Posts: 450
Reputation: 6,780

Post » Wed Mar 08, 2017 3:47 pm

Overlap at offset would work best for that.

Overlap is good for reading a position but not for stopping the overlap.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Wed Mar 08, 2017 4:08 pm

That worked a treat, had tried overlap at offset the other night but didn't work, was very late when i tried so who knows what numbers i put with it haha

Thanks for your time, much appreciated.
B
3
Posts: 6
Reputation: 187


Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi, Yahoo [Bot] and 7 guests