Brick 2005游戏引擎(以前为Tetris 2005游戏引擎)(译文)
By robot-v1.0
本文链接 https://www.kyfws.com/games/brick-2005-game-engine-formerly-tetris-2005-game-e-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 13 分钟阅读 - 6183 个词 阅读量 0Brick 2005游戏引擎(以前为Tetris 2005游戏引擎)(译文)
原文地址:https://www.codeproject.com/Articles/11241/Brick-2005-Game-Engine-formerly-Tetris-2005-Game-E
原文作者:Mohit Soam
译文由本站 robot-v1.0 翻译
前言
A Game engine tutorial describes how to play the game and how to customize the game. The game is user friendly that lets you to change the view, difficulty, etc. without changing the VB code.
游戏引擎教程介绍了如何玩游戏以及如何自定义游戏.该游戏易于使用,可让您无需更改VB代码即可更改视图,难度等.
目录(Table of Contents)
简介:什么是Tetris'2005?(Introduction: What is Tetris ‘2005?)
俄罗斯方块'2005是一个令人兴奋的动作游戏.在整个游戏过程中,各种类型的砖块从游戏区域的顶部到底部掉落.当砖块在游戏区域上形成一排实心的方块时,该排便消失了.(Tetris ‘2005 is an exciting action game. Throughout the game, bricks of various types fall from the top to the bottom of the playing area. When the bricks form a solid row of blocks across the playing area, that row vanishes.) 因为这是删除块的唯一方法,所以您应尽可能尝试形成稳定的行.当棋子堆积到游戏区域的顶部时,游戏结束.(Because this is the only way to remove blocks, you should try to form solid rows whenever possible. The game ends when the pieces stack up to the top of the playing area.) 您只能在砖掉下时对其进行操作.下落的碎片可能会旋转,水平移动或掉落到游戏区域的底部.(You can manipulate a brick only when it is falling. Falling pieces may be rotated, moved horizontally, or dropped to the bottom of the playing area.) 这个好玩的小型游戏提供了高分列表,预览屏幕,位置指针等.它没有多媒体功能,但是旨在在漫长而辛苦的一天中为您带来小小的休息时的乐趣.但是,如果您想支持我的工作,请为本文评分并访问我的其他程序之一.(This nice and small game offers High score lists, Preview Screen, Position Pointer and more. It has no multimedia but is intended to bring a taste of fun to a small break on a long, hard working day. However, if you would like to support my work, please rate this article and visit one of my other programs.) 去看一下!(Check them out!)
用户手册(User’s Manual)
我意识到很多人只想尝试一下示例,看看是否值得花时间看一下源代码.因此,我将首先介绍游戏,控件,然后在随后的部分中解释其工作方式.(I realize that a number of people will just want to try out the sample and see if it is worth spending the time looking at the source code. So I will first present the game, the controls, then I will explain how it works in later sections.) 此中级教程介绍了如何玩俄罗斯方块以及如何移动积木.(This intermediate tutorial describes how to play Tetris and how to move Bricks.)
砖头(The Bricks)
“.“砖(The “.” brick) “:“砖(The “:” brick) " H"砖(The “H” brick) “我"砖(The “I” brick) " J"砖(The “J” brick) " L"砖(The “L” brick) " N"砖(The “N” brick) " O"砖(The “O” brick) " T"砖(The “T” brick) " Z"砖(The “Z” brick)
游戏规则(Rules of the Game)
砖块一次出现在游戏区域的顶部,然后以恒定的速度下落.(Bricks appear one at a time at the top of the playing area and then proceed to fall at a constant speed.) 每块砖块继续下降,直到它降落在另一块砖块或游戏区域的底部.(Each brick continues to fall until it lands on another brick or the bottom of the playing area.) 您只能在砖掉下时对其进行操作.(You can manipulate a brick only when it is falling.) 使用键盘,您可以旋转落下的砖块,然后向左,向右或向下移动砖块.(With the keyboard, you can rotate a falling brick and move it left, right, or down.) 每次在游戏区域中排满一排实心方块时,该排便消失了.尝试操纵落下的碎片,以便形成坚固的行并消失.(Each time there is a solid row of blocks across the playing area, that row vanishes. Try to manipulate the pieces as they fall so that solid rows form and disappear.) 当棋子堆叠到游戏区域的顶部时,游戏结束.(The game ends when the pieces are stacked to the top of the playing area.)
键盘功能(Keyboard Functions)
向上箭头,(Up Arrow,) 插入,(Insert,) 旋转当前砖(Home Rotates the current brick) 向左箭头向左移动当前积木(Left Arrow Moves the current brick left) 向右箭头向右移动当前积木(Right Arrow Moves the current brick right) 向下箭头,将当前积木拖放到底部(Down Arrow, Drops the current brick to the bottom)
选件(Options)
[]显示预览屏幕([ ] Show preview screen)
取消选中此选项,将隐藏其中显示即将到来的积木的预览框.这会产生特殊的奖励积分.(By unchecking this option, the preview box in which the upcoming brick is displayed, will be hidden. This results in special bonus points.)
[]显示位置指针([ ] Show position pointer)
通过选中此选项,RSM的Tetris 2005将在"游乐场"的底部显示一个位置指针,以方便导航.阅读"计分"部分,了解有关这可能如何影响您的奖励积分的信息.(By checking this option, RSM’s Tetris 2005 will display a position pointer at the bottom of your “playground” to ease navigation of your pieces. Read the Scoring section for information about how this could influence your bonus points.)
技能等级(Skill Level)
在这里,您可以选择从哪个级别开始播放.用户可以根据自己的意愿选择级别.对于新用户,建议初学者,对于高级用户,建议中级为普通和专家.(Here you can choose from which level to start playing. User can Select level according to their desire. Beginner for new user, Intermediate for Normal and Expert is suggested for advanced users.)
背景颜色(Background Color)
单击颜色预览区域以更改RSM的Tetris 2005"游乐场"的背景颜色.(Click on the color preview area to change the background color of your RSM’s Tetris 2005 “playground”.)
玩游戏(Playing the Game)
RSM的"俄罗斯方块2005"的目标是继续播放尽可能长的时间.当游戏区域用砖头堆叠到顶部时,游戏结束.下节说明了如何玩游戏.(The object of RSM’s Tetris 2005 is to continue playing for as long as possible. The game is over when the playing area is stacked to the top with bricks. The following section explains how to play the game.)
选择技能等级:(To Choose a Skill Level:)
在"选项"菜单中,从1到20中选择一个起始级别.级别越高,片段落下的速度越快.(In the Options menu, choose a starting level from 1 to 20. The higher the level, the faster the pieces fall.)
要开始新游戏:(To Start a New Game:)
从右侧的按钮中,选择开始.(From the buttons at the right, choose Start.)
水平移动砖块:(To Move a Brick Horizontally:)
使用适当的键盘控件.您可以左右移动当前积木.(Use the appropriate keyboard controls. You can move the current brick either left or right.) 注意(Note):如果当前积木靠近边界或已定位的块,则可能无法移动它.(: If the current brick is close to the borders or close to already-positioned pieces, you may be unable to move it.)
旋转积木:(To Rotate a Brick:)
使用适当的键盘控件.您可以将当前积木逆时针旋转90度.(Use the appropriate keyboard controls. You can rotate the current brick 90 degrees counterclockwise.) 注意(Note):如果当前砖块靠近边界或靠近已定位的块,则可能无法旋转它.(: If the current brick is close to the borders or close to already-positioned pieces, you may be unable to rotate it.)
丢砖:(To Drop a Brick:)
使用适当的键盘控件.当您放下一块砖块时,它会迅速掉落,直到它降落在静止的砖块或游戏区域的底部.(Use the appropriate keyboard controls. When you drop a brick, it falls rapidly until it lands on a stationary brick or the bottom of the playing area.)
暂停游戏:(To Pause a Game:)
从游戏菜单中,选择暂停,或单击暂停按钮.(From the Game menu, choose Pause, or Click Pause Button.) 注意(Note):要继续游戏,请再次选择"暂停”.(: To resume the game, choose Pause again.)
计分(Scoring)
当前积木以初始得分值开始,初始得分值随每个连续的演奏级别而增加.(The current brick starts with an initial score value, which increases for each successive playing level.)
“俄罗斯方块'2005耻辱大厅”(The “Tetris ‘2005 Hall Of Shame”)
如果您获得了新的高分(这意味着,如果您获得的分数比” RSM的Tetris 2005 Hall of Shame"窗口中列出的分数更高),则会打开一个特殊窗口,您可以添加您的姓名和"很酷的报价"您选择此列表!(If you achieved a new High score (this means, if you achieved more points than the ones listed in the “RSM’s Tetris 2005 Hall Of Shame” window), a special window opens and you can add your name and a “cool quote” of your choice to this list !) 您也可以使用"保存"按钮将"高分"窗口保存到名为”(You can also use the “Save” button to save your High score window to bitmap file named “)HiScore.bmp(HiScore.bmp)”.(”.)
策略与提示(Strategy and Hints)
本节包含有关成功玩RSM的Tetris 2005的有用提示.(This section contains helpful hints for playing RSM’s Tetris 2005 successfully.)
- 使用"砖块预览"框获得经验,然后关闭此选项以获得更高的评分.(Use the Brick Preview box to gain experience, and then turn this option off for higher scoring.)
- 根据您的反应时间使用位置指示器工具进行实验,它带来的积分是否超过成本?(Experiment with the position pointer tool .. based on your reaction time, does it bring you more points than it costs ?)
- 避免建造"山峰”.尝试将碎片堆放在顶部.(Avoid building “mountains.” Try to keep the pile of pieces level at the top.)
- 避免创建一个"峡谷",该"峡谷"的宽度为一个街区,许多街区深.您可能会发现自己紧张地等待着那长而又瘦的砖块(在您需要时似乎永远不会出现).(Avoid creating “canyons” that are one block wide and many blocks deep. You may find yourself nervously waiting for the long, skinny brick (which never seems to appear when you need it).)
- 始终尝试沿堆叠的块的顶部至少留出三个街区宽的"平坦点".这样,您可以丢弃大部分片段,而不会留下任何间隙.(Always try to leave a “flat spot” at least three blocks wide along the top of the stacked pieces. This way you can drop most of the pieces without leaving any gaps.)
- 有时对您来说是有利的,您可以留下一些空白,然后再进行下一个阶段.如果您可以使下一个级别消失,那么您之后可能有时间来填补空白.(Sometimes it is to your advantage to leave a gap and go on to the next level. If you can make the next level disappear, you may have time to fill the gap afterwards.)
- 一旦一块砖块落在另一块砖块上,仍然可以在很短的时间内对其进行操作.您可以利用这段时间在"悬垂"下"滑动"砖块.(Once a brick lands on another brick, it can still be manipulated for a very short time. You can use this time to “slide” the brick under an “overhang.")
使用代码(Using the Code)
可以在源代码存档中找到详细的注释.该游戏是由许多较小的子系统构建而成的.每个系统提供不同的目的.我已经确定了以下系统.(Detailed comments can be found in the source archive.The game is built up from a number of smaller sub-systems. Each system provides a distinct purpose. I have identified the systems below.)
建筑(Architecture)
-
游戏引擎(Game Engine)
-
主视窗(Main Window)
- 砖块展示(Brick Display)
- 预览画面(Preview Screen)
- 位置指针(Position Pointer)
- 2D按钮显示(2D Button Display)
-
选项窗口(Option Window)
-
得分窗口(Score window)
-
帮助窗口(Help window)
核心引擎(CORE ENGINE)
俄罗斯方块核心引擎包括主要的四个功能:(The Tetris Core engine consists of the main four functions:)
SelectBrick
- ``
SetCurrentPosition
DrawBrick
HideBrick
这些功能支持与砖块相关的功能,例如选择砖块,设置砖块的当前位置,显示和隐藏砖块.(These functions provide support for brick related functions such as selecting a Brick, setting the current Position of the Brick, showing and hiding a Brick.) 核心引擎被实现为严格的后端引擎.它没有用户界面组件.大多数函数返回一个(The core engine is implemented as a strict back-end engine. It has no user-interface components. Most of the functions return an)Boolean
返回码.应该始终检查返回码以确定这些功能的完成状态.(return code. The return codes should always be examined to determine the completion status of these functions.) 已采取特殊措施以确保这些功能非常稳定和强大.(Special care has been taken to ensure that these functions are very stable and robust.) 该子例程用于选择(This Subroutine is used to select)Brick
类型.(type.) 此子例程用于隐藏(This Subroutine is used to Hide all Bricks in the)frm Form
.(.) 此子例程用于在(This Subroutine is used to Show selected Brick in the)frm Form
.(.) 此子例程用于设置Brick在控件中的初始位置.(This Subroutine is used to set initial position of Brick in the)frm Form
.(.)
其他重要功能(Other Functions of Importance)
当用户从主窗口中按向左,向右或向下键时,将调用此功能(This function is called when a user presses Left, Right or Down key from within the Main Window) KeyDown
事件.它增加下一个位置变量的值.(Event. It increments the value of next position variables.)
该函数在之后被调用(This function is called after) Increment
检查下一个位置变量中指定位置的可用性.(to check the availability of the position specified in next position variables.)
如果(If) CheckStatus
函数返回(function returns) true
,然后调用此函数将当前积木移动到下一个位置.(, then this function is called to move the current brick to the next position.)
此功能检查每行的状态,以及是否构建了任何行(即,一行包含10个砖块),然后删除该行并增加分数.(This function checks the status of each row and if any row is built, i.e., a row having 10 bricks, then removes that row and increases the score.)
此功能用于在绘制新积木之前检查游戏的状态.(This function is used to check the status of the game before drawing the new brick.)
此功能用于根据使用"选项窗口"进行的设置来更改游戏设置.(This function is used to change the game setting according to the setting user made using Option Window.)
此功能用于将分数从文件加载到分数窗口.(This function is used to Load score from the files to the Score Window.)
此功能用于保存分数.(This function is used to Save score.)
预览画面(Preview Screen)
预览屏幕模块包含三个功能:(The Preview Screen Module consists of the three functions:) 此功能用于清除预览屏幕.(This function is used to clear Preview Screen.) 此功能用于显示下一个砖块的预览.(This function is used to display Preview of next brick.) 此功能用于在"预览"窗口中设置积木的位置.(This function is used to set the position of the brick in the Preview window.)
位置指针(Position Pointer)
位置指针模块包含三个功能:(The Position Pointer Module consists of the three functions:) 此功能用于显示位置指针.(This function is used to display Position Pointer.) 此功能用于隐藏位置指针.(This function is used to Hide Position Pointer.) 此功能用于在主窗口中设置位置指针的位置.(This function is used to set the Position of Position Pointer in Main Window.)
2D按钮显示(2D Button Display)
要显示2D按钮,我们必须操纵一些"图像"框的"鼠标事件”:(To display 2D button, we have to manipulate some of the Image box Mouse Events:) 在本次活动中,我们借助灰线和白线绘制矩形.(In this Event, we draw rectangle with the help of Grey and White lines.) 在此事件中,我们将图像框更改为左侧和顶部位置.(In this Event, we change image box left and top Position.) 在此事件中,我们将图像框恢复到左侧和顶部位置.(In this Event, we restore Image box left and top Position.) 在此事件中,我们根据图像框索引执行命令.(In this Event, we execute commands according to Image box index.)
选项窗口(Option Window)
“选项窗口"使用户可以根据自己的需要配置游戏设置.(Option Window gives the user the facility to configure the game setting according to their need.)
分数窗口(Score Window)
得分窗口显示获得最高得分的用户的详细列表.(Score Window displays the detail list of users who achieved the highest score.)
帮助窗口(Help Window)
帮助窗口显示键盘功能.(Help Window displays Keyboard functions.)
结论(Conclusion)
我要感谢我的兄弟Rohit Soam的建设性批评和编辑,以及我帮助我测试游戏的朋友Nikhil.(I would like to give credit and thanks to my brother Rohit Soam for constructive criticism & editing, and also to my friend Nikhil who helped me in testing the game.)
历史(History)
故事(THE STORY)
我通过编写一个包含源代码(基于Turbo C ++)的小游戏开始了整个事情.既然一直是我(Mohit’s)的梦想,那就是创建一个像这样的逻辑游戏,但是我从来没有花时间去思考从哪里开始,所以我抓住了机会.我们将自己放在一起,添加了一些不错的功能,我们知道像您一样的人,这里就是!(I started the whole thing by writing a small game including sources (based on Turbo C++). Since it has always been my (Mohit’s) dream to create a logic game like this one, but I’ve never taken the time to even think about where to start with, I took the chance. We put ourselves together, added some nice features we knew people like you would like and here it is !) 我们在该游戏上所做的一切只是为了我们的乐趣.它使我们很高兴收到您的来信,告诉我们您是否喜欢游戏,为什么喜欢它(为什么不喜欢它^好吧,不确定〜’.'〜).(Everything we did on that game is just for our fun. It makes us happy to receive mails from you telling us if you like the game, why you like it (why you don’t like it … well, not sure ~’.'~ ) .) 注意(NOTE) RSM的Tetris 2005绝不隶属于” The Tetris Company",也不是正式的Tetris产品.游戏的图形界面基于Bricks 2005.(RSM’s Tetris 2005 is in no way affiliated with ‘The Tetris Company’ nor is it an official Tetris product. The Graphical Interface of Game is based on Bricks 2005 .)
- 2005年8月8日-" RSM Tetris 1.1"的初始版本(8-Aug-2005 - Initial release of “RSM Tetris 1.1”)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
VBScript VB6 .NET Dev 新闻 翻译