Layer filter idea

Discussion and feedback on Construct 2

Post » Thu Apr 19, 2012 3:28 pm

I look at groups sorta like functions/methods. I group events in there that would all make sense if run/used at the same time over and over.

it helps keep things organized and stop you from repeating the same events in multiple places.

My only issue is with the drag and drop arranging of events its a lil touchy sometimes especially when tryin to put events "over" other events. Like dragging a lower event up to a higher place. It wants to subevent the one above where Im actually tryin to put it instead of puttin it between it and one below it.
Posts: 306
Reputation: 3,262

Post » Thu Apr 19, 2012 7:24 pm

@Blam, I also passed through this situation in my early days. With time you will learn how to create your code in a way that is organized and easy to follow.

One bad thing that I used to do was reuse the same conditions for everything I could, thinking I would gain performance. I normally had just one "Every Tick" condition to run every action that was supposed to be executed always. It seemed a good strategy in that time, but as your eventsheet gets more complex it starts to become a mess.

So don't be afraid of duplicating events to help make things more readable. If you need to duplicate an event and put it into another group just to keep similar code grouped, do so.

It will save you lots of time in searching, understanding, and modifying your events. If it's not a loop event it's highly unlike to cause any significant impact on performance.

Also, wherever possible try to plan your events in meaningful pieces. Start by the core things and plan how you can add further functionalities later without disrupting what you have already done. Make each functionality a new group.

If you are uncertain of how to implement a feature do sketch programming: create a new document just to fearlessly test your ideas and discover how to get things working. Once you are sure you know how to do it, then recreate it in your official file. The recreation will normally come a lot more polished and understandable than the first trial.

If a feature depends on other functionalities then duplicate your main file and work on top of the clone. Remember to rename the files accordingly so you can track what is official and what is a sketch. Again, once you are sure you know how to do it, then recreate it in your official file.

I think a whole tutorial could be done about C2 good programming practices. Unfortunately I don't have enough time to do it.Animmaniac2012-04-19 19:27:20
Scirra Employee
Posts: 711
Reputation: 18,577

Post » Fri Apr 20, 2012 6:23 am

I think your post is a pretty succinct programming practice tutorial already. Thanks! :)
Posts: 34
Reputation: 4,799


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 2 guests