How do I Understand the Event Sheets?

Just started using Construct 2? Post your questions here

Post » Wed Jan 13, 2016 9:45 pm

This is going to be difficult to explain, but I will do my best: I'm having trouble understanding event sheets.
it all began when I asked for help with positioning my player sprite correctly during a layout change:
Image

User LittleStain blessed me with a capx file that should have cleared it all up:
https://www.dropbox.com/s/19ghhao7ql03au5/LayoutChangePosition.capx?dl=0

I copied LittleStain's events TO THE T in a new project and could NOT get it to work. Let me be clear: When I ran LittleStain's program, it worked. When I ran my own, carefully-copied program, it did not work. It took me DAYS of wracking my brain on how my program could have a bug when I copied every step PERFECTLY until I realized that LittleStain used 2 separate event sheets. I, however, had combined everything onto one event sheet.

Then I did a little experiment. I altered LittleStain's program by combining all the events onto one event sheet. The program ceased to function effectively. Then I went to my program and separated it between two event sheets, and included them both in a third, Main Event Sheet and ran the program using the Main one. The program did not function effectively. Then, on the Main sheet, I rearranged the order from:
Include Event Sheet 1
Include Event Sheet 2

to:
Include Event Sheet 2
Include Event Sheet 1

and it ceased to function, but in a totally different way than before.

The problem is, with the main game I am creating, I have like 6 event sheets (so far) all included on a Main Event Sheet that I run the program from. I learned to do it this way from a tutorial I watched, because of saving RAM or something. No doubt this has been causing some of the bugs in my game that I haven't figured out yet, but what should I do? I seems that running the program from 6+ event sheets will be unorganized and confusing, and I really don't like the idea of having a new event sheet for every level that I create. What if I have 50 levels? That's 50 event sheets, plus the sheets I have for the player, each enemy, items, the HUD, pickups, etc.!

Can someone please educate me about how to get multiple event sheets to work in harmony?
B
8
S
2
G
1
Posts: 89
Reputation: 1,230

Post » Wed Jan 13, 2016 11:35 pm

The problem is, when combining those events on 1 event sheet they conflict/contradict eachother..

If two events are both true at the same time (tick) their actions are both executed in the order they are read (top to bottom)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jan 14, 2016 11:58 am

Hmm. So the advice about funneling all event sheets into one main event sheet was bad advice? What should I do? I have half a dozen event sheets now, and will have more.
B
8
S
2
G
1
Posts: 89
Reputation: 1,230

Post » Thu Jan 14, 2016 12:19 pm

Milanbaudelaire wrote:Hmm. So the advice about funneling all event sheets into one main event sheet was bad advice? What should I do? I have half a dozen event sheets now, and will have more.


I wouldn't cosider this a bad practice - it's something I always do.

I hace separate Event sheets for such things a Globals, Animations, Collisions, Player movement, etc. This allows me to include whatever Event sheet I need and to also implement variations that can be quickly tested without have to rewrite full Event sheets.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
136
S
31
G
87
Posts: 5,498
Reputation: 60,282

Post » Thu Jan 14, 2016 8:42 pm

Zenox98, how do you order your event sheets so that everything runs smoothly?
B
8
S
2
G
1
Posts: 89
Reputation: 1,230

Post » Thu Jan 14, 2016 9:30 pm

Milanbaudelaire wrote:..how do you order your event sheets so that everything runs smoothly?


Here is a screenshot of the main Event sheet from a Manic Miner recreation I did:

Image

Since I'm the one writing the code, there is no difference to the way I think about the way I want it to run. The difference is I've just split the different parts into there own Event sheets, which enables me to have more flexability and freedom to try new things.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
136
S
31
G
87
Posts: 5,498
Reputation: 60,282

Post » Fri Jan 15, 2016 12:26 am

That is totally what I have done, except for me it creates all sorts of weird bugs! Do all of your layouts draw from the Main event sheet, or do some layouts draw from different sheets? I will go crazy if I can't figure out the problem. After I code things I ask the program, "Work, please?" and it's like, "No, screw you."
B
8
S
2
G
1
Posts: 89
Reputation: 1,230

Post » Fri Jan 15, 2016 8:45 am

Event sheets do reference other 'Included' Event sheets, but I haven't really found this an issue.

Imagine you just used one single Event sheet instead. When run, C2 would read each Event (condition -> Action) sequentially. Using multiple Event sheets is just the same thing in my head. When I include an Event sheet, I just visualize that whole block of code pasted into the main Even sheet. Because all the individual Event sheets have specific tasks, there's no overlap, but there is cross-referencing.

I do come from a programming background, so maybe that helps, as I can usually see in my head how I want something to happen, then I try to code it.

It's difficult to know what to say to you - this method works for me and many others, but it's possible that it's not for everyone.

When I first started this Manic Miner remake, I did do it all on one Event sheet, but quickly realized I was getting lost in the code. I took the decision to split the code and use Includes, which helped me greatly.

Last thought - when it boils down to it, it's best just to do whatever you are comfortable with. Maybe try a few prototyping exercises that do/do not use Includes and see what you prefer.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
136
S
31
G
87
Posts: 5,498
Reputation: 60,282


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests