如何模拟纸牌游戏中打出的纸牌?

发布于 2024-12-21 03:50:08 字数 157 浏览 1 评论 0原文

我正在使用 WPF 开发一个纸牌游戏,由于我对动画没有任何了解,我想知道是否有人可以帮助我如何编写动画来模拟在桌子上玩的纸牌(图像)。

在游戏桌的底部和顶部,我的牌处于垂直位置。 在右侧和左侧,我的卡片处于水平位置。

我真正想要的是给人一种人类正在选择并扔纸牌的印象。

I am developing a card game using WPF and since i do not have any knowledge about animations i would like to know if someone could help me in how to write an animation to simulate a Card ( Image ) been played over a table.

At the bottom and top of my game table i have my cards on vertical position.
At the right and left my cards are on horizontal position.

What i really want is give an impression that a human is selecting and throwing the card.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

神也荒唐 2024-12-28 03:50:08

由于您的问题相当开放式,所以我会给您一个开放式的开始...

查看 Storyboard,以及如何使用它来修改 RenderTransform 您的卡UserControl

您的第一步实际上应该只是将卡片的位置从其初始位置动画化到桌子的中心。作为附加提示(在您了解 Storyboard 后将会派上用场),您不需要指定 DoubleAnimation.From 属性。您只需指定 DoubleAnimation.To 属性即可。

Since your question is pretty open-ended, I'll give you an open-ended start...

Look into Storyboards, and how to use the same to modify the RenderTransform of your Card UserControl.

Your first step should really just be animating your card's position from its initial spot to the center of the table. As an additional hint (which will come in handy after you've learned about Storyboards), your DoubleAnimation.From property does not need to be specified. You just need to specify the DoubleAnimation.To property.

你如我软肋 2024-12-28 03:50:08

我经常在SO上看到这样的问题,它确实给人一种“我没有尝试过,我也没有读过任何东西”的印象。你已经把牌摆在桌面上了(可以这么说),问题是,让它看起来像是人类做的。

方法有很多种,有些便宜且简单,有些则比较复杂且复杂。在你尝试之前你不会知道答案。

例如,也许您希望将一张卡片从一个位置移动到另一个位置(可以选择翻转)。这里有不同程度的难度:

  1. 将卡片按原样移动到该位置。便宜又容易。您甚至可以使用源和目标之间的距离来确定速度,以获得某种残余动量。

  2. 卡片的角度不同。我们如何旋转? XNA 使这变得非常简单,您查看过 XNA 和通用渲染吗?或者您想纯粹使用 WPF?

  3. 该移动是否涉及将卡片正面朝上展示?会有动画参与吗?您只是对脸部变化感到满意还是想看到真正的“翻转”?如果是后者,可能比 XNA 中使用 3D 的某种平面更好,至少这样你可以拥有两个具有两种不同纹理的面。

我想说的是,为什么这是一个答案而不是评论,是因为您没有给出任何可能被考虑尝试解决问题的指示。您似乎已经完成了一半,卡片已经渲染在屏幕上。但要问“让它看起来像人类放了一张卡片”......?好吧,抱歉……事情没那么简单。您可以让这项任务变得简单或随心所欲。

I see questions like this all the time on SO, and it really does give the impression of "I haven't tried, and I have not read anything". You already have your cards on the table (so to speak), and the question is, make it look like a human did it.

There are a variety of ways, some cheap and simple, some more complex and involved. You won't know the answer until you try.

For example, perhaps you want a card to go from one position to another (optionally flipping). You have varying degrees of difficulty here:

  1. Move the card to the position, as is. Cheap and easy. You could even use the distance between the source and the target to determine the speed to have some kind of residual momentum.

  2. Cards are at different angles. How do we rotate? XNA makes this pretty simple, have you looked up on XNA and general rendering? Or do you want to this purely using WPF?

  3. Does the move involve showing the card face-up, or not? Will there be an animation involved? Are you happy with just the face changing or do you want to see an actual "flip"? If it's the latter than some kind of a plane in XNA using 3D might be better, at least then you can have two faces with two different textures.

What I am saying is, and why this is an answer as opposed to a comment, is that you have given no indication of anything that might be considered trying to solve the problem. You seem like you've got halfway there, you've already got cards rendered on the screen. But to ask "Make it look like a human put a card in"...? Well, sorry... it's not that simple. You can make this task as easy or had as you wish.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文