How do I simulate a control for touch screen which isn't part of the platform or top-down movement behaviour?

Hello!

I have programmed my game to be played on a PC, but I am now trying to do a mobile version. at the moment I have it mapped out that the arrow keys are the jump, left, right and down movement and the space bar is the attack button. My Sprite has the platform behaviour though I’m not using the default controls. I’ve managed to programme the movement for mobile absolutely fine, as I’ve been able to just simulate the arrow controls. but I have no idea how to program the attack movement, as there doesn’t seem to be an option to simulate the space being pressed when the screen is touched. I imagine this can be solved with a Variable but I’m just not sure how to do it?! Please help, and thank you in advance!

If I remember correctly there is your answer in this video :
https://www.youtube.com/watch?v=ypu-huHz2P0

I’ve already checked this video and there doesn’t seem to be an answer. There must be a way to simulate a space bar being pressed. It feels like it should be a simple thing to do…

Have you tried having a button that only appears if the game detects it is played on a mobile ?
Capture d'écran 2024-08-28 163308
I’m pretty sure the button object works with touchscreen controls.

Then you can use the Multitouch conditions to check if the player as touched the Jump button.

How is the attack triggered in your events, currently?

The attack animation is triggered by press the space bar.

The movement is a little bit complicated because of the different animations so I would prefer it if I could just trigger the space bar in the mobile controls, instead of having to reprogram all of the movement from scratch.

Do you mean that you just have a condition “space bar is pressed”?

If so, then you might just need an OR:

|| (if one of these conditions is true:)
    spacebar pressed
    attackButton clicked

Hello, sorry for my late reply.

I felt I had done something like this. This was the programming that I put in…

I’m still new to variables, and a found them a bit of a struggle to get my head around, so it wouldn’t surprise me if I’ve done something wrong in the programming…

I would love to help I just don’t have the time right now

Nothing wrong with that, what you have done achieves the same result as OR.

So, this isn’t working? Or you changed it?