Post

Replies

Boosts

Views

Activity

SKAction.moveby and touchesMoved at the same time
I am using xcode 13.3 beta 3 to make a game in spritekit using swift. The game is working pretty good and i am very happy with it so far. There is a problem i am trying to figure out. The game is a block type game where you drag a block into the game area from a holding area and drop it in an open spot. When you first touch and hold the block or touch and move the block, a method moves the block a certain number of points above the touch area Y axis using SKAction.moveby. The block x axis matches the touch area. Then you move the block to an open are and drop it. If you do this very slow, there is no problem. But if you try to do it fast, you can see it do the SKAction.moveby first and complete, then the block quickly moves from where it finished the moveby animation to where you current touch position is it. This makes it feel very jerky and unnatural. Is there a way to make the block follow your fingers position AND animate using moveby at the same time? I feel that the problem is with the skaction.moveby because if you move your finger fast enough, you can be way above where the animation would normally finish and thats why you see the block jump to the touch. I wonder if there is a way to use the update() method to somehow change the blocks position without using moveby or move to. Thank you for any help you can provide me. I can also you show you my touchesBegin, moved and ended methods if that will help.
1
0
1.7k
Mar ’22