Tips for creating re-usable code/events

Get help using Construct 2

Post » Sat Jul 02, 2016 3:09 pm

99Instances2Go wrote:Yes, ofcours.


Okay, I think I misunderstood at first.

So basically you are suggesting instead of re-creating objects to re-create the families. Have all the events target families thus less to reproduce.

makotto wrote:Construct2 does not allow you to copy and paste events from different Capx projects. It may sound time consuming, but including the function object, and having a separate events sheet only for common functions has worked for me.
You won't be able to copy+paste the event sheet, but at least it is easier to duplicate your functions.


I think I'm on the same page with you here. It will let you copy and paste functions.
ImageImageImage
B
43
S
26
G
11
Posts: 516
Reputation: 10,473

Post » Sat Jul 02, 2016 3:32 pm

My bad Sol. Never done it with same objects and same names.
B
28
S
10
G
10
Posts: 97
Reputation: 6,584

Post » Sat Jul 02, 2016 5:26 pm

A tactic I've been trying lately is making stuff in separate projects with the intent to push them into the main project once it is working how I want it. The advantage with this is that, because it is in another project I can focus on minimizing the implementation of it to a point where it is easy to transfer to another project.
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Post » Sat Jul 02, 2016 6:23 pm

makotto wrote:Construct2 does not allow you to copy and paste events from different Capx projects. It may sound time consuming, but including the function object, and having a separate events sheet only for common functions has worked for me.
You won't be able to copy+paste the event sheet, but at least it is easier to duplicate your functions.


Sure it's possible, as long as the object and and behaviors are the same (if used)
B
18
S
7
G
1
Posts: 160
Reputation: 1,934

Post » Sun Jul 03, 2016 2:51 am

makotto wrote:My bad Sol. Never done it with same objects and same names.


All good mate. It definitely works but yes, you MUST have all of the exact same objects, object names, behaviours, global variables, instance variables etc (if they are referenced in any of the events you're copying over anyway). There does seem to be issues however with events not applying the correct actions when it comes to some behaviours though - the actions will often change to something arbitrary.

I think the best way to really re-use code is to make some sort of template file that you can use to start building your new projects from... so think along the lines of a "platformer template" or an "infinite runner template" etc, where you load that up and savre it as a new project file, but it gives you some basic building blocks to work from.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499

Post » Mon Jul 11, 2016 9:50 am

I have a template that I made 1 year ago that keeps getting updated and now is on update 34 :D
In this template I have everything I need for after the actual game is created:
Leaderboard (autologin, function for auto submit score),
IAP to remove ads,
Ads
Sound and music controll
Share to Facebook and Twitter
All sorts of elastic movements for UI panels and buttons
HiScore that will autosave and autoload from LocalStorage
I usually start from this template and make my game on top of that and delete things don't need (like Leaderboards or IAP)
Or If I need only let's say the audio events I first drag and drop the sprites/objects from the template to my projects then the additional events.
Is a little difficult to copy/paste in C2, but this is life in general:)
Last edited by Cipriux on Mon Jul 11, 2016 3:20 pm, edited 1 time in total.
B
82
S
21
G
23
Posts: 517
Reputation: 18,731

Post » Mon Jul 11, 2016 11:46 am

yes it does, I do it too. You just have to maintain similar naming convention
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Previous

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, newt and 8 guests