Disable/Enable mouse click?

(Helgard de Barros) #1

In my game, when the player goes into the water he starts swimming.

But if the user clicks the left mouse button, it triggers the attack skills, and the player will perform an attack, and then he will stop his swimming, and he will walk on the water.

So, I want to disable the left mouse button while the player is swimming, or if the user clicks the left mouse button while the player character is swimming, it must trigger nothing. I have a local variable for “swimming”, so maybe some way that if that variable is true then the left click is disabled?

(The red circled “If button goes down” is just to show what normally happens when the user clicks the left mouse button.)

I have tried various blocks and I can’t find anything that allows me to do this. Anyone have any ideas?

(Jamie pearce) #2

when your entering the water use like a trigger to set a value and use and if then checking to see if your bool is true

so basically

the trigger will set a the bool (IsInWater) on player (trigger object) to true

now where you cast the iff to attack with left click add a new if to see if the bool is true or false if it is true do not do this else do this

i hope this helps you out

(Helgard de Barros) #3

XDesign, yes, I know the flow, but how do i tell it not to use the attack. Is there a way to say “If Action/Primary Attack Button go down” > do nothing?

Or if Local Variable " Is swimming" is true, then disable mouse click.

I know what I have to do, I just can’t find any way to put in a command to tell it not to use any skill, or to disable the left click button.

(Helgard de Barros) #4

OK, solved it.

I gave my player a new skill called swimming. On skill activate, it plays the swimming animation. It causes no damage, etc.

Then I said that if the action button goes down, and the local swimming variable is false, play the normal attack skill. If the action button goes down and the swimming variable is true, then play the swimming skill.

Works fine!