a question about events sheet

Discussion and feedback on Construct 2

Post » Fri Jan 17, 2014 4:09 pm

hello

i have just a general question (as a newbie in C2)

i saw that each layout is related to a specific event sheet (even is all layout can be related to the same one) and i saw that you could "include" an event sheet into another one.

i was wondering if the position where you include the event sheet matters, i mean must i include event sheet at the very start or can i put it anywhere in the other sheet and the code will be executed the same way.

excuse me if i'm jot clear it's just that english is not a natural way of typing question

anyway i've just tried a few things yet and i don't regret my purchase, i thing with some time and efforts i will make some cool things using c2.

claude
B
11
S
2
Posts: 14
Reputation: 796

Post » Fri Jan 17, 2014 4:18 pm

Event sheets always run top to bottom, so if you have an event that depends on getting, say, a value of a variable from an included event sheet, make sure that you insert the include before the event that depends on it.

For the most common usage (like having seperate event sheets for controls, audio, physics, etc.), I'd suggest always putting includes at the top of the event sheet
B
57
S
15
G
11
Posts: 912
Reputation: 12,606

Post » Fri Jan 17, 2014 5:56 pm

thanks for your fast answer, from your own experience with c2, do you think it's a good practice to use "included" event sheets ? will it take more ressources for C2 to handle it ?

what is the best method ?

Claude
B
11
S
2
Posts: 14
Reputation: 796

Post » Fri Jan 17, 2014 6:06 pm

@cgirolet - Welcome to the C2 family, Claude!
As I'm growing in learning to use C2, as well, I find it's becoming easier to organize things by having separate event sheets for different things, just as @GeometriX stated. Per my knowledge, having additional event sheets won't take up more resources, per se. Maybe the TINIEST bit if any. Feel free to add as many sheets as you need.
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
139
S
22
G
8
Posts: 777
Reputation: 14,830

Post » Fri Jan 17, 2014 6:54 pm

thanks i'm happy to be part ot eh c2 family even if i'm just at the very start of my journey here.

i'm just following courses for now before doing anything fancy myself, but as i want to have good habits from the very start, i'm taking great care of the most experienced C2 users.

for now i think i will help translating tutorials that are on this site into french (those who are not translated yet) i will give me a whole view of what c2 can do before even trying to do a game mayself (other than the exercices).

as i'm more into 3d now (using lightwave and modo mainly) i'm also making some ressources that i will use later and i will give them here for free too.
B
11
S
2
Posts: 14
Reputation: 796

Post » Fri Jan 17, 2014 9:39 pm

Well here are some tips

Make good use of EventSheets and Includes as discussed.

Use Groups

Minimize use of Global variables. Two reasons don't pollute the name space and it's easier to use the auto complete if it doesn't a a lot of junk in it. Ashley has done great optimizations, but it's just good JS coding practice to keep variables declared and fewer in each closure.

Use Group based variables extensively

Use Groups as a Class for Object Orientated design

Use Functions A LOT.

Design your game in Unit Test model. Design each aspect of your game on it's own away from from your main project. Seperate what feature it does from how it's used. This will give excellent re-use for other projects later and best of all this will reduce errors and allow you to isolate errors that come up later. Also if you Unit Test your features as seperate CAPX. You can come back later to improve the design feature. Which means your new projects can benefit from your own improved skill.

Tutorials and the Manual are your friends as is the Search function.

Don't bother asking can "C2 do X". 99% of the time the answer is yes. If C2 can't do it then it's a limitation with the browser technology itself. Find out if the browser is capable of X instead. Also ask "What would be the best way to go about X"

Don't be afraid of Plugins. Many plugins are awesome and can help your work load a lot. I suggest Lunarray LiteTween to make animation life easier and R0j0hounds Paster to coalese complex images groups into a single sprite image.

Be careful of plugins. Some are obsolete right now. Some one thought to use Rexrainbow's Function plugin recently even though it's obsolete. Some plugins aren't even updated and might not even work.

Be careful of plugins. Don't rely on plugins as an all in one solution for every problem. There are a handful of developers who just rely on plugins and the occasional help fix on the forum. They aren't very good at programming as they just mostly copy/paste.

Be friendly on the forums.

Document, document document. Document as you go. If you need help then other developers can understand your CAPX because you documented it and can help faster. Also if you come back to a piece of code months down the line. You might have some funky stuff going on and documentation will help you understand that better.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Fri Jan 17, 2014 10:10 pm

[QUOTE=cgirolet]from your own experience with c2, do you think it's a good practice to use "included" event sheets ?
[/QUOTE]
Others have already given good responses to this, but I'll throw in mine as well:

Yes, I think it's absolutely good practice to use included even sheets. My typical example I usually give is a puzzle game that has elements that are common across the whole game (like a user interface, audio cues and physics behaviours) - these can all be in their own event sheets. Then, each level can have its own event sheet that handles unique properties like background music, level goals, specific challenges, etc. To "activate" your common elements, you simply include them in each level's sheet as needed. You could even take it a step further and chain together includes, so you have one central included event sheet which in turn includes other common event sheets.

There are many ways and reasons to use include, but it usually comes down to re-usability and organisation of code, both of which are massively important for any project of notable size.
B
57
S
15
G
11
Posts: 912
Reputation: 12,606

Post » Fri Jan 17, 2014 10:56 pm

Not a lot to add, just giving an example of using separate event sheets in beneficial ways.

I put my drag scroll routine in it's own event sheet in my Cannon game. Later when making my level select map, I found I didn't want it shrunk so small on the screen. My solution was to zoom in and include the scroll event sheet. Now you can scroll around the map by dragging. I didn't have to do anymore as it was already made.
B
230
S
62
G
33
Posts: 902
Reputation: 40,323


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 31 guests