Any complex include sheet examples?

Get help using Construct 2

Post » Sat Mar 30, 2013 3:21 pm

To learn from

thanks
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Sat Mar 30, 2013 5:23 pm

NOt sure exactly what you are looking for? Including the sheets isn't complex, are you just looking for sheets with complex logic? I tend to put sheets together for specific things like a sheet on the characters movement, etc... and then include it on all layouts as the player controls the same on all of them...
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,413

Post » Sat Mar 30, 2013 5:48 pm

Hi Phaze, something like:

creating sprite particles
or
calling arrays

I saw that including "CodeSheet" in another sheet automatically executes anything inside them, but I'd like to know how to call code from CodeSheet, that is, how to reuse code inside a current Layout sheet, like

current sheet: GameSheet
Event:
On destroy: Create particles (call code stored in CodeSheet)

hope I explained myself.
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Sat Mar 30, 2013 6:03 pm

[QUOTE=California] Hi Phaze, something like:

creating sprite particles
or
calling arrays

I saw that including "CodeSheet" in another sheet automatically executes anything inside them, but I'd like to know how to call code from CodeSheet, that is, how to reuse code inside a current Layout sheet, like

current sheet: GameSheet
Event:
On destroy: Create particles (call code stored in CodeSheet)

hope I explained myself.
[/QUOTE]

If you've included the sheet which holds the event you wish to run, you don't really need to 'call' it in any manner. What including an event sheet to another does, it basically pastes all it's content to the other event sheet.

So in your example, if you included an event sheet with trigger : On particle created, it would trigger when the destroy event in your other event sheets runs and creates particles.
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Sat Mar 30, 2013 6:48 pm

It sounds like what you are wanting is Functions. You can call a function to repeat a series of events each time it's called with different parameters.

The manual: https://www.scirra.com/manual/149/function

Including event sheets is actually combining them, Construct2 consideres them as all one event sheet. (Except that the included sheets "On Start" events will fire first.)

Edit: Yann is making Videos, and goes over functions in this one. He offers lots of tips for their use.
http://www.youtube.com/watch?v=Fc14t6BH5Bo&list=PLywBq4MZwVXHKRUKN-PeAY60a4TGt4X8C

Edit again, just noticed my link to the maual had a space after it that prevented it working, so it's fixed now.Paradox2013-04-01 05:13:31
B
200
S
51
G
30
Posts: 896
Reputation: 36,494

Post » Sat Mar 30, 2013 9:06 pm

[QUOTE=vee41] [QUOTE=California] Hi Phaze, something like:

creating sprite particles
or
calling arrays

I saw that including "CodeSheet" in another sheet automatically executes anything inside them, but I'd like to know how to call code from CodeSheet, that is, how to reuse code inside a current Layout sheet, like

current sheet: GameSheet
Event:
On destroy: Create particles (call code stored in CodeSheet)

hope I explained myself.
[/QUOTE]

If you've included the sheet which holds the event you wish to run, you don't really need to 'call' it in any manner. What including an event sheet to another does, it basically pastes all it's content to the other event sheet.

So in your example, if you included an event sheet with trigger : On particle created, it would trigger when the destroy event in your other event sheets runs and creates particles. [/QUOTE]
so you're saying, if I have
spriteDude

and includedCodeSheet has
spriteDude on click: destroy
spriteDude on click: spawn dust particles

that will work?
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Sat Mar 30, 2013 9:06 pm

thanks paradox too!
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Sun Mar 31, 2013 7:00 am

[QUOTE=California] if I have
spriteDude

and includedCodeSheet has
spriteDude on click: destroy
spriteDude on click: spawn dust particles

that will work?
[/QUOTE]

Yes man
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Sun Mar 31, 2013 7:01 am

mucho thanks!
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Sun Mar 31, 2013 9:55 am

[QUOTE=Paradox] It sounds like what you are wanting is Functions. You can call a function to repeat a series of events each time it's called with different parameters.

The manual: https://www.scirra.com/manual/149/function

Including event sheets is actually combining them, Construct2 consideres them as all one event sheet. (Except that the included sheets "On Start" events will fire first.)

Edit: Yann is making Videos, and goes over functions in this one. He offers lots of tips for their use.
http://www.youtube.com/watch?v=Fc14t6BH5Bo&list=PLywBq4MZwVXHKRUKN-PeAY60a4TGt4X8C[/QUOTE]
I needed functions, thanks Paradox
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests