call function

Get help using Construct 2

Post » Tue Mar 25, 2014 12:43 pm

trying to set up a call function but it isn't working.
I have placed a call function inside an event sheet ( this event sheet runs at start up)
first picture:
https://db.tt/rZy02MZ0

I have placed the "on call" function inside my main event sheet
second picture:
https://db.tt/3c4XC5Ah

so basically, inside an event sheet that starts at the beginning of the program, it is suppose to use the call function after an animation trigger.

The problem is that it doesn't matter if I have the "on call" function on the event sheet or not. As long as I have the "include left-side" sheet on the main event sheet it runs. I only want the "include left-side" to run if it is called.

so how do I get the on call function to work correctly?
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Tue Mar 25, 2014 1:23 pm

I would say it is calling because animations start at frame 0, so it's going to be called immediately, which is what you are seeing. The function is working. Your logic seems wrong.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Tue Mar 25, 2014 1:30 pm

but there is an animation on frame 0. i can change the animation frame to something else and it makes no difference.
If I remove the "on left-side" function on the main event sheet ( second picture) and just leave the "include left-side" event sheet, the "left-side" event sheet still plays. So basically, the on-call function ( first image) isn't doing anything or I have it setup incorrectly.

I'm trying to make it so the "left-side" event sheet doesn't play UNTIL the "on-call left-side" function..calls it.

I'm just not understanding on call function....
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Tue Mar 25, 2014 1:40 pm

Here's a simple example. When the animation reaches frame 6, it will call the function to rotate the sprite to 45 degrees.
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Tue Mar 25, 2014 1:48 pm

thanks for the response.
So how would I include an event sheet to the function on "myfunction"?
on "myfunction"
include event sheet
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Tue Mar 25, 2014 1:51 pm

The event sheet include is global. You can see I have it at the top of Event sheet 1 (including Event sheet 2).
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Tue Mar 25, 2014 2:01 pm

the only thing I don't understand is that you have: on "myfunction" ...sprite...set angle to 45

what I don't get is I want to: on "myfunction" call a different event sheet.
I'm sure you are explaining it but I'm not grasping it..I'll play around with it
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Tue Mar 25, 2014 2:17 pm

I'm calling Set angle just to prove the function is called. If you run the example, you see the snail animate, and then on frame 6, it calls the function and also rotates 45 degrees.

You may want to move the function off of the Main event sheet (lets call it the Function event sheet). Then on the Startup event sheet include that event sheet. You may have things backwards.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Tue Mar 25, 2014 3:09 pm

yea. I'm not getting it. I mean, I understand what you have but I don't understand how to make it call a specific event sheet.
No matter where I put the functions, the event sheet plays regardless if I am even calling it.
I can't figure out how to make the event sheet NOT play until it is called but since it's already a part of another event sheet, it plays automatically. Does that make sense?
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Tue Mar 25, 2014 3:22 pm

No. I'm sure you care calling it. Functions aren't called unless you call them. Remove your call temporarily and see.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Next

Return to How do I....?

Who is online

Users browsing this forum: jatin1726, zenox98 and 33 guests