Improve mobile touch screen motion

vaingglory

  • Posts: 17
Hi how are you

We have made a first game for mobile in which we have put different parameters of gravity, speed and such, but we see that the movement of the main actor on the screen is quite bad and is not fluid

We do not use a joystick, but the user's own finger to move the actor, but it is difficult for us to be agile, someone can help me give an idea how to improve it.

Thank you

Max Marin

  • Posts: 138
This is what I understand. To make it jump you have to press it and move it up as in the image.
 can be?
I'm human

vaingglory

  • Posts: 17
Yes, but for example the diagonal or transversal movement, generates that you have to move the touch screen many times

The right and left movement more or less is correct, but the jump and especially diagonal or transversal movements

Luyren

  • *
  • Posts: 2810
You'll need to provide a screenshot of your code and a detailed description of how you want your game to control.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

vaingglory

  • Posts: 17
Hello

The movement of my actor is with the touch of the mobile screen directly

I have put in physics on my main screen

Gravity (horizontal) 0.0 left
Gravity (vertical) 28.0 down

My Main Actor (Player) has the following behaviors

Camera tracking -> Scrool Speed ​​0.0
Can't leave the scene

Events -> Attached image of the movement scripts that I have

Physics What kind of actor Type -> Normal
Can rotate -> no
Gravity affect -> yes

Luyren

  • *
  • Posts: 2810
You haven't described how you want your actor to move. Considering you are moving with a swipe, it's a bit hard to imagine how you want that to be "fluid", specially considering it looks like a platformer game.

What I can tell you:
1- It might be better to use the swipe events for your movement:
Add Event > Input > Swipe
You would create one for each swipe/movement direction.

2- I don't quite get why you're using a game attribute for the direction. A local one (blue) should do fine.

3- You should only have one Updating event per behavior.

4- You should probably use a manual timer for the stop code, and set the idle animation based on the facing, along with stopping your actor, when the timer ends. Whenever you move, you reset the timer along with the movement code. See this about manual timers: https://youtu.be/8A3mmm32l6g

5- Setting the actor's X speed when moving horizontally could work better. Likewise, setting the Y speed to a negative number for the jump might work better as well.

These are just generic pointers. I don't know exactly how you want to control your actor and how you want it to move, so I can't provide a more targeted suggestion.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.