2D game local reloading method and device and storage medium
By using preset angle display resources for target costume parts and synchronizing the viewpoint with the animation state machine in 2D games, the problem of complex costume design is solved, achieving efficient costume display and a smooth gaming experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIAMEN WEIWO TIME TECH CO LTD
- Filing Date
- 2024-01-31
- Publication Date
- 2026-04-24
AI Technical Summary
The dress-up design process in existing 2D games is complex, requiring the use of specialized tools and formats, and may result in inconsistent styles or animation distortions. Furthermore, frame-by-frame animated dress-up requires a large number of image resources, which is labor-intensive and makes it difficult to achieve smooth transitions and detailed representation.
By configuring partial dressing up using display resources at least two preset angles from the target dressing up components, and synchronizing the dressing up angle and viewing direction through an animation state machine, the dressing up design process is simplified, the number of images is reduced, and the display effect and smoothness are improved.
It simplifies the dress-up design process, improves game development efficiency, reduces the workload of artists, and ensures the display effect of the outfits and the smoothness of the game.
Smart Images

Figure CN121911087A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of game design technology, and in particular to a method, device and storage medium for partial costume changes in 2D games. Background Technology
[0002] In the game design process, different parts of a game character can usually be equipped with different outfits, which allows players to enhance the game experience by changing the character's clothes during gameplay.
[0003] Chinese patent document CN111214832A proposes using the Spine animation plugin in Unity3D to achieve partial costume changes between Spine models of different styles by replacing slot data and deformation data.
[0004] However, the Spine-based costume change method requires specialized tools and formats, which leads to a complex costume design process. Summary of the Invention
[0005] To help simplify the costume design process, this application provides a method, device, and storage medium for partial costume changes in 2D games.
[0006] Firstly, this application provides a method for partial costume changes in 2D games, employing the following technical solution: A method for partial costume change in a 2D game, the method comprising: In response to a dress-up command corresponding to a game character, the system obtains a target dress-up component of the target dress-up indicated by the dress-up command. The target dress-up component includes display resources of the target dress-up at at least two preset angles, and the preset angles are set based on the game character's viewpoint. The game character's target body part is updated based on the target body part, and the target body part corresponds to the target body part; The game character is rendered based on the updated outfit data to update the game character's outfit.
[0007] By adopting the above technical solution, the target costume can be configured through the display resources of at least two preset angles in the target costume component. Therefore, when configuring the target costume, it is only necessary to configure the costume component containing the display resources of the target costume at different preset angles to complete the replacement of the partial costume, without the need to use other professional tools for processing. This can simplify the costume design process and improve the efficiency of game development.
[0008] Optionally, the method further includes: The target preset angle is determined from each of the preset angles based on the viewpoint to be displayed, wherein the viewpoint to be displayed is predetermined. Based on the target preset angle and the costume data, determine the resources to be displayed corresponding to each costume part of the game character; The game character is dressed up and displayed based on the displayable resources corresponding to each of the costume parts of the game character.
[0009] By adopting the above technical solution, the target preset angle can be determined based on the viewpoint to be displayed, and the display resources of the game character can be determined based on the target preset angle and the costume data; finally, the game character is dressed up and displayed based on the display resources. In this way, the display method of the costume can be adjusted based on the viewpoint to be displayed, which can help improve the display effect of the costume.
[0010] Optionally, the method further includes: When a change in the game character's perspective is detected, the game character's perspective after the change and the perspective before the last display of the change are obtained; Determine whether there is an interval view between the changed viewpoint and the original viewpoint; In the presence of the interval view, the interval view and the changed view are sequentially determined as the view to be displayed, and the step of displaying the decoration based on the view to be displayed is executed.
[0011] By adopting the above technical solution, when an interval view is detected between the game character's view after a change and the view before the change, the interval view and the changed view are sequentially determined as the view to be displayed, and the decoration is displayed based on the view to be displayed. This can help improve the smoothness of the game process, avoid frame skipping, and thus help ensure the display effect.
[0012] Optionally, before determining the interval view and the changed view as the view to be displayed in sequence, the method further includes: Determine whether the interval viewpoint is a critical viewpoint; When the interval view is a key view, the interval view and the changed view are sequentially determined as the view to be displayed, and the step of displaying the decoration based on the view to be displayed is executed; If the interval view is not a key view, the changed view is determined as the view to be displayed, and the step of displaying the decoration based on the view to be displayed is executed.
[0013] By adopting the above technical solution, the processing method of the interval view can be reasonably determined by combining whether the interval view is a key view, which can help ensure the effect of game screen display.
[0014] Optionally, the preset angle is represented by an angle identifier, and the game character's viewpoint is controlled by an animation state machine. During the configuration of the animation state machine, the angle identifier is matched with the game character's viewpoint. The step of determining the target preset angle from each of the preset angles based on the viewpoint to be displayed includes: The target angle identifier corresponding to the viewpoint to be displayed is determined from each of the angle identifiers using the animation state machine.
[0015] By adopting the above technical solution, the dressing angle and the character's viewpoint can be synchronized through the animation state machine, which can help ensure the display effect of the dressing.
[0016] Optionally, the target costume component is a script that inherits from Scriptable Object, and the display resource is an image or animation.
[0017] Optionally, before obtaining the target outfit component corresponding to the target outfit indicated by the outfit change command, the method further includes: Obtain the 3D costume model corresponding to the target costume, and add the 3D costume model to the acquisition scene; Create a camera in the captured scene; For each preset angle, the 3D costume model is controlled to rotate to the preset angle, and the camera is controlled to perform pixel acquisition on the 3D costume model to obtain the display resources corresponding to the preset angle; The target costume component is constructed based on the display resources of each preset angle.
[0018] By adopting the above technical solution, the corresponding costume parts can be generated based on the corresponding 3D costume model, thereby realizing the conversion between 3D costume model and 2D costume material.
[0019] Optionally, the method further includes: If the game character is detected to have acquired a game item, determine whether the game item is equipped with cosmetic resources; If the game item is equipped with costume resources, determine whether the costume part corresponding to the costume resources has a costume. If the costume part corresponding to the costume resource does not have a costume, generate a costume change command corresponding to the costume resource.
[0020] By adopting the above technical solution, the game character can be automatically dressed up based on the costume resources in the game props, which can help improve the user's gaming experience.
[0021] Secondly, this application provides an electronic device that adopts the following technical solution: An electronic device, the electronic device comprising: At least one processor; Memory; At least one application, wherein the at least one application is stored in memory and configured to be executed by at least one processor, the at least one application being configured to: execute any of the 2D game partial costume change methods provided in the first aspect.
[0022] Thirdly, this application provides a computer-readable storage medium, which adopts the following technical solution: A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform any of the 2D game partial costume-changing methods provided in the first aspect.
[0023] In summary, this application includes at least one of the following beneficial technical effects: 1. Since the target costume is configured by display resources at at least two preset angles in the target costume component, when configuring the target costume, you only need to configure the costume component containing the display resources of the target costume at different preset angles to complete the partial costume replacement, without the need to use other professional tools. This simplifies the costume design process and improves the efficiency of game development.
[0024] 2. Since the design of costumes does not need to take into account the actual movement of the game characters, but only needs to consider images of the costumes at a few preset angles, the number of images required in the costume design process can be reduced, which in turn can help reduce the workload of artists in the game design process. Attached Figure Description
[0025] Figure 1 This is a flowchart illustrating a partial costume change method for a 2D game provided in an embodiment of this application; Figure 2 This is a flowchart illustrating a garment replacement method provided in an embodiment of this application; Figure 3 This is a flowchart illustrating a method for determining the display viewpoint provided in an embodiment of this application; Figure 4 This is a flowchart illustrating another method for determining the display viewpoint provided in an embodiment of this application; Figure 5 This is a flowchart illustrating a method for constructing a target cosmetic component according to an embodiment of this application; Figure 6 This is a flowchart illustrating a method for generating a costume change instruction according to an embodiment of this application; Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0026] To make the purpose, technical solution, and advantages of this application clearer, the following description is provided in conjunction with the appendix. Figure 1-7 The present application will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the application.
[0027] In related technologies, the dress-up method in 2D games includes the following steps: The first method involves using the Spine animation plugin in Unity3D to achieve partial costume changes between Spine models of different styles by replacing slot data and deformation data.
[0028] The second method involves converting 3D models into 2D images, generating a set of images for each body part and movement, and then switching between these images to achieve the desired outfit change effect.
[0029] However, among the above-mentioned dress-up methods: the Spine-based dress-up method requires the use of specialized tools and formats, and may result in inconsistent styles or animation distortions. On the other hand, achieving dress-up through frame-by-frame animation requires a large number of image resources, which is very labor-intensive, and it is difficult to achieve smooth transitions and detailed animation.
[0030] This application discloses a method for partial costume change in 2D games. This embodiment uses the application of this method in Unity3D as an example for illustration. In actual implementation, this method can also be applied to other design software. This embodiment does not limit the application scenarios of this method.
[0031] Reference Figure 1 The method for partial costume changes in 2D games includes the following steps: Step 101: In response to the dress-up command corresponding to the game character, obtain the target dress-up component indicated by the dress-up command.
[0032] In this context, "outfit" refers to components used to decorate a game character. Specifically, outfits can include clothing, pants, shoes, hats, gloves, scarves, etc., as long as they can be used to decorate the game character. This embodiment does not limit the type of outfit. In this embodiment, the target outfit is the outfit indicated by the outfit change command. There can be one or more target outfits. This embodiment does not limit the type of target outfit.
[0033] The dressing-up component includes display resources for the dressing-up at at least two preset angles, where the display resources may be the same or different at different preset angles. Optionally, the display resources can be images or animations. In this embodiment, the dressing-up component corresponding to the dressing-up is preset. In one instance, the dressing-up component is a script that inherits from Scriptable Object; in this case, the script can act as a data container to store the dressing-up resources corresponding to each preset angle. In this embodiment, the target dressing-up component is the dressing-up component of the target dressing-up.
[0034] The preset angle is based on the game character's perspective. Specifically, during gameplay, the game character's perspective is generally movable, and this movement is achieved through the character's own movement. Therefore, the character's display changes as the perspective moves. Since costume items are applied to the character, setting a preset angle based on the character's perspective helps adjust the costume's display according to the character's perspective movement, thus improving the costume's visual appeal.
[0035] In actual implementation, the game character's perspective can be represented by the angle the game character is facing. For example, when the game character's perspective is facing directly forward, the perspective is 0 degrees.
[0036] In one example, the preset angles correspond one-to-one with the game character's perspective, that is, one preset angle corresponds to one perspective of the game character.
[0037] In 2D scenes, game character animations are generally composed of a series of animated frames. For example, the animation of a game character moving consists of animated frames of the character lifting one foot, taking a step, and lifting the other foot. In related technologies, these animated frames themselves include the game character's outfit. If you want to change outfits, the animated frames of the character's movement also need to be replaced. Therefore, the number of images required to change outfits is the product of the number of animated frames and the number of outfits. As the complexity of game character animations increases, the number of images required to change outfits will increase significantly.
[0038] In the technical solution provided in this embodiment, since the character and the costume are separated and the costume is synchronized through the character's perspective, it is only necessary to consider the images of the costume at a few preset angles to achieve the costume. Thus, the number of images required to achieve the costume change is the product of the number of preset angles (constant) and the number of costumes, and will not be affected by the character animation, which can help reduce the workload in the game design process.
[0039] Step 102: Update the costume data of the target part of the game character based on the target costume component.
[0040] In this embodiment, the target body part corresponds to the target outfit. Specifically, the game character includes at least one outfit part, and each outfit part corresponds to an outfit. For example, an outfit part may include a hand, and the outfit corresponding to the hand is gloves; another example is an outfit part may include the upper body, and the outfit corresponding to the upper body is clothing. In this embodiment, the correspondence between outfit parts and outfits is preset, and the target body part is the outfit part corresponding to the target outfit.
[0041] Costume data is used to record the costumes corresponding to each costume part of the game character.
[0042] In one example, the costume data is represented by the correspondence between costume parts and costume components. In this case, updating the costume data of the target part of the game character based on the target costume component includes binding the target costume component to the target part. Specifically, binding the target costume component to the target part includes: whether there is a costume component already bound to the target part; if so, first unbind the target part from the already bound costume component, and then bind the target costume component to the target part; if not, then bind the target costume component to the target part.
[0043] In another example, the costume data includes display resources of the costume parts at various preset angles. In this case, updating the costume data of the target parts of the game character based on the target costume parts includes: determining the display resources at various preset angles recorded in the target costume parts as the costume data corresponding to the costume parts.
[0044] Step 103: Render the game character based on the updated outfit data to update the game character's outfit.
[0045] Since the costume data is updated based on the target costume data, and the target costume component includes display resources of the target costume from at least two angles, and the preset angles are set based on the game character's perspective, the display method of the target costume can be determined by combining the game character's perspective during the rendering process. This allows the target costume to be worn on the game character in a suitable way, thereby enabling the updating of the game character's costume.
[0046] In one example, the game character is rendered based on the updated outfit data, including: obtaining the game character's current view; and rendering the game character based on the current view and the updated outfit data. This ensures that after a partial outfit change on the game character, the player's viewpoint movement will not result in offsetting or "distorting" of parts, thus improving the display effect.
[0047] In another example, rendering a game character based on updated outfit data involves controlling the game character to perform an outfit update action based on the updated outfit data, thereby updating the game character's outfit.
[0048] Among them, the dressing actions are preset. During the dressing action, the game character's perspective may change. At this time, it is necessary to update the display method of the game character's dressing based on the game character's real-time perspective and dressing data. This can help improve the display effect of the dressing.
[0049] Furthermore, the outfit update action is matched with the type of the target outfit. For example, if the target outfit is shoes, the character will perform the action of putting on shoes; if the target outfit is gloves, the character will perform the action of putting on gloves. This can help improve the player's gaming experience.
[0050] During gameplay, the game character's perspective will change. At this time, it is necessary to adjust the display method of the game character's outfit based on the changes in the game character's perspective and the outfit data. This can help improve the display effect of the outfit.
[0051] The implementation principle of the 2D game partial costume replacement method provided in this application embodiment is as follows: In response to a costume replacement command corresponding to a game character, the target costume component indicated by the costume replacement command is obtained. The target costume component includes display resources of the target costume at at least two preset angles, where the preset angles are set based on the game character's viewpoint. The costume data of the target part of the game character is updated based on the target costume component, with the target part corresponding to the target costume. The game character is rendered based on the updated costume data to update the game character's costume. In the above technical solution, since the target costume is configured through display resources at at least two preset angles in the target costume component, when configuring the target costume, only the costume component containing display resources of the target costume at different preset angles needs to be configured to complete the partial costume replacement, without the need for other professional tools. This simplifies the costume design process and improves the efficiency of game development.
[0052] In addition, the above technical solution does not require the design of the costume based on the actual movement of the game character, but only needs to consider the images of the costume at a few preset angles. This can reduce the number of images required in the costume design process, and thus help reduce the workload of the artists in the game design process.
[0053] In some implementations, reference Figure 2 The 2D game partial costume change method provided in this embodiment also includes the following steps: Step 201: Determine the target preset angle from various preset angles based on the viewpoint to be displayed.
[0054] The viewpoint to be displayed is predetermined.
[0055] In one example, the game character is rendered based on the updated costume data, including: obtaining the current view of the game character; determining the current view of the game character as the view to be displayed, and performing steps 201 to 203.
[0056] Optionally, a target preset angle is determined from various preset angles based on the viewpoint to be displayed, including: determining the preset angle corresponding to the viewpoint to be displayed as the target preset angle.
[0057] In this embodiment, the perspective of the game character can correspond one-to-one with the preset angle, or one preset angle can correspond to one perspective range. Different game angles correspond to different perspective ranges. This embodiment does not pre-limit the correspondence between perspective and preset angle.
[0058] Optionally, the preset angle is represented by an angle identifier, and the game character's viewpoint is controlled by an animation state machine. During the configuration of the animation state machine, the angle identifier is matched with the game character's viewpoint.
[0059] Accordingly, the target preset angle is determined from various preset angles based on the viewpoint to be displayed, including: The target angle marker corresponding to the viewpoint to be displayed is determined from various angle markers using an animation state machine.
[0060] In one example, an animation state machine is used to create an animation that controls the game character's viewpoint from top to bottom. The angle markers of the costume parts are configured on the animation state machine so that when the character's viewpoint changes, the angle of the local costume will also be adjusted, which can help ensure the consistency between the costume display angle and the character display angle.
[0061] In the above technical solution, since the angle identifier used to identify the preset angle can be configured into the animation state machine used to control the view of the game character, and the target angle identifier corresponding to the view to be displayed can be determined through the animation state machine, the dressing angle and the view orientation of the character can be synchronously changed through the animation state machine, which can help ensure the display effect of the dressing.
[0062] Step 202: Determine the resources to be displayed for each part of the game character's costume based on the target preset angle and costume data.
[0063] Optionally, the display resources corresponding to each costume part of the game character are determined based on the target preset angle and costume data, including: for each costume part of the game character, the display resources of the costume part recorded in the costume data at the target preset angle are determined as the display resources corresponding to the costume part.
[0064] Step 203: Display the game character's outfit based on the resources to be displayed corresponding to each of the game character's outfit parts.
[0065] Optionally, the game character can be dressed up and displayed based on the resources to be displayed corresponding to each of the game character's costume parts, including: displaying the resources to be displayed corresponding to each of the game character's costume parts, such as: displaying the images to be displayed for each of the game character's costume parts.
[0066] In the above embodiments, since the target preset angle can be determined from various preset angles based on the view to be displayed, and the display resources corresponding to each costume part of the game character can be determined based on the target preset angle and the costume data; finally, the game character is displayed based on the display resources. In this way, the display method of the costume can be adjusted based on the view to be displayed, which can help improve the display effect of the costume.
[0067] Based on the above technical solution, further reference... Figure 3 The 2D game partial costume change method provided in this embodiment also includes: Step 301: When a change in the game character's perspective is detected, obtain the game character's perspective after the change and the perspective before the last display of the change.
[0068] Step 302: Determine whether there is an interval view between the changed viewpoint and the original viewpoint.
[0069] An intervening perspective refers to the perspective between the original perspective and the changed perspective. Specifically, in actual implementation, the perspectives of game characters are usually arranged in a certain order, such as by moving from one direction to another (e.g., from top to bottom). Therefore, there will be at least one intervening perspective between two non-adjacent perspectives.
[0070] Optionally, the number of interval viewpoints can be one or more. This embodiment does not limit the display method of interval viewpoints.
[0071] During actual gameplay, uncontrollable frame skipping may occur, which may result in missing frames and affect the display effect. Based on this, the method provided in this embodiment can further determine whether there is an intermittent view and perform further processing when an intermittent view exists, which can help ensure the display effect.
[0072] Step 303: In the case of an interval view, the interval view and the changed view are determined as the view to be displayed in sequence, and the step of displaying the decoration based on the view to be displayed is executed, that is, steps 201 to 203 are executed.
[0073] In the above implementation, since there is an interval between the game character's perspective after the change and the perspective before the change, the interval perspective and the changed perspective are determined as the perspective to be displayed in sequence, and the decoration is displayed based on the perspective to be displayed. This can help improve the smoothness of the game process, avoid frame skipping, and thus help ensure the display effect.
[0074] Based on the above technical solution, further reference... Figure 4 In step 303 above, before determining the interval view and the changed view as the view to be displayed in sequence, the following steps are also included: Step 401: Determine whether the interval view is a critical view.
[0075] In one example, key perspectives are pre-defined; for instance, some angles containing key game character actions are designated as key perspectives. This allows us to determine whether interval perspectives are key perspectives. Furthermore, when there are multiple game characters, the key perspectives corresponding to different characters may be the same or different.
[0076] In another example, determining whether an interval view is a critical view includes: determining whether the angle between the interval view and the changed view, and the angle between the interval view and the view before the change, are both greater than a preset angle threshold; if so, the interval view is determined to be a critical view; if not, the interval view can be directly determined not to be a critical view, or the determination of whether the interval view is a critical view can be continued in other ways.
[0077] Optionally, if there are multiple interval viewpoints, each interval viewpoint may be determined as a key viewpoint.
[0078] Step 402: When the interval view is the key view, the interval view and the changed view are determined as the view to be displayed in sequence, and the step of displaying the decoration based on the view to be displayed is executed, that is, steps 201 to 203 are executed.
[0079] In the above technical solution, when the interval view is the key view, the interval view and the changed view are determined as the view to be displayed in sequence, and the decoration is displayed based on the view to be displayed. This can help to display the screens corresponding to the interval view and the changed view in sequence, thereby helping to avoid missing the key view and thus helping to improve the continuity of the game animation.
[0080] Step 403: If the interval view is not a key view, determine the changed view as the view to be displayed, and perform the step of displaying the decoration based on the view to be displayed, that is, execute steps 201 to 203.
[0081] In other words, if the interval view is not a key view, the decoration display will not be based on the interval view.
[0082] In the above technical solution, when the interval view is not a key view, only the changed view is determined as the view to be displayed, so that the decoration is displayed directly based on the view to be displayed. This can help improve the real-time performance of the screen display, and thus help reduce the latency of game animation.
[0083] In the above implementation, after determining whether the interval view is a key view, the interval view is further determined. Only when the interval view is a key view is the interval view determined as a key view and the screen of the interval view is displayed. In this way, the processing method of the interval view can be reasonably determined by combining whether the interval view is a key view, which can help ensure the effect of game screen display.
[0084] In some implementations, alternatively, refer to Figure 5 Before obtaining the target costume part of the target costume indicated by the costume change command in step 101, the following steps are included: Step 501: Obtain the 3D costume model corresponding to the target costume and add the 3D costume model to the acquisition scene.
[0085] Among them, the 3D costume model is pre-drawn by designers using design software.
[0086] In one example, the 3D costume model corresponding to the target costume is imported into the Unity project, and the 3D costume model is added as a child object to the capture scene.
[0087] Step 502: Create a camera in the scene being captured.
[0088] Optional, the camera is a Unity camera.
[0089] In one example, during camera creation, it's necessary to ensure the camera can capture pixel-level images and determine the width and height of the 3D costume model when converted to a 2D display resource. Then, a RenderTexture object is created, and the determined image width and height are set. The camera's rendering target is then set to this RenderTexture object. Finally, the Unity camera's built-in Reader() method is used to render the 3D costume model into the RenderTexture object.
[0090] Step 503: For each preset angle, control the 3D costume model to rotate to the preset angle, and control the camera to collect pixels of the 3D costume model to obtain the display resources corresponding to the preset angle.
[0091] In one example, controlling the camera to capture pixels of a 3D costume model includes copying the pixel data of the RenderTexture to a Texture2D object for conversion.
[0092] Step 504: Construct the target decoration component based on the display resources of each preset angle.
[0093] In one example, display resources for each preset angle are stored in the initial decoration component to obtain the template decoration component.
[0094] In the above embodiments, since the 3D dress-up model corresponding to the target dress-up can be converted into 2D display resources from various angles by capturing images from different angles with a camera, and the target dress-up parts can be constructed based on the 2D display resources from various angles, the dress-up parts corresponding to the dress-up can be generated based on the 3D dress-up model corresponding to the dress-up, thereby realizing the conversion between 3D dress-up models and 2D dress-up materials.
[0095] In some implementations, reference Figure 6 The 2D game partial costume change method provided in this embodiment also includes the following steps: Step 601: If the game character is detected to have acquired a game item, determine whether the game item is equipped with cosmetic resources.
[0096] Game items are pre-set in the game scene; these items can be treasure chests, lucky bags, etc. The methods by which game characters acquire these items are also pre-set, such as: staying within the activation range of the item and performing the corresponding pick-up action.
[0097] In one example, determining whether a game item has a costume resource configured includes: determining whether a game item has a costume configured; if a game item has a costume configured, determining whether the costume configured on the game item matches the game character; if the costume configured on the game item matches the game character, determining that the game item has a costume resource configured; if the costume configured on the game item does not match the game character, determining that the game item does not have a costume resource configured.
[0098] This includes the configuration settings for game resources and outfits.
[0099] The matching relationship between game characters and outfits is preset.
[0100] In actual implementation, if the game item has decorations configured, it can be directly determined that the game item has decoration resources configured.
[0101] Optionally, the number of outfits that can be included in the outfit resources can be one or more.
[0102] Step 602: If there are costume resources on the game props, determine whether there is a costume on the costume part corresponding to the costume resources.
[0103] Among them, determining whether the game part corresponding to the costume resource has a costume includes: determining whether the costume part corresponding to the costume resource has a costume.
[0104] Furthermore, when the costume resource includes multiple costumes, it is determined whether the costume part corresponding to each costume in the costume resource has a costume; if it is determined that the costume part corresponding to at least one costume in the costume resource does not have a costume, it is determined that the costume part corresponding to the costume resource does not have a costume; if it is determined that the costume parts corresponding to all costumes in the costume resource have a costume, it is determined that the costume part corresponding to the costume resource has a costume.
[0105] Step 603: If there is no outfit for the outfit part corresponding to the outfit resource, generate the outfit change command corresponding to the outfit resource.
[0106] Optionally, when the costume resource includes multiple costumes, and the corresponding costume part of the costume resource does not have a costume, a costume change command corresponding to the costume resource is generated. This includes generating a costume change command based on the costumes among the costumes corresponding to the costume resource whose corresponding costume parts do not have a costume. In this way, the costume change command can be used to change the costume parts of each costume part that does not have a costume simultaneously, which can help improve the costume change effect.
[0107] Optionally, if there is an outfit for the corresponding outfit part of the outfit resource, the outfit in the outfit resource can be stored in the game character's inventory, or an outfit selection interface can be generated for the user to choose whether to change outfits. If the user chooses to change outfits, an outfit change command can be generated based on the outfit selected by the user.
[0108] In the above technical solution, since it is possible to determine whether the game character has obtained game items and whether the items are equipped with resources, and if the items are equipped with costume resources and the costume part corresponding to the costume resources is not equipped, a costume change command corresponding to the costume resources can be generated. In this way, the game character can automatically change costumes based on the costume resources in the game items, which can help improve the user's game experience.
[0109] This application also provides an electronic device. For example... Figure 7 As shown, Figure 7The illustrated electronic device 700 includes a processor 701 and a memory 703. The processor 701 and the memory 703 are connected, for example, via a bus 702. Optionally, the electronic device 700 may also include a transceiver 704. It should be noted that in practical applications, the transceiver 704 is not limited to one type, and the structure of this electronic device 700 does not constitute a limitation on the embodiments of this application.
[0110] Processor 701 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 701 may also be a combination that implements computing functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0111] Bus 702 may include a pathway for transmitting information between the aforementioned components. Bus 702 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 702 can be divided into address bus, data bus, etc. For ease of representation, Figure 7 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0112] The memory 703 may be ROM (Read Only Memory) or other types of static storage devices capable of storing static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices capable of storing information and instructions, or EEPROM (Electrically Erasable Programmable Read Only Memory), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.
[0113] The memory 703 stores application code that executes the scheme of this application, and its execution is controlled by the processor 701. The processor 701 executes the application code stored in the memory 703 to implement the content shown in the foregoing method embodiments.
[0114] Electronic devices include, but are not limited to: mobile terminals such as mobile phones, laptops, PDAs (personal digital assistants), and PADs (tablet computers), as well as fixed terminals such as digital TVs and desktop computers. They can also serve as server-side components. Figure 7 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0115] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed in a computer, causes the computer to perform the 2D game partial costume change method provided in the above embodiments.
[0116] It should be understood that although the steps in the flowcharts in the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise expressly stated herein, there is no strict order in which these steps are performed, and they may be performed in other orders.
[0117] The above are only some embodiments of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for partial costume changing in a 2D game, characterized in that, The method includes: In response to a dress-up command corresponding to a game character, the system obtains a target dress-up component of the target dress-up indicated by the dress-up command. The target dress-up component includes display resources of the target dress-up at at least two preset angles, and the preset angles are set based on the game character's viewpoint. The game character's target body part is updated based on the target body part, and the target body part corresponds to the target body part; The game character is rendered based on the updated outfit data to update the game character's outfit.
2. The method according to claim 1, characterized in that, The method further includes: The target preset angle is determined from each of the preset angles based on the viewpoint to be displayed, wherein the viewpoint to be displayed is predetermined. Based on the target preset angle and the costume data, determine the resources to be displayed corresponding to each costume part of the game character; The game character is dressed up and displayed based on the displayable resources corresponding to each of the costume parts of the game character.
3. The method according to claim 2, characterized in that, The method further includes: When a change in the game character's perspective is detected, the game character's perspective after the change and the perspective before the last display of the change are obtained; Determine whether there is an interval view between the changed viewpoint and the original viewpoint; In the presence of the interval view, the interval view and the changed view are sequentially determined as the view to be displayed, and the step of displaying the decoration based on the view to be displayed is executed.
4. The method according to claim 3, characterized in that, Before determining the interval view and the changed view as the view to be displayed in sequence, the method further includes: Determine whether the interval viewpoint is a critical viewpoint; When the interval view is a key view, the interval view and the changed view are sequentially determined as the view to be displayed, and the step of displaying the decoration based on the view to be displayed is executed; If the interval view is not a key view, the changed view is determined as the view to be displayed, and the step of displaying the decoration based on the view to be displayed is executed.
5. The method according to claim 2, characterized in that, The preset angle is represented by an angle identifier, and the game character's viewpoint is controlled by an animation state machine. During the configuration of the animation state machine, the angle identifier is matched with the game character's viewpoint. The step of determining the target preset angle from each of the preset angles based on the viewpoint to be displayed includes: The target angle identifier corresponding to the viewpoint to be displayed is determined from each of the angle identifiers using the animation state machine.
6. The method according to claim 1, characterized in that, The target cosmetic component is a script that inherits from ScriptableObject, and the display resource is an image or animation.
7. The method according to claim 1, characterized in that, Before obtaining the target outfit component corresponding to the target outfit indicated by the outfit change command, the method further includes: Obtain the 3D costume model corresponding to the target costume, and add the 3D costume model to the acquisition scene; Create a camera in the captured scene; For each preset angle, the 3D costume model is controlled to rotate to the preset angle, and the camera is controlled to perform pixel acquisition on the 3D costume model to obtain the display resources corresponding to the preset angle; The target costume component is constructed based on the display resources of each preset angle.
8. The method according to claim 1, characterized in that, The method further includes: If the game character is detected to have acquired a game item, determine whether the game item is equipped with cosmetic resources; If the game item is equipped with costume resources, determine whether the costume part corresponding to the costume resources has a costume. If the costume part corresponding to the costume resource does not have a costume, generate a costume change command corresponding to the costume resource.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; Memory; At least one application, wherein the at least one application is stored in memory and configured to be executed by at least one processor, said at least one application being configured to: perform the 2D game partial costume change method according to any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed in the computer, the computer is instructed to perform the 2D game partial costume change method according to any one of claims 1 to 8.
Citation Information
Patent Citations
2D game local reloading method
CN111214832A