Gravity Button Help Please

Hi

I have a touch screen gravity button which flips gravity from 1 to -1, it works when the button is pressed, the only problem is that when the gamer holds the button it flips the gravity back and forth:

I need it that when a gamer inadvertently holds the button it still flips the gravity once not multiple times.

Any help here would be great.

Best wishes

Instead of doing something when button is pressed
ONLY toggle some variable with trigger once

Now even if someone press and hold that button it will do only one switch

Now based on True or False state of that variable you do whatever you want in actions

Thanks ZeroX4

I will give it a try.

Will let you know how I get on.

:index_pointing_at_the_viewer: :pray: :+1: :ok_hand:

Hi ZeroX4

It worked perfect thankyou

Ive got to start using variables more

Have a great day

:+1: :v:

1 Like

Hi

I have a new problem, abit of help would be great.

The gravity switch is fixed, when im moving to the right and hit the switch the player glides upwards at the correct angle, though when Im moving to the left and hit the switch there is a jolt to the right as the player starts moving upwards.

Can you see anything in my events which might be causing this?

Any help would be amazing.

Best wishes


Isn’t that a conflict?

IF by switching gravity you not only mean UP and DOWN but also left and right
Then you need to add condition to 1st 2 events that checks if gravity button is NOT pressed

Also i am unsure what is best option for it but i think having events where you check for state of boolean being sub event of button pressed event which toggle that boolean isn’t best option

Maybe i am wrong on that

You are right

I have fixed it

This is what I have now:

Ive encountered a bug, when I press right and release the player keeps moving constantly, I have checked my events and they look ok, I think its a bug.

Any ideas would be greatly appreciated.

Fixed it.

I now have the game working how I want it.

Your help has been great thank you.

:v:

1 Like