Criando e implementando as animações com o AnimationTree #3 - Criando um rpg top/down na Godot 4.0

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ส.ค. 2024
  • 📢 Link dos meus cursos (COM DESCONTO): linktr.ee/devb...
    📢 LINKS UTILIZADOS NO VÍDEO
    🎨 Link para Download das assets utilizadas: game-endeavor....
    📶 Link para download da Godot: godotengine.or...
    📢 MINHAS REDES SOCIAIS
    🎥 Link para o meu perfil na Twitch: / devbandeira
    📚 Link para o meu perfil na Udemy: www.udemy.com/...
    🐈‍⬛ Link para o meu perfil no GitHub: github.com/Ban...
    📠 Link para o meu servidor no Discord: / discord
    #rpg #godot #indiegame #tutorial #curso #cursogodot #iniciantes #desenvolvimentodejogos

ความคิดเห็น • 67

  • @Edmar_Dev
    @Edmar_Dev ปีที่แล้ว +6

    Muito bom. Você tem a intenção de fazer uma série específica para jogos plataforma na Godot 4?

  • @pascalcasier959
    @pascalcasier959 ปีที่แล้ว +1

    Gostei muito, ansioso para o próximo,...

  • @davidZnX2k
    @davidZnX2k ปีที่แล้ว +3

    Ficou bom dms

  • @lucivando1980
    @lucivando1980 ปีที่แล้ว +1

    Show, continua parceiro.

  • @_Kiota_
    @_Kiota_ 6 หลายเดือนก่อน

    Eu tentei simplificar a movimentação fazendo da seguinte forma:
    func _move() -> void:
    var _direction: Vector2 = Vector2(
    Input.get_axis("move_left", "move_right"),
    Input.get_axis("move_up", "move_down")
    )
    if _direction != Vector2.ZERO:
    _animation_tree["parameters/idle/blend_position"] = _direction
    _animation_tree["parameters/walk/blend_position"] = _direction
    _animation_tree["parameters/attack/blend_position"] = _direction
    velocity = _direction.normalized() * _move_speed
    return
    velocity -= velocity * _friction
    não sei se é a melhor maneira

  • @AexetanPowe
    @AexetanPowe 7 หลายเดือนก่อน

    func_animate() -> void:
    43
    if velocity.length() > 2:
    34
    31
    44
    _state_machine.travel("walk")
    45
    return
    46
    47
    _state_machine.travel("idle")
    48
    21
    pass

  • @VitorDSousa-dz4ik
    @VitorDSousa-dz4ik 4 หลายเดือนก่อน

    Se alguém estiver com problema de animação bugada (ex: walk right com os pés não aparecendo). Apague o blendspace2d com nome de walk e refaça. Para mim deu certo

  • @cavaleiro_olimpio3864
    @cavaleiro_olimpio3864 2 หลายเดือนก่อน

    Uma pergunta, meus sprites do personagens estão "picados", então, eu fiz vários Sprites2D, só que na hora de debugar, ele ficou todo bugado, por que tinha que colocar para exibir todos, aceito dicas 😄

  • @esthernadjavlog
    @esthernadjavlog ปีที่แล้ว +4

    pessoal, tambem estava dando erro na linha 15 pra mim, no: _state_machine = _animation_tree["parameters/playback"]
    dai eu vi que o erro era pq eu nao tinha linkado a animation tree com o player... espero q isso ajude!

    • @memesemdestaque3917
      @memesemdestaque3917 ปีที่แล้ว

      E como fazer isso ?

    • @esthernadjavlog
      @esthernadjavlog ปีที่แล้ว

      @@memesemdestaque3917 vai ate o player q vc criou, em objects tem animation tree, o meu estava "none", eu tive que escolher la a animation tree q eu tinha criado

    • @esthernadjavlog
      @esthernadjavlog ปีที่แล้ว

      @@memesemdestaque3917 ta no 11:40

    • @moongarts
      @moongarts 9 หลายเดือนก่อน

      god @@esthernadjavlog

    • @RAFAZILDOX
      @RAFAZILDOX หลายเดือนก่อน

      vlw dms!

  • @otaviogoncalves5071
    @otaviogoncalves5071 8 หลายเดือนก่อน

    Ótimo vídeo, Bandeira! Tudo está funcionando perfeitamente, exceto pela velocidade da animação do meu sprite. Eu fiz o meu sprite no tamanho 16 x 16 com cada animação tendo 2 frames, mas o colocar a animação no AnimationTree acabou ficando rápido demais. Esse problema está ocorrendo porquê? Tem algo haver com a quantidade de frames, ou é outro tipo de problema?

  • @Fonsecakkk
    @Fonsecakkk 9 หลายเดือนก่อน

    sensacional

  • @caiodiasz2697
    @caiodiasz2697 ปีที่แล้ว +1

    @DevBandeira não tô conseguindo comprar seu curso, não dá para colocar as informações do cartão

  • @GustavoHenrique-ch5rn
    @GustavoHenrique-ch5rn 7 หลายเดือนก่อน

    A animação do personagem correndo para baixo continua quando deveria estar em idle. Assim que eu solto, dá pra ver que ele volta pra animação de idle para baixo, depois vai para correr para baixo. Não tá acontecendo dos outros lados. Segue o código:

    • @GustavoHenrique-ch5rn
      @GustavoHenrique-ch5rn 7 หลายเดือนก่อน

      extends CharacterBody2D
      var _state_machine
      @export_category("Variables")
      @export var _move_speed: float = 64.0
      @export var _acceleration: float = 0.2
      @export var _friction: float = 0.8
      @export_category("Objects")
      @export var _animation_tree: AnimationTree = null
      #@export var
      func _ready() -> void:
      _state_machine = _animation_tree["parameters/playback"]
      func _physics_process(_delta: float) -> void:
      _move()
      _animate()

      move_and_slide()
      func _move() -> void:
      var _direction : Vector2 = Vector2(
      Input.get_axis("move_left", "move_right"),
      Input.get_axis("move_up", "move_down")
      )

      if _direction != Vector2.ZERO:
      _animation_tree["parameters/idle/blend_position"] = _direction
      _animation_tree["parameters/walk/blend_position"] = _direction
      velocity = lerp(velocity, _direction.normalized() * _move_speed, _acceleration)
      return

      velocity = lerp(velocity, _direction.normalized() * _move_speed, _friction)

      func _animate() -> void:
      if velocity.length() > 5:
      _state_machine.travel("walk")
      return
      _state_machine.travel("idle")

    • @GustavoHenrique-ch5rn
      @GustavoHenrique-ch5rn 7 หลายเดือนก่อน

      Depois de mais de 30 minutos quebrando cabeça, vi que coloquei a animação de walk down no lugar de idle down.

    • @zewesley177
      @zewesley177 6 หลายเดือนก่อน

      Tô com mesmo problema kkk

  • @diegoszch
    @diegoszch 7 หลายเดือนก่อน

    excelente

  • @LuizHenriqueEng.
    @LuizHenriqueEng. 8 หลายเดือนก่อน +1

    tem ferramenta dentro da godot pra ver o FPS do nosso game?

  • @joaomateuslimaa
    @joaomateuslimaa ปีที่แล้ว +1

    nice

  • @hildsonmoreira9156
    @hildsonmoreira9156 9 หลายเดือนก่อน +2

    No meu ocorre um delei na animação de correndo do right para o left como posso corrigir isso

    • @MindDevs-js8lg
      @MindDevs-js8lg 5 หลายเดือนก่อน

      No meu também mano conseguiu resolver?

  • @ssoulstt
    @ssoulstt 11 หลายเดือนก่อน

    muito bom

  • @Areuskk
    @Areuskk ปีที่แล้ว +1

    Esta dando erro na linha 15, e nao adianta por .get pois aparece que nao pode usar get no valor null

  • @YaakovDev
    @YaakovDev ปีที่แล้ว

    Mt bom

  • @GhustMhzt
    @GhustMhzt 5 หลายเดือนก่อน

    eu fiz as animações la de walk e idle , mas quando eu rodo o progama o personagem fica imagem parada

  • @moon-stone-studio
    @moon-stone-studio 8 หลายเดือนก่อน +1

    o meu ta dando erro no _animation_tree olha so
    extends CharacterBody2D
    var aceleraçao = 0.1
    var fricçao = 0.13
    var speed = 64.0
    var _state_machine
    @export_category("objects")
    @export var _animation_tree = AnimationTree
    func _ready():
    _state_machine = _animation_tree["parameters/playback"]

    pass
    func _physics_process(_delta):
    _move()
    _animation()
    move_and_slide()

    func _move():
    var direction = Vector2(
    Input.get_axis("move_left","move_right"),
    Input.get_axis("move_up","move_down")
    )
    pass
    if direction != Vector2.ZERO:
    _animation_tree["Parameters/idle/Blend_Position"] = direction
    _animation_tree["Parameters/walk/Blend_Position"] = direction

    velocity.x = lerp(velocity.x,direction.normalized().x * speed,aceleraçao)
    velocity.y = lerp(velocity.y,direction.normalized().y * speed,aceleraçao)
    else:
    velocity.x = lerp(velocity.x,direction.normalized().x * speed,fricçao)
    velocity.y = lerp(velocity.y,direction.normalized().y * speed,fricçao)
    func _animation():
    if velocity.length() > 1:
    _state_machine.travel("walk")
    else:
    _state_machine.travel("idle")
    ajuda pliz

    • @xoveupontocom
      @xoveupontocom 7 หลายเดือนก่อน +1

      Deixa o p de parameters minúsculo, e o blend_position também

  • @maia474
    @maia474 ปีที่แล้ว +2

    Mano estou acompanhando e na linha 15, mais especificamente em "_animation_tree", eu tive que colocar um ".get" ficando "_animation_tree.get", para tirar dois erros das seguintes descrições:
    Line15: Member "_animation_tree" is not a function.
    Line15: Name "_animation_tree" called as a function but os a "AnimationTree".
    Aí adicionei como falei o ".get" e saiu o erro, ou eu deveria mudar para "AnimationTree"?

    • @MoradorDoMaranhao
      @MoradorDoMaranhao ปีที่แล้ว +2

      Tá dando porquê não usa os "( )" mas sim: "[ ]".
      Daí fica: _state_machine = _animation_tree["parameters/playback"]
      Também estava com o mesmo erro, mas foi só ver esse detalhezinho besta ksks programação é incrível

    • @maia474
      @maia474 ปีที่แล้ว +1

      @@MoradorDoMaranhao sim depois de um tempo eu vi que era um detalhe besta, agora já finalizei todos os vídeos que o devbandeira fez e a janela de teste simplesmente trava e não carrega nada, nem erros tem.

    • @Areuskk
      @Areuskk ปีที่แล้ว

      Não consigo por ".get" por que aparece que o valor não pode ser nulll oque eu faço

  • @naoimporta167
    @naoimporta167 3 หลายเดือนก่อน

    Eu tentei e tá dando um erro na linha 31 do código

  • @joedavidferreiradasilva6295
    @joedavidferreiradasilva6295 3 หลายเดือนก่อน

    eu indo lá fazer 16 animações pois meu bonequinho move em 8 direções

  • @bunnyzzz
    @bunnyzzz 6 หลายเดือนก่อน

    Na parte
    func _animate() -> void:
    O void n fica vermelho, interfere em algo? Pois o meu jogo simplesmente crasha quando eu aperto a tecla para andar

    • @zewesley177
      @zewesley177 6 หลายเดือนก่อน

      Não mano, meu vida fica azul é capaz de vc ter digitado algo errado ou não ter apertado tab antes da digitação, deva aparecer uma mensagem nas informações quando crasha né?

    • @bunnyzzz
      @bunnyzzz 6 หลายเดือนก่อน

      @@zewesley177 sou mobile, n da pra dar tab, mas funcionou como um void normal meu nobre, vlw ai pela explicação

  • @nickolasvictor2081
    @nickolasvictor2081 ปีที่แล้ว +1

    Mano o meu escreve assim
    Invalid get 'parameters/playback' (on base: 'nil').

    • @luizbarreto
      @luizbarreto ปีที่แล้ว +2

      Estava com o mesmo problema resolvi da seguinte forma:
      substitui esta parte do codigo:
      @export_category("Objects")
      @export var _animation_tree: AnimationTree = null
      func _ready() -> void:
      _state_machine = _animation_tree["parameters/playback"]
      por:
      @onready var _animation_tree = $AnimationTree
      @onready var _state_machine = _animation_tree["parameters/playback"]

    • @Areuskk
      @Areuskk ปีที่แล้ว

      ​@@luizbarretoEi irmão tá dando erro

    • @darkside866
      @darkside866 10 หลายเดือนก่อน

      excelente cara, fazendo as aulas hoje, funcionou, ajudou demais!@@luizbarreto

    • @_Kiota_
      @_Kiota_ 6 หลายเดือนก่อน

      @@luizbarretovaleu mano, me ajudou, esqueceu de falar pro pessoal tirar a var _state_machine que tinha logo a cima, se não ia dar conflito com o @onready var _state_machine = _animation_tree["parameters/playback"]

  • @Rafael48276
    @Rafael48276 11 หลายเดือนก่อน +1

    o meu personagem continua andando infinito e não para.
    alguma coisa eu fiz errado? eu copiei todo o codigo mostrado no video.

    • @DevBandeira
      @DevBandeira  11 หลายเดือนก่อน

      Como ta o código de movimentação do personagem?

    • @Rafael48276
      @Rafael48276 11 หลายเดือนก่อน

      ​@@DevBandeira func _move() -> void:
      var _direction: Vector2 = Vector2(
      Input.get_axis("move_left", "move_right"),
      Input.get_axis("move_up", "move_down"),
      )

      if _direction != Vector2.ZERO:
      _animation_tree["parameters/idle/blend_position"] = _direction
      _animation_tree["parameters/walk/blend_position"] = _direction

      velocity.x = lerp(velocity.x, _direction.normalized().x * _move_speed, _accleration)
      velocity.y = lerp(velocity.y, _direction.normalized().y * _move_speed, _accleration)
      return

      velocity.x = lerp(velocity.x, _direction.normalized().x * _move_speed, _friction)
      velocity.y = lerp(velocity.y, _direction.normalized().y * _move_speed, _friction)

    • @otaviogoncalves5071
      @otaviogoncalves5071 8 หลายเดือนก่อน

      isso pode ser um erro no espaçamento do código abaixo do return do código de direção. Mais especificamente onde vc tem que colocar o _Fricction na linha do Velocity.x e .y. O que vc tem que fazer é alinhar o código apertando a tecla TAB, essas duas limhas precisam ficar alinhadas ao If _direction. espero ter ajudado.

  • @novomundoli
    @novomundoli 2 หลายเดือนก่อน

    mb

  • @MelquiorAbyss-qu7cw
    @MelquiorAbyss-qu7cw ปีที่แล้ว

    O meu não aparece a chave 0 para adicionar, alguem sabe como resolver?

    • @maia474
      @maia474 ปีที่แล้ว

      É de onde essa chave? De algum script?

    • @Areuskk
      @Areuskk ปีที่แล้ว

      ​@@maia474Maia, pode me ajudar com o meu código? Tá falhando na linha 15 pode me ajudar?

  • @b4b817
    @b4b817 ปีที่แล้ว

    Eu não sei GDscript eu estou aprendendo com o chatgbt

  • @stefanyford5742
    @stefanyford5742 หลายเดือนก่อน

    ...horas e horas perdidas vendo esses videos e outros ... e o meu boneco nao se mexe ....kkkkk esses videos complicam demais .... tristeza .....

    • @DevBandeira
      @DevBandeira  29 วันที่ผ่านมา

      @@stefanyford5742 Ai o problema está entre o computador e a cadeira! Muito boa sorte meu amigo!

  • @ramirocastro7260
    @ramirocastro7260 ปีที่แล้ว

    meu boneco só levanta o pé, não starta a animação toda

    • @Thiago-rs6cl
      @Thiago-rs6cl 5 หลายเดือนก่อน

      Você conseguiu resolver?

  • @jamaltrap1079
    @jamaltrap1079 ปีที่แล้ว +1

    extends CharacterBody2D
    var _state_machine
    @export_category("variables")
    @export var _move_speed: float = 64.0
    @export var _friction: float = 0.2
    @export var _acceleration: float = 0.2
    @export_category("Objects")
    @export var _animation_tree: AnimationTree = null
    func _ready() -> void:
    _state_machine = _animation_tree["parameters/playback"]
    func _physics_process(_delta: float) -> void:
    _move()
    _animated()
    move_and_slide()

    func _move() -> void:
    var _direction: Vector2 = Vector2(
    Input.get_axis("move_left", "move_right"),
    Input.get_axis("move_up", "move_down")
    )
    if _direction != Vector2.ZERO:
    _animation_tree["parameters/Idle/blend_position"] = _direction
    _animation_tree["parameters/Walt/blend_position"] = _direction
    velocity.x = lerp(velocity.x, _direction.normalized().x * _move_speed, _acceleration)
    velocity.y = lerp(velocity.y, _direction.normalized().y * _move_speed, _acceleration)
    return
    velocity.x = lerp(velocity.x, _direction.normalized().x * _move_speed, _friction)
    velocity.y = lerp(velocity.y, _direction.normalized().y * _move_speed, _friction)
    func _animated() -> void:
    if velocity.length() > 2:
    _state_machine.travel("Walt")
    return
    _state_machine.travel("Idle")

    • @jamaltrap1079
      @jamaltrap1079 ปีที่แล้ว +1

      Tem alguma coisa errada nesse código irmão? Pois depois que adicionei a animação até o 1° teste seu o sprite não quis andar mais

    • @maia474
      @maia474 ปีที่แล้ว +4

      extends CharacterBody2D
      var _state_machine
      var _is_attacking: bool = false
      @export_category("variables")
      @export var _move_speed: float = 64.0
      @export var _friction: float = 0.2
      @export var _acceleration: float = 0.2
      @export_category("objects")
      @export var _attack_timer: Timer = null
      @export var _animation_tree: AnimationTree = null
      func _ready() -> void:
      _state_machine = _animation_tree.get("parameters/playback")

      func _physics_process(_delta: float) -> void:
      _move()
      _attack()
      _animate()
      move_and_slide()
      func _move() -> void:
      var _direction: Vector2 = Vector2(
      Input.get_axis("move_left", "move_right"),
      Input.get_axis("move_up", "move_down")
      )
      if _direction !=Vector2.ZERO:
      _animation_tree.set("parameters/idle/blend_position", _direction)
      _animation_tree.set("parameters/walk/blend_position", _direction)
      _animation_tree.set("parameters/attack/blend_position", _direction)
      velocity.x = lerp(velocity.x, _direction.normalized().x * _move_speed, _acceleration)
      velocity.y = lerp(velocity.y, _direction.normalized().y * _move_speed, _acceleration)
      return
      velocity.x = lerp(velocity.x, _direction.normalized().x * _move_speed, _acceleration)
      velocity.y = lerp(velocity.y, _direction.normalized().y * _move_speed, _acceleration)
      velocity = _direction.normalized() * _move_speed
      func _attack() -> void:
      if Input.is_action_just_pressed("attack") and not _is_attacking:
      set_physics_process(false)
      _attack_timer.start()
      _is_attacking = true

      func _animate() -> void:
      if _is_attacking:
      _state_machine.travel("attack")
      return
      if velocity.length() > 10:
      _state_machine.travel("walk")
      return
      _state_machine.travel("idle")
      func _on_attack_timer_timeout() -> void:
      set_physics_process(true)
      _is_attacking = false

      func _on_attack_area_body_entered(_body) -> void:
      if _body.is_in_group("enemy"):
      _body.update_health(randi_range(1, 5))
      Tenta esse código, no meu funcionou e eu fiz como ele mencionou no vídeo.

    • @thiagosouza-cb5rs
      @thiagosouza-cb5rs 11 หลายเดือนก่อน

      nem todo heroi usa capa

    • @renanvictoralvesviana1697
      @renanvictoralvesviana1697 11 หลายเดือนก่อน

      muito obrigado