Control and curves

#1

Hello! I’m totally newbie.
I need to make a control system with dragging fingers on a screen and curves.

1. How to make curves that depends on where I hold my finger on a screen in exact time? Making curves isn’t really hard, but how to make them change due to player’s act?
2. How to separate code in to parts for the purpose of control. Like:

#2

Have you read the manual relating to input in Defold? It describes mouse and touch input as well as the pressed and release events.

#3

If you want to draw a preview of a player’s trajectory from an input I suggest you to use physics formulas, that depends on the type of the physic used in your project. Once you got an appropriate function that returns the position of a player after t time, you can create multiple points in the given position, each one in a fixed time step.
For example if you’re using cinematic with a g gravity:
finalX = initialX + initialVelocityX * time
finalY = initalY + initialVelocity * time - g * (time * time)
To make sure you undestand, or that this is an appropriate method look for your needed formula.

#4

Well, I’ve read, but maybe missed something. Thanks! I’ll check this out

#5

Thank you very much, especially for the example!