On Start of Layout + Function Question

Discussion and feedback on Construct 2

Post » Fri Dec 21, 2012 10:02 pm

Hi,

i got 2 questions:

1. does the "on start of layout" condition need to be in an event sheet, that already got this condition?

i tried to use this condition later again in another included event sheet, but then it's not working. (r114)

2. based on the last question in this thread, i still could not find how to perform a function on simulatanous collision of multiple object instances with other objects. when using the "trigger once" condition to kick the turning function, only one instance of "enemy" turns around at a reverse point. all others "walk over".

any help welcome
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Sat Dec 22, 2012 3:06 am

1- The event sheet should be assigned to the layout for it to work , and you need to take note that the "on start of layout" condition can only be triggered when the layout starts ( You can restart the layout ... )

2- I Didn't use the functions until now , so I'm not sure ... You could join all the enemies in a family so it could affect all the instances of the enemies !

Cheers
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Sat Dec 22, 2012 11:39 am

thanks for your reply whiteclaws.

1. both event sheets are included by the one directly assigned to the layout. but the first "on start of layout" is in an "earlier include state" than the second one. anyway, the second one does not work. i did simply try to cut&paste the event into the event sheet with the first "on start of layout" condition, and there it works...in spite of being an own event.

this is really strange, since the other events in the third sheet work fine...its only the "on start of layout"- one thats ignored in it.

hope someone here understands what i mean

2. the opposite is wanted, every enemy instance should be handled itself. but this does not seem to work with the "trigger once" condition.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Sat Dec 22, 2012 12:28 pm

1. should work. It works for me in a simple test case. What are you trying to do on start of layout exactly?

2. I gave the enemy a boolean var called 'turning'. When the enemy is overlapping or by a wall and turning is false, set turning true and call the turn function. When he moves away set turning false again.

B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Sat Dec 22, 2012 5:40 pm

@ramones: it really should ^^. Please check the PM i'd send you with a link to the current file.

2. that should do it, thanks. :) but i think such simple things are getting very complicated in c2. thought this should work without additional variables.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Sat Dec 22, 2012 5:58 pm

It only gets kind of complicated when you're comparing the four different turning conditions in the same event. You could have it like this instead:
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Sat Dec 22, 2012 7:22 pm

1. did you look into the actual file?

2. Through the missing "trigger once" this does not work. Also i've tried your boolean instance solution, but it is just the same as before, the ki does not change only once. the problem is the function, not the condition calling it.

i am amazed about such a simple thing not working in c2,
any other ideas welcome





B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Sat Dec 22, 2012 8:29 pm

Oops that should be enemy.UID not enemy.IID. Fixed the screenshot. I replied to you PM too.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Sun Dec 23, 2012 10:41 am

About the start of layout issue, there's this rule to keep in mind:
"Start of layout of included sheets always happen before the start of layout of the current event sheet even if it's placed after."

For your other issue, I would need to see at least a screenshot of the conserned events.Yann2012-12-23 13:18:30
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sun Dec 23, 2012 3:50 pm

@yann: thanks for this information; that is it! But why is this handled so?

For the other event, I could (temp) fix it with the mentioned instance variable and without a function.

Since the game is getting more and more complex, i think i will need the function again later.

cya
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Psychokiller1888 and 14 guests