The main player is the character controlled by the user of the game. The main player is handled as a special type of Item, it uses its own script, and there are different rules that apply to it.
When your main scene contains a player that can be controlled by the user, you must instance the player in that scene. There is no main player instanced "globally" that is moved from scene to scene, it's up to you to provide a player in the current scene, if it has one. Keep in mind that not all scenes must have a character controlled by the user.
An example player scene can be found in scenes/test/player.scn.
The player scene is relatively simple, there are few requirements for it to function inside the game. However, player will usually end up being complex scenes, due to their high animation requirements. The basic scene structure is:
Anything else necessary (sprites, sound effects, etc.) can be added via normal nodes, and controlled by animations.
The player script contains a few parameters to configure your player. They all appear in the Script Variables part of the Inspector:
There are 3 types of animations that can be configured in the player to play depending on the angle it's facing: walking, speaking and idle. These animations are configured using a gdscript file with 4 simple structures, one defining what are the angles at which each animation is used, and 3 defining the animation names for each type of animation corresponding to the angles, and a parameter for mirroring the X axis of the animation. This is a very basic example, with only 2 directions, left and right:
# angle "0" is facing the camera, rotates counter clock-wise, angle 90 is profile right, etc
const dir_angles = [ 180, 360 ]
const directions = [ "walk_right", 1, "walk_right", -1 ]
const idles = [ "idle_left", -1, "idle_left", 1 ]
const speaks = [ "speak_left", 1, "speak_right", 1 ]
dir_angles array lists the angles that serve as limits between one animation as the next. They must be sorted from lower to higher. This list defines 2 ranges of angles, one is between 180 and 360, the other between 360 and 180. As you can see, the first range is defined by the last angle, as the circle wraps around.
directions array defines the walk animation to use in each range of angles, and a number to be used to scale the X axis of that animation. 1 means leave the animation intact, -1 means mirrored horizontally. Each animation corresponds to a range of the dir_angles list.
idles array defines idle animations, and the
speaks array defines the speaking animations.
Keep in mind that the angles start from 0 when the player is facing the camera, and rotate counter-clockwise. 90 means facing right, 180 means facing the back, etc.
Il y a une erreur de communication avec le serveur Booktype. Nous ne savons pas actuellement où est le problème.
Vous devriez rafraîchir la page.