How do I disable behaviors on the fly?

Get help using Construct 2

Post » Fri Nov 25, 2016 7:16 pm

I have a game that I need to use DestroyOutsideLayout or Wrap depending on options selected at the start of the game. Is there a way to add both behaviors to my layout and only enable one of them as needed?
B
6
S
2
G
2
Posts: 6
Reputation: 1,462

Post » Fri Nov 25, 2016 9:12 pm

I don't think you can toggle those behaviours on and off, and I don't see why you would want to. If you really want an object that can sometimes wrap round and then sometimes is destroyed I would just create two separate object types.
B
47
S
18
G
84
Posts: 2,270
Reputation: 49,794

Post » Fri Nov 25, 2016 11:19 pm

Simple, sometimes I want the bullets to bounce off the walls, some times I want them to wrap back around and sometimes I just want them to blow up on the wall. The easiest way to do that would be to take advantage of features that are already built into the software.
B
6
S
2
G
2
Posts: 6
Reputation: 1,462

Post » Sat Nov 26, 2016 3:38 pm

Then you probably need three types of bullets. One that collides and bounces off a wall, one that is destroyed when it hits the wall and one that doesn't collide with the wall and has wrap behaviour.
B
47
S
18
G
84
Posts: 2,270
Reputation: 49,794

Post » Sat Nov 26, 2016 5:20 pm

Would be so much easier if I could just turn those behaviors off when needed instead of having to use 3 different bullets and coding the differences all through my program.
B
6
S
2
G
2
Posts: 6
Reputation: 1,462

Post » Sun Nov 27, 2016 1:38 am

yeah, well. still, you can put em on a family


...FOR A PRICE MUAHAHA :twisted:
B
23
S
11
G
6
Posts: 181
Reputation: 5,010

Post » Sun Nov 27, 2016 8:04 pm

Whether you are disabling the behaviours, which isn't possible with these ones, or using 3 different bullets, seems like about the same amount of code. i.e. not much
B
47
S
18
G
84
Posts: 2,270
Reputation: 49,794

Post » Mon Nov 28, 2016 8:34 am

plinkie wrote:Whether you are disabling the behaviours, which isn't possible with these ones, or using 3 different bullets, seems like about the same amount of code. i.e. not much


Not really, if I use 3 different bullets or 3 different walls then there is a fair amount of extra work involved, including managing all of the assets and making sure all 3 get changed anytime I make one. It would be so much easier make a cleaner program if there was a wall behavior similar to platform where I could make easy changes to the settings on the fly.
B
6
S
2
G
2
Posts: 6
Reputation: 1,462


Return to How do I....?

Who is online

Users browsing this forum: max2612 and 3 guests