How do I Keep Two objects near eachother

Get help using Construct 2

Post » Thu Apr 03, 2014 10:07 pm

hmm nothing in the code that you posted seems to be wrong. Can you try to post a Capx of the whole project?
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Fri Apr 04, 2014 10:16 am

Not much to go on need CAPX to look at
B
256
S
39
G
15
Posts: 1,983
Reputation: 41,036

Post » Sat Apr 05, 2014 9:02 pm

Hopefully this is useful to finding a solution to my problem. CapX attatched
You do not have the required permissions to view the files attached to this post.
B
28
S
8
G
1
Posts: 226
Reputation: 2,865

Post » Sat Apr 05, 2014 10:46 pm

I have thought of two possible solutions but would love some help in implementation.

1. Pick the nearest line piece from the top and spawn the next piece from it.
-What I need help with-
I dont know how to actually pick the nearest piece. Or rather, I dont know how pick nearest works.
Code: Select all
Pick Nearest Line
{
  Line spawn(another line)
}

That is sort of how I thought things should work. I have the condition set as pick nearest line. and then the action is for lines to spawn the next piece.

Anyways an explanation on using pick nearest would be awesome.



2. My other idea is to use the check overlapping offset.
I ran into the problem of this seemingly not working at all...
I tried to stop it from picking the bottom line with an inverted pick bottom object. But still I would need some help with this method as well.

Those are my two new ideas of implementation.

But I still need help with either my former code, or these new ideas.
B
28
S
8
G
1
Posts: 226
Reputation: 2,865

Post » Sat Apr 05, 2014 11:52 pm

I looked at it, and it seems like it just cant keep up, for some reason. Not sure how to solve something like that. I tried to just use a every tick and set the Y value, but it was the same thing. Not sure it will work even with a pin or overlapping check, if it cant keep up without. It might be more solid, but might result in it seeing like its lagging or something. Maybe someone have made something similar that have a solution.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Sun Apr 06, 2014 6:31 pm

nimos100 wrote:I looked at it, and it seems like it just cant keep up, for some reason. Not sure how to solve something like that. I tried to just use a every tick and set the Y value, but it was the same thing. Not sure it will work even with a pin or overlapping check, if it cant keep up without. It might be more solid, but might result in it seeing like its lagging or something. Maybe someone have made something similar that have a solution.


I think the best thing to try at this point is to have the line pieces also spawn the new lines from themselves. I think then, I wont have to worry about lines separating over time.

Do you think you could help me with using pick nearest/pick top object.
Not exactly sure how this works and how to use it properly.
B
28
S
8
G
1
Posts: 226
Reputation: 2,865

Post » Sun Apr 06, 2014 9:43 pm

I think the best thing to try at this point is to have the line pieces also spawn the new lines from themselves. I think then, I wont have to worry about lines separating over time.

The problem is that it shouldn't matter from what I can see, the problem occurs as the speed get to high. The way you have already done it with the custom movement is as far as I know the most basic way of doing it. Meaning that you simply apply the same speed to all objects and checking the debugger and the different lines, it does indicate that they are all in fact moving at the same speed. And that the problem happens within a very few ticks, maybe 1 or 2 I would guess. So exactly where and why it goes wrong im not sure. But if the most basic way of doing it doesn't work. I cant see how adding more complexity will help. And its not a consistent problem, some of them works fine, and doesn't seem to be linked to any specific lines, but just random ones at random times, but definitely as the speed increases it becomes more and more. I have checked the imagepoints to see if it could have been one of them that was off, but that doesn't seem to be the case. But I would like to know the solution as well. But at the moment I don't have time to try to solve it as im not really sure where the problem is in the first place.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Mon Apr 07, 2014 12:48 am

nimos100 wrote:
I think the best thing to try at this point is to have the line pieces also spawn the new lines from themselves. I think then, I wont have to worry about lines separating over time.

The problem is that it shouldn't matter from what I can see, the problem occurs as the speed get to high. The way you have already done it with the custom movement is as far as I know the most basic way of doing it. Meaning that you simply apply the same speed to all objects and checking the debugger and the different lines, it does indicate that they are all in fact moving at the same speed. And that the problem happens within a very few ticks, maybe 1 or 2 I would guess. So exactly where and why it goes wrong im not sure. But if the most basic way of doing it doesn't work. I cant see how adding more complexity will help. And its not a consistent problem, some of them works fine, and doesn't seem to be linked to any specific lines, but just random ones at random times, but definitely as the speed increases it becomes more and more. I have checked the imagepoints to see if it could have been one of them that was off, but that doesn't seem to be the case. But I would like to know the solution as well. But at the moment I don't have time to try to solve it as im not really sure where the problem is in the first place.



My guess as to the problem. Is like you said, over time the way speed works causes this separation. However I think it becomes an issue because the spawn rate is determined when an object gets destroyed. As things get faster, they might hit or detect a collision with the "end line" later or further away than they should.

I did an experiment. Destroy the lines when they exit the layout. This actually made some decent improvements. It took much longer for the issue to occur. I think this is because the detection for leaving the layout is more efficient and accurate than the collision check.

So I believe because when speed goes faster it moves more pixels at a time. That means that eventually it will move a large amount before getting destroyed(the collision would be in the middle of the object) and consequently make the next piece spawn with that gap.(when an object is destroyed a new one is made).

I don't actually find speed to have a problem keeping up necessarily. If you notice, even with the gap. Objects move the same speed and that gap stays consistent as it grows.(I am also using 144hz monitors which let me see this gap pretty clearly as it moves)
My new theory and I would go as far as a solution removes the possibility of this gap altogether. If each line segment is capable of spawning a line on itself, there can never be a gap.

At least I think that makes sense enough :D Normally as I type this I might realize the idea was only in my head but it still is making sense to me so I will keep playing with getting this to work :P
B
28
S
8
G
1
Posts: 226
Reputation: 2,865

Post » Mon Apr 07, 2014 12:55 am

My guess as to the problem. Is like you said, over time the way speed works causes this separation. However I think it becomes an issue because the spawn rate is determined when an object gets destroyed. As things get faster, they might hit or detect a collision with the "end line" later or further away than they should.

Yeah this crossed my mind as well, and might be the problem.

At least I think that makes sense enough :D Normally as I type this I might realize the idea was only in my head but it still is making sense to me so I will keep playing with getting this to work :P

It might very well work, please post the solution when you have solved it, would like to see it as well.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Mon Apr 07, 2014 6:27 am

I cant seem to get any sort of "pick" events to work whatsoever.
I have tried pick top.
Pick nearest.
Pick bottom...
Doesnt matter.

https://dl.dropboxusercontent.com/u/58392676/pick.JPG

Do I have this set up correctly?
am I using the pick event completely wrong?

I would think this picks the nearest line to that point.
Any sub events should refer to that picked line.
No?
B
28
S
8
G
1
Posts: 226
Reputation: 2,865

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: trueno20 and 21 guests