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
13
G
10
Posts: 632
Reputation: 12,505

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
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

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
13
G
10
Posts: 632
Reputation: 12,505

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
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Wed Nov 30, 2011 12:52 am

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


Return to How do I....?

Who is online

Users browsing this forum: CavalierBubble, Evanetot and 25 guests