Hello fans
The little move is back
CSDN God
Play new tricks again
Actually used Java to make the glory of the king
Krypton-free gold collar skin
A little brainchild moves
Hurry up and whip to bring to everyone
First, the preliminary preparation
We now have more functions, all in order to make the program run more intuitive, we need to create a Menu package to define the interface of some operations;
Menulogin is the game's interface for selecting hero skins, inscriptions, and access to the game; the code is simple and easy to understand, and I won't explain
Menuable is a hero skill release interface
Menuyeguai is a menu for attacking target monsters, mainly by selecting wild monsters and completing kills to earn gold coins
Menuzhuangbei is where players enter the equipment page, purchase equipment, increase all-round attributes, and currently only implement resistance boots, anti-armor, shadow tomahawk
Second, I don't have money to buy skin, I will build it myself!
2.1 Skin Selection Interface Design】
We are mainly back-end design, all we analyze to analyze how to achieve a skin.
If a friend has played Glory of Kings, then you must know that no matter how expensive a skin is, it can be fixed to add 20 attack damage to the worn hero, I am Arthur's skin, so add 20 physical attacks. If a mage hero is created, add 20 spell attacks. Fancy skin, in fact, the bottom layer is easy to implement, that is, modeling, art is more torturous.
Of course, only Arthur's example is used here, and everyone can design it according to their own preferences
2.2 How to assign skin attributes to heroes
This is very simple, we only need to get the selected skin return value, and then assign this return value to the hero's basic attack power to achieve attribute conferring.
The code is as follows:
Four skin specific realizations:
Original Skin: Arthur-Paladin Power No bonus
Season Skin: Arthur Lionheart
Active Skin: Arthur - Death Knight
Shard Redemption Skin: Arthur - Psychic X-Men
Third, there is no awesome hero skill, play a hammer!
3.1 Determine the hero's skill effect
3.2 Hero skill usage
**Use the skill menu to complete the use of skills,**
It is nested with the code implementation of equipment purchase and monster spawning, the code is very basic, and smart friends you must understand.
Spawning monsters is mainly to set a different amount of gold coins for each monster, and then judge through Switch.
buff is based on the return value to determine whether there is currently a buff;
The code principle of equipment purchase is the same, call the equipment class, and judge whether the economy meets the conditions before purchasing equipment;
3.3 Skill Release Demo
Use one skill:
Fourth, what is the use of light release skills, spawn monsters to buy equipment!
4.1 Methods of spawning implementation
Program running demo:
Interested fans, you can practice it, this is no more fun than the game!
This article is from CSDN - Silence Endure, Authorized Power Node!