我目前正在开发各种卡牌游戏,当用户玩牌时,我希望该牌从玩家手中的当前位置移动到"面朝上&#34 ;堆在屏幕上。
编辑:要回答一些问题,并使问题/答案清晰,这是我的一些代码。
+(id)card:(NSString*)suit :(int) value {
HHCard *card = [HHCard new];
card.value = value;
card.suit = suit;
//used for selection of cards during human turn
card.isSelected = false;
return card;
}
答案 0 :(得分:0)
您的卡必须与某种UIView相关联。为什么不使用:
[UIView animateWithDuration:animations:]
然后在您的动画块中,您只需将x和y坐标更改为您想要卡片的位置。它会为你制作动画。
答案 1 :(得分:0)
我很抱歉没有尽快回答这个问题,但答案很简单。为了移动一个对象,在这个例子中是一张卡片。到屏幕上的所需位置,创建一个CGPoint,其中包含您希望对象移动的点,然后让对象运行SKAction moveTo:(CGPoint)持续时间:(NSTimeInterval)。
https://www.nuget.org/packages/FluentValidation/
答案 2 :(得分:-1)
他们提供了4种方法,通过它们我们可以跟踪对视图的触摸。方法如下:
您只需在控制器类中应用这些方法,然后相应地跟踪视图在这些方法中的位置。
希望这可能会有所帮助。