objects interacting with object

For questions about using Classic.

Post » Wed Sep 17, 2008 8:25 pm

Ok, if i break a link in the chain. it stops the Congo.
how would i get it to fallow the next in line. without changing the number. if thats possible. i need to be able to make the chain into multiple other chains then merge them back into the original.
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

Post » Wed Sep 17, 2008 9:01 pm

I don't understand what you want to do exactly.

If you set one of their positions somewhere, the ones behind it should follow it. You can also add to the for each object loop something that makes it ignore the one you want to move, if you need to.

If you want one of the objects to leave the line on it's own (or be destroyed), I guess you can set it's value to -1 or whatever then either set all the values behind it to one less than their value.

Or you could just make the one behind it temporarily always set gotox and gotoy of the one 2 ahead of it (using the same functions, with the parameter as what it was -1) then when it rejoins the line, stop that event somehow and it would go back to its original position in the line, though this wouldn't really work when destroying it.
B
2
S
2
G
5
Posts: 236
Reputation: 2,122

Post » Wed Sep 17, 2008 9:47 pm

[quote="faggatron":3fe60a6n][url:3fe60a6n]http://www.quotecats.com/what/congaline.cap[/url:3fe60a6n]
tada! 8)

The key is the function object and forget picking, whenever you get into picking troubles this is your friend.[/quote:3fe60a6n]

Is there any way of making them stop when they collide (queue behind the leader without overlapping) ?

If yes, can you show an example plz?
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Wed Sep 17, 2008 9:52 pm

just change it from (always)falow to: when object id 1 x position not equal to mouse x
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

Post » Wed Sep 17, 2008 10:39 pm

yeah basically you can do whatever you want with the movement, all the function stuff does is find out the X and Y of the next one in the line, ('GotoX' and 'GotoY' in that example) so you can move towards that however you like.

I can't be bothered to make a whole engine heh, but this just demonstrates how to retrieve information from another specific instance of the same object.

I have to admit it's not ideal when you need things like on collision between Sprite and Sprite, and you have to call about 4 functions, gets a bit confusing, I'm sure its possible though.
B
2
S
2
G
5
Posts: 236
Reputation: 2,122

Post » Wed Sep 17, 2008 10:43 pm

[quote="faggatron":3c5v8d8t]I don't understand what you want to do exactly.[/quote:3c5v8d8t]
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

Post » Wed Sep 17, 2008 11:10 pm

[url:3h86877d]http://www.quotecats.com/what/congaline2.cap[/url:3h86877d]
Surely if one dies thats exactly what you want it to do, remove it from the line so it doesn't get referenced. You can still have multiple groups.
B
2
S
2
G
5
Posts: 236
Reputation: 2,122

Post » Thu Sep 18, 2008 12:10 am

Thanks for the help, the death thing would work. problem is I want to separate the group into an irregular sequence, such as red team 3,6,8,9 and blue team 1,2,4,5,7,.
The ideal solution would be to tell the unit to pick the next highest number in his team, and fallow him. Just have no idea how to tell him to do that(if its even possible)

i might try making a different object to represent each team. mabie an array of some kind.

If you had ever played cannon fodder itd be easier to explain. But it was kind of an unknown game. :|
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

Post » Thu Sep 18, 2008 12:18 am

You could try having another value on each object which designates their team, then when it's looking for the next object, have it call a loop which checks to see if the next follow value is in this team, if its not move on to the next one after that, then once it's found one stop the loop and send that's x and y back to the original object.

Just don't have about 100 guys or it will probably start to lag with all the nested looping.
B
2
S
2
G
5
Posts: 236
Reputation: 2,122

Post » Thu Sep 18, 2008 12:23 am

that would probably work. but how do i get it to move onto the next?
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

PreviousNext

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests