Page 1 of 1

Reduction Development Tip

PostPosted: Wed Jan 14, 2015 6:34 pm
by Naji
Hey Guys ! :)
I just want to share some quick easy tips that I think you might see helpful for all beginner developers in Construct 2 and who uses Construct2 free edition

Minimize and Reduce Codes (EVENTS)

When I first started game development on Construct2 I was not experienced enough so I started to add wrong events where i can minimize codes for my game. For example I started to make level boxes by cloning, each box will go to a certain level , so if I have 10 levels there will be 10 events. More there are animation. If the level is larger than the level box itself I need to code for each sprite of box it's own event for animation, Which would take another 10 events. So I will have left 80 events and the 20 events are only for clicking to go to a level and change animation. So if I had to make 50 levels the grand total of events would be 50*2=100 ! :o

Which means nothing left for the rest of the game. sad huh?

How I managed to fix it?
Look What I've done to reduce it to only 2 events! I have managed to add one sprite and called it box or level then I made instance variable called ID. Each Level has its own ID. Level 1 has ID 1. So named each level layout the name "Level" with the number.
I used these events:

So by looping and instance variable I managed to free much events for later. So I have now 98 events to freely use! :D

Use global variables and instances variables
Use Arrays
Use loop for smaller codes

Re: Reduction Development Tip

PostPosted: Thu Jan 15, 2015 6:07 am
by alextro
Looks great & efficient. Nice find Naji.
I will do the same thing just like You do. See over old projects then experiment with existing codes.
When re-look again to my project, I always thought I can optimize & reduce bunch lines of code.

At the time I understand how loop & iteration work, everything change in my mind as if I could see every single pattern.