官术网_书友最值得收藏!

Function overriding

In addition to variables, functions declared in parent classes are also inherited by their children. This lets us change behavior that goes beyond simple variable changes. For example, two pickups under Inventory | UTInventory | UTTimedPowerup in the class tree, UTBerserk and UTUDamage , have the same function called GivenTo which is inherited from Inventory. Even though the function name is the same, they give the inventory items their unique behavior. UTBerserk's GivenTo function calls a function that increases the player's weapon firing rate, while UTUDamage's GivenTo function increases the player's DamageScaling variable. These functions also set different sound effects and overlays for the two different items.

To experiment with function overriding we're going to expand our AwesomeGame classes to include a custom GameInfo and PlayerController class. The GameInfo controls the rules of the game and is what makes Deathmatch different from "Capture the Flag" for example. A custom GameInfo is one of the most important classes when creating our own game, and most of the time it is the first class created in a new project.

The PlayerController is the brain behind the player's character running around on screen. It processes our input, controls the player's viewpoint, and passes and receives messages to and from other players among many other things. It is another important class in a custom game, and taking the time to read through it will help you understand how a lot of things are done in a UDK game.

So with that, let's make a custom game!

主站蜘蛛池模板: 红桥区| 葫芦岛市| 尖扎县| 嵩明县| 泸水县| 晋州市| 遵化市| 张家港市| 武城县| 十堰市| 海原县| 同心县| 石阡县| 自贡市| 浠水县| 镇赉县| 莎车县| 昌都县| 禄丰县| 桦川县| 梨树县| 伊吾县| 高青县| 左云县| 陇川县| 图们市| 九龙县| 砀山县| 宁强县| 长丰县| 贵定县| 逊克县| 涡阳县| 乐昌市| 郎溪县| 大冶市| 彭州市| 波密县| 塘沽区| 饶河县| 闽侯县|