Avoiding event repetition

Get help using Construct 2

Post » Tue Nov 29, 2011 11:20 pm

For example: If i have a group of events that controls weapon positioning like mirroring, generic movement etc, how could i generalize it and instead of doing for example:


Player mirrored
--- [Current Weapon] == Sword - > Set [Sword] Mirrored
--- [Current Weapon] == Bow   -> Set [Bow] Mirrored

Do it like:

Player Mirrored - > Set [current weapon] mirrored

Families ? Object variable ? Or am i thinking the wrong way ? Thanks in advance.
B
58
S
14
G
10
Posts: 632
Reputation: 12,685

Post » Tue Nov 29, 2011 11:39 pm

If the sword and bow are two separate objects, the only way to do this would be to use families, yeah.
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Tue Nov 29, 2011 11:52 pm

In the meantime, you could just make all the weapons the same object and have a variable to tell them apart.
Image
B
231
S
27
G
13
Posts: 1,782
Reputation: 18,195

Post » Tue Nov 29, 2011 11:57 pm

Yeah that could help Tokinsom, thanks ! Even though i have right now to handle a bow an arrow and a sword Kiyoshi2011-11-29 23:58:22
B
58
S
14
G
10
Posts: 632
Reputation: 12,685

Post » Wed Nov 30, 2011 12:28 am

You should also take a look at the function plugin in the plugin sections.
That might help you "encapsulating" a certain set of events, and use it from the code in a single call.
New to Construct ? Where to start



Image Image

Image Image



Please attach a capx to any help request or bug report !
Moderator
B
262
S
93
G
54
Posts: 7,144
Reputation: 66,557

Post » Wed Nov 30, 2011 12:52 am

Yeah good idea. :)
B
58
S
14
G
10
Posts: 632
Reputation: 12,685


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests