Recently, due to the loss of notebook data, I found the xNa-based 2D game engine code written in college during online storage and used it as an example.
An example of a relatively large vertex is an act game, an AVG game, And a A * path finding algorithm.
Because the AVG game script was not encrypted at that time, I took it out and checked it out.
Speaking of scripts, I think everyone is familiar with it. The scripting languages captured by simple, fast, and scalable are everywhere.
Many people asked about the AVG game script when I was blogging on Baidu.
In fact, the AVG game script is a relatively simple line-by-line running script. Most of the time, you can simply define the script command and then parse and execute it yourself.
Let's take a look at my previous AVG game script.
At the beginning, there are several set commands. The front is the name, followed by the corresponding resource code. Set in Chinese, which can be used more clearly when writing scripts later.
Audio_start is the command for playing music. The subsequent music code can also be used to start with set for culture. However, because the number of music is not large, it is played directly here.
Show_text indicates the text content, the font code used, and the position of the displayed text. The following games will be displayed.
Disapp_all_text disappears all the previously displayed text.
Fadein back (home) is the background gradient of the home.
Similarly, fadeout back. It is to disappear the background gradient.
String XXXXX. That is, the literal display text in the AVG game, usually a monologue.
Name XX string XXX. That is, a character in the AVG game speaks. The front is the character name.
Let's take a look at the following script:
Wait commands do not actually perform operations, that is, delay a script. This depends on your needs.
There is an important choice later. Selection is very important in AVG games, because different choices mean different plots and different endings.
The menu select (choose) <2> command is used here.
Choose is a variable here, which is used to record your selection ID and <2> is the selected quantity, because my script is parsed and run by line, therefore, it is convenient to define the selected quantity here. The following is the size of the Selection box.
Menu end is used to select the end of the definition.
Then there is the if statement, and the choose selection item is determined through the IF statement to lead to different scripts.
This is just a simple method. If it is a custom Command Script and all the scripts are parsed at a time, you can actually jump inside the script, but I think it looks messy (like Goto... in C ++ ...);
The following are the 1. Mg and 2. Mg scripts. Because I only use examples, there is no command in the script. It is usually messy to run commands using numbers. It is not recommended.
1. mg
2. mg
You can see that one goes to the cafe and the other goes to the park through different choices. This is also a common practice in AVG games.
In fact, there will also be commands for sound effects such as effect and weather, which will not be listed here. They are all in the same way.
Many people do not understand the operation of AVG games. Most importantly, few people are willing to share their own game scripts.
I believe that you can use this script to develop your own AVG game.
Reprinted please indicate the source: http://blog.csdn.net/ml3947
Below are some:
Main Menu, which is actually animated with Sakura.
The script section of show_text:
Select menu:
-------------------------------------------------------------------
The game engine wingengine will be introduced in a later article. Although Microsoft hasn't updated xNa for many years, my code can be seamlessly ported to monogame, an open-source project, and the code runs successfully.
It may be introduced later.
At the same time I am also using Cocos2d-x to develop a traditional RPG Game, has completed the combat system part, is writing script part and task system.
-------------------------------------------------------------------