Reduction Development Tip

Get help using Construct 2

Post » Wed Jan 14, 2015 6:34 pm

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:
2events.JPG


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

Tips:
Use global variables and instances variables
Use Arrays
Use loop for smaller codes
You do not have the required permissions to view the files attached to this post.
ImageImageImageImageImage
B
54
S
15
G
5
Posts: 852
Reputation: 11,346

Post » Thu Jan 15, 2015 6:07 am

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.
ImageImage
B
102
S
46
G
22
Posts: 772
Reputation: 21,593


Return to How do I....?

Who is online

Users browsing this forum: Bobbyneal100, georeb, Google [Bot], part12studios and 8 guests