(Solved) Change button function after collecting power up

This is my first little practise project using GDevelop, so bear with me if I’ve missed anything obvious.
I’m trying to make a twin stick shooter using gamepad controls where the collecting a power up changes where the player’s submarine shoots from.
What’s meant to happen is the following:
You start out shooting from a gun that’s on the front of the sub
You collect a power up
Front gun retracts away so it’s no longer used and two guns on the side of the sub extend out
Player is now shooting from the two side guns

The problem I’m having is the game just shoots from both the front and the side guns of the sub when the fire button is pressed.
How do I get the game to stop firing from its original front gun position after collecting the power up?

I’ve tried sub grouping things under the collect power up event as well as putting “current animation by name”/”animation is finished”. But all they did is make the game ignore firing from the sides all together and just perform its starting firing position and animation.

This is my current events page without of my previous attempts in it.

Thanks in advance to anyone willing to lend their advice.

Hey there, mind if I take a crack at the problem?

My solution might be a little unconventional but I am new and I think this might solve your problem for sure without making things too complicated.

I would say create another button, and switch out your buttons when they get the power up and the first one goes offline. Personally I would probably put each of the buttons on their own layer so I could just do a show/hide command for it. Then do a trigger that states if the layer isn’t shown then the button isn’t active.

Another way is to create an invisible turret that sits on top of your turrets that actively show the animations of the invisible turret. Then when the one side closes you can move the invisible turret over the other side of the sub. This method might be more complicated but I think it can make your events/code stay cleaner.

If you want to get fancy, I think you might need to check out the tutorial videos on variables, that might be able to help you too. I feel like you could do a boolean variable for whichever turret you want it to fire from.

I am sure someone will come around with a better solution for you and we could try to go more in depth with any of the ones I mentioned if you would like!

1 Like

Thank you so much for your suggestions.
The layer solution you recommend worked so now my little sub’s guns are firing when/where they are meant to. :grinning:

1 Like

Hey Caboos15, that’s awesome to hear!

When you’re ready make sure you let us see this game in action!