2D Metroidvania - 2 - Coding the player movement

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ธ.ค. 2024

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

  • @misterroo5672
    @misterroo5672 2 วันที่ผ่านมา

    Another great video! I made a little guy walk around. Never knew about Ctrl-D to dup and love holding Alt to move lines of code around.

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

    Okay these are really good and (no offense) pretty good at making these understandable while also not completely fencing this in. this seems easily expandable so far. thanks

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

    9:40 for some reason when i press right my character goes left. well, i fixed it by typing in -100.0 instead of 100.0

  • @srspanksalot4501
    @srspanksalot4501 5 หลายเดือนก่อน +3

    can you not just add input x speed x delta to your velocity instead of having an if statement?
    EDIT:
    if anyone is curious, you can, it just works slightly differently, but then you do not have so many branches. This assumes that you input_direction is always 1, -1, or 0. so analogue sticks would need to be clamped. otherwise I also just did some deceleration to make it a little smoother to stop. it looks like this for me
    extends CharacterBody2D
    var input_direction
    @export var max_speed = 100.0
    @export var acceleration = 20
    var delta_acceleration = acceleration * 60
    @export var gravity = 10.0
    @export var deceleration = 20
    var delta_deceleration = deceleration * 60
    func _ready():
    pass
    func _process(delta):
    movement(delta)
    func movement(delta):
    input_direction = Input.get_action_strength("right")-Input.get_action_strength("left")
    if input_direction != 0:
    velocity.x = move_toward(velocity.x, input_direction * max_speed, delta_acceleration * delta)
    $Sprite2D.scale.x = input_direction
    $AnimationPlayer.play("Walk")
    else:
    velocity.x = move_toward(velocity.x, 0, delta_deceleration * delta)
    $AnimationPlayer.play("Idle")
    move_and_slide()
    I learned this from working in 3D before. it is barely any code with one axis in 2d lmao

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

    I downloaded your assets but the file 2d_metroidvania_serie_mockup_1_tileset.png do not have these ground tiles 4:39 .
    And it do not have the files background_sprite_1 and 2 .

    • @jeanmakesgames
      @jeanmakesgames  10 หลายเดือนก่อน +1

      Oh thank you for saying, I’m gonna change it 👍☺️

    • @jeanmakesgames
      @jeanmakesgames  10 หลายเดือนก่อน +1

      I've uploaded the new one :)

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

    Isn't better to get the sprite_2D node and the animation node and put then into variables instead of using the get_node() function everytime you call a new animation in the scene? Great series, I like your style of arranging nodes and designing.

  • @Local-Hyena37
    @Local-Hyena37 10 หลายเดือนก่อน +2

    Hey, I have a question.
    It's about maps and different zones when creating a game. Do you recommend having yojr whole map in a single scene (but only load what is visible) or put each zone in a different scene ?
    I'm studying to be a game developper and I love your videos ❤ they are very clear and helpful !

    • @jeanmakesgames
      @jeanmakesgames  10 หลายเดือนก่อน +1

      Hello, and thank you very much for the kind word :)
      Depending on how big the game could be both option are valid, for the size of the game I'm making I personally recommend to have your map on one main scene, because it doesn't take that much space in the end and it's easier to manage :)

    • @Local-Hyena37
      @Local-Hyena37 10 หลายเดือนก่อน

      @@jeanmakesgames okay, thank you so much !!
      Your game looks very interesting, can't wait to play it !

    • @jeanmakesgames
      @jeanmakesgames  10 หลายเดือนก่อน +1

      @@Local-Hyena37 Thank you ☺☺☺

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

    Excellente vidéo, continue la série Question : c'est pas mieux de mettre la camera dans la scene du player ?

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

      Merci! Pas vraiment, c'est pas une solution atroce, mais ca manque de controle, je sort bientot une video ou je montre comment je creer une camera qui suit le player de trois maniere differente :)

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

    when i add the ground sprites and collision boxes for it my player can walk off the edge to the left and float. on the right side i can get almost to the edge and my player will phase through the ground. any idea why this is happening?

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

      I think it could be because the player's collision shape is rectangular and not in a capsule, or because when painting the tile (In tileset, in paint properties) you haven't shaped the physics layer.

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

    for some reason the amount u have for gravity for me is so much stronger ? if I jump it is going down so fast and if I walk of the edge its fast as hell ? what have I done wrong?

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

      me too

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

    Will there be automapping and a map the player can see? And variable jump height

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

      Map player can see yes, variable jump height yes as well ☺️ and auto mapping I don’t know what you mean by that

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

      @@jeanmakesgames sounds good. i meant that the map updates when player finds new places. Like in most metroidvanias

    • @jeanmakesgames
      @jeanmakesgames  10 หลายเดือนก่อน +1

      @@Yoni123 Oh ok, yeah this in godot can be done with signals so definitely that'll be on the map video :)

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

    good video, I love it

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

    Very helpful!

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

      Thank you, I'm glad it helps! :)

  • @MrpumpkinLV
    @MrpumpkinLV 3 หลายเดือนก่อน +1

    dont work

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

    Salut 👋