雪碧套件 - 创建拱路径SKSpriteNode给予滑动手势 [英] Sprite Kit - Create arch path for SKSpriteNode given a swipe gesture

查看:270
本文介绍了雪碧套件 - 创建拱路径SKSpriteNode给予滑动手势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出一个简单的游戏,用户刷卡向上的对象(SKSpriteNode)发送它上下在拱形的议案(使用SKAction我假设)。下面是一个视觉什么我希望能完成(请原谅我的基本技能Pixelmator)的:

I am making a simple game where the user swipes upward on an object (SKSpriteNode) sending it up and down in an arching motion (using a SKAction I assume). Here's an visual of what I'm hoping to accomplish (please forgive my basic Pixelmator skills):

我创建了向上发送对象的SKAction并计算基于速度,等刷卡的最后一点但是,我无法弄清楚如何使足弓运动出现一次到达终点,也没有回落到在屏幕的底部。我希望我可以添加重力对象和雪碧套件将处理对象的移动,但是,这并不似乎是从我的初步调查结果的情况下。

I have created an SKAction which sends the object upwards and calculate the final point of the swipe based on velocity, etc. But, I cannot figure out how to make the arch motion occur once the final point is reached nor fall back to the bottom of the screen. I am hoping that I can add gravity to the object and Sprite Kit will handle the movement of the object, but that doesn't appear to be the case from my initial findings.

我已经张贴我目前的code位置:

I've posted my current code here:

https://github.com/mikeberlin/Swipe-Arch-PoC

该应用程序是基于关闭此教程:

The app is based off this tutorial:

http://www.raywenderlich.com/44270/sprite-kit-tutorial-how-to-drag-and-drop-sprites

在code是写在Xamarin / C#,但几乎是相同的Objective-C的等效。如果你需要/想我将它转换成Objective-C的我现在最肯定可以。

The code is written in Xamarin/C# but is almost identical to the Objective-C equivalent. If you need/want me to convert it to Objective-C I most certainly can.

感谢您的所有先进的帮助,如果我能提供任何进一步的信息,请让我知道。

Thank you all in advanced for your help and if I can provide any further information please let me know.

推荐答案

结束了使用物理为基础的方法。我通过iOS的雪碧套件编程指南帮了不少忙了(去图)。

Ended up using the physics based approach. I went through the iOS Sprite Kit programming guide which helped quite a bit (go figure).

<一个href=\"https://developer.apple.com/LIBRARY/IOS/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Introduction/Introduction.html\" rel=\"nofollow\">https://developer.apple.com/LIBRARY/IOS/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Introduction/Introduction.html

每@ LearnCocos2D和@doctorBroctor我想出了似乎是工作不够好解决方案。我更新了我的github上的项目,如果有人绊倒在这个职位,并寻找一些code。

Per @LearnCocos2D and @doctorBroctor I came up with the solution that seems to be working well enough. I updated my github project if anyone stumbles upon this post and is looking for some code.

谢谢大家!

PS - 我不知道如何来纪念这个,因为我用了两个反应/答案件。所以我创造了这个答案与解释和上投两种反应。如果有一个更好,更公平的方式,以纪念这个问题,我洗耳恭听。

PS - I wasn't sure how to mark this since I used pieces of two responses/answers. So I created this answer with explanation and up-voted both responses. If there's a better and more fair way to mark this question I'm all ears.

这篇关于雪碧套件 - 创建拱路径SKSpriteNode给予滑动手势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆