如何更改一组精灵中的精灵状态 [英] How to change state of a sprite in a group of sprites

查看:99
本文介绍了如何更改一组精灵中的精灵状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我是xna游戏的新手.
我的麻烦是有一组精灵,我想每秒更改其状态,因为10秒钟后,其中一个精灵将在5秒内从灌木丛变为树木,然后变为灌木丛.在接下来的10秒内,以前的精灵会更改.
我只想知道怎么做.
请给我一个提示或教程,以了解如何做.
提前感谢大家.
请帮帮我.
(对于我的英语不好,是sr)

Hi everyone,
I am a newbie in xna game .
My trouble is having a group of sprites and i want to change its state by second, as after 10 seconds one of them will change from a bush to a tree in 5 seconds then change to bush. In next 10 seconds of previous sprite will change.
i merely want know how to make it.
Please give me a hint or a tutorial to know how to do it.
Thx everyone in advance.
Please help me.
(sr for my bad english)

推荐答案

您是说要将灌木丛改成树,还是您要修复的错误?

如果是第一个,则您将有多组子画面(或图块集),并且在您的类中有一个枚举,说明您当前正在使用哪个图块集.

然后,使用DateTime.UtcNow来存储最后一个更改拼贴时间,并在十秒钟后更改磁贴集.

干杯,

ge-force.

P.S.如果您正在使用Platformer,请从App Hub中检出Platformer Starter Kit( http://create.msdn.com/zh-CN/education/catalog/sample/platformer [ ^ ])

它提供了有关拼贴集动画的许多很好的信息.
Are you saying you want to change a bush to a tree, or is that a bug that you are trying to fix?

If it is the first one, you would have multiple groups of sprites (or tilesets), and have an enum in your class stating which tileset you are currently using.

Then, you use DateTime.UtcNow to store the last change-tileset time, and when ten seconds have elapsed, you change your tileset.

Cheers,

ge-force.

P.S. If you are doing a platformer, check out the Platformer Starter Kit from the App Hub (http://create.msdn.com/en-US/education/catalog/sample/platformer[^])

It has lots of good information on tile set animation.


这篇关于如何更改一组精灵中的精灵状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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