Flawed event sheet...

Get help using Construct 2

Post » Fri May 16, 2014 11:11 pm

Image
Ok C2 community...
Not sure if my syntax is correct here... I'm having trouble getting my Lives Counter global variable to work right. I'm using sprites instead of a text box for the numbers, but I doubt that has anything to do with the problem. People familiar with the event sheet may see what I'm trying to accomplish here... I want to subtract lives from the global, and get to the corresponding layout and have the animation(s) operate correctly... So far it's not becoming a reality with this event added in :(
Image
B
37
S
18
G
9
Posts: 103
Reputation: 8,293

Post » Fri May 16, 2014 11:26 pm

You are ANDing PlayerLives=3 with the trigger - break it out as a sub-event like the others, or the rest of the code will never be run, as PlayerLives won't be 3.
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198

Post » Fri May 16, 2014 11:32 pm

@blackhornet
Thanks for the advice! I had a similar thought, but I believe your route would be the best option. Again, thank you for the quick reply!
Image
B
37
S
18
G
9
Posts: 103
Reputation: 8,293

Post » Fri May 16, 2014 11:43 pm

@blackhornet
I'm still having problems getting it to work (even when I branch it out in a sub-event) but I think it's the way I have the syntax set up... Will re-arrange things and hope for the best...
Image
B
37
S
18
G
9
Posts: 103
Reputation: 8,293

Post » Mon May 19, 2014 10:56 pm

I just typed for 20 minutes and hit the wrong tab... smh. Quick version (forgive me people):
Is there a way for one event on a separate sheet and layout to trigger a action (or affect another event) on a total different sheet and layout??? For example: If I want my player to lose a life, and upon losing the life is "transported" back to the UI for player lives remaining, is this even possible? The fact that I'm using sprites for fonts may complicate things (i.e. Player Lives x 3, x2, x1 etc...) If I need to upload jpegs of what I'm talking about please let me know... I'd be happy to make a ton of printscreens if it might help facilitate this process...
Image
B
37
S
18
G
9
Posts: 103
Reputation: 8,293

Post » Mon May 19, 2014 11:01 pm

You can include Event sheets in another Event sheet. Put your common code on one, and include it for any others that need it. Right-click at the very end of an Event sheet to see the popup menu with "Include event sheet".
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198

Post » Mon May 19, 2014 11:09 pm

@blackhornet
I figured that out earlier, unfortunately that's not going to solve my issue... I got the event to run (after checking my logic... If one thing isn't in the right place.. well you know) but now I'm having trouble with the "right" animation running... It's suppose to set the UI for player's lives to the number 2, but it goes straight to 1 and I have each font on a separate animation frame so I have no clue what's wrong with it now... unless my syntax for subtracting lives is "off" somewhere in the code, it shouldn't be acting all squirrelly like this...
Image
B
37
S
18
G
9
Posts: 103
Reputation: 8,293

Post » Mon May 19, 2014 11:11 pm

BTW I totally got rid of the syntax pictured above in the initial post...
Image
B
37
S
18
G
9
Posts: 103
Reputation: 8,293

Post » Mon May 19, 2014 11:38 pm

@blackhornet
Thanks again dude! You got my mind going, and hopefully I got this syntax on the right track... so far so good... Finally got the sprite/font thing situated (I think... fingers crossed)
Image
B
37
S
18
G
9
Posts: 103
Reputation: 8,293

Post » Tue May 20, 2014 1:01 am

My Geezzz.... I FINALLY FIGURED IT OUT!!!! lol! It was as simple as "whatever you have on one sheet, has to be done in the other"... I'm wondering if blackhornet's idea of adding the whole event sheet would have been a better choice but I got it to work, and I have a "heads up" for the next problem (which I'm sure is right around the corner lol!) I really appreciate the reply dude...
Image
B
37
S
18
G
9
Posts: 103
Reputation: 8,293


Return to How do I....?

Who is online

Users browsing this forum: warmty and 9 guests