TOC

This article is currently in the process of being translated into Chinese (~75% done).

创建一个游戏:WPF贪吃蛇:
Chapter introduction:

In this article series, we're building a complete Snake game from scratch. It makes sense to start with the Introduction and then work your way through the articles one by one, to get the full understanding.

If you want to get the complete source code for the game at once, to get started modifying and learning from it right now, consider downloading all our samples!

Full game & final words

在前几篇文章中,我们只用XAML和c#构建了一个完整的经典贪吃蛇游戏。我们已经完成了基本的游戏引擎工作,如绘制背景,绘制主角(在本例中是一条绿色的蛇),以及更复杂的事情,如碰撞检测。

除此之外,我们还看到了如何使用简单的XAML为游戏构建多个UI层,甚至如何修改旧Window的外观和行为,使其看起来像我们想要的那样;事实上,当你运行我们最终版本的游戏时,你可能会认为这是一个真正的游戏(尽管非常简单)-我们隐藏了所有让它看起来像一个Windows应用程序的部分

虽然我们在第一篇文章中专注于创造最基本的贪吃蛇游戏,但我们在最后一篇文章中完善了所有内容,并添加了一些不错的内容,如高分列表。我们还添加了声音!

完整的游戏

到目前为止,我们已经引导你一步一步的创建了一个相当完整的游戏,现在你也可以结合你所学到的知识进行实践,从头开始只靠自己把这个游戏编写出来,甚至能做得更好

当然,如果你想更清晰明了的了解我们是如何按照文章步骤一步一步将游戏编写出来的,我们建议你 下载本教程的所有示例源码.

<TextBlock>
	To see the entire game source code, 
	download all the samples from this
	tutorial using the link above!
</TextBlock>

每篇文章都有其自己的代码示例,这样你可以看到我们是如何完成每个步骤的,并从中学习。除此之外,最终完整的游戏也将作为一个示例包含在其中,供你以任何方式进行修改,或者单纯为了自娱。

小结

我们希望您喜欢这一系列关于如何使用WPF创建游戏的完整文章。它真正显示了WPF是一个多么伟大和高度可定制的框架——一切皆有可能!


This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!