Make a Pokemon Game in Godot - Collisions, Trees, & Flowers (#4)

Поділитися
Вставка
  • Опубліковано 9 лют 2025

КОМЕНТАРІ • 46

  • @eaglestdogg
    @eaglestdogg Рік тому +33

    for anyone watching this now godot 4 changed the property cast_to to target_position so you'll have to change that from the tutorial code

    • @sayhelloethan
      @sayhelloethan Рік тому

      my character stopped moving is there a reason for that?

    • @sebastianikeman
      @sebastianikeman 10 місяців тому

      Absolute hero.

    • @jlee900
      @jlee900 7 місяців тому

      thank you

    • @skulleralt
      @skulleralt 5 годин тому

      bro you are a legend! ong

  • @mewblue3997
    @mewblue3997 3 роки тому +11

    This series is so good from a tutorial standpoint - straight to the point, clear audio, it's clear what you're doing and why and very few bugs in the code. Hoping you continue this, most tutorials don't even cover a combat system

  • @meme_insanity
    @meme_insanity Рік тому +14

    Also, one thing to add, since Godot 4:
    "cast_to" is now "target_position" (@eaglestdogg mentioned this)
    And
    In the if else statement of !ray.is_colliding, around line 73, add a new line that resets the percent_to_next_tile to 0.0, this can fix a bug when walking into a wall and directly turning back

    • @jlee900
      @jlee900 7 місяців тому

      thank you

    • @doobPendleton
      @doobPendleton 5 місяців тому

      You're amazing thanks this works

  • @bilsuart
    @bilsuart 3 роки тому +1

    Love this series! It’s helping me a lot! I hope it continues for as long as possible ! 👍

  • @philwonc
    @philwonc 3 роки тому

    I´ve started with Godot a couple of weeks ago. and this is the best Tutorial i have watched until now. I hope you create more tutorial series maybe with a 3d scene

  • @Drachenbauer
    @Drachenbauer 2 роки тому +3

    i turned the trees and flowers into a tilemap too.
    so the scenetree is much tidyer and not more so long and messy.
    Trees can use 32x16 Pixel cells and the options Half Offset : Offset X, Tile Origin : Bottom Left and Y Sort : On in the tilemap-properties.
    Use the whoole graphic as the visible size of the tile and add a 32x32 square collision box aligned to the top.
    In the tileset-properties under SelectedTile set Tex Offset y : -16
    Place this Tilemap in the YSort to make the player appear correctly behind the top of trees and in front of the bottom areas of trees.
    And set the collision properties of this tilemap the same as at the single tree was.
    I think, it´s a good idea, if all single-object-scenes (player, buildings, etc) in the YSort have the bottom edge of their contents on the y-origin.
    For the flowers you can create an animated texture just like used for the water.
    So you can add them to the tileset of an other 16x16 Pixel tilemap.
    If you make a tall grass-tilemap as i tell under the video about the tall grass, you can have the flowers in that same tilemap, beyause i coded it to activate it´s effects only on tall grass tiles.
    Tilemaps also simplify Terrain designing because you can just draw the objects into the 2d-view.

    • @hankhill340
      @hankhill340 2 роки тому +1

      Thank you these are very helpful tips!

  • @AutMouseLabs
    @AutMouseLabs Рік тому +4

    Hey all, for Godot 4 you need to add percent_moved_to_next_tile = 0 to the else branch for your if!ray.is_colliding() check. Otherwise the character takes an extra step when you turn around from a collision.

  • @salmantkhan
    @salmantkhan 3 роки тому

    Thanks again for the tutorial, really enjoying it, can't wait till the next one.

  • @light_fos
    @light_fos 3 роки тому +6

    5:09 Hey dude can you help me out? I moved it under the if statement but occasionally it still stutters

    • @vaalalves
      @vaalalves 2 роки тому +16

      Late but, I fixed it by adding "percent_moved_to_next_tile = 0.0" in the else part of the raycast check.
      As in:
      if !ray.is_colliding():
      ...
      else:
      percent_moved_to_next_tile = 0.0
      is_moving = false
      Hope that helps, if not you, maybe the future viewers.

    • @mojodito7889
      @mojodito7889 2 роки тому

      @@vaalalves TY! your a legend!

    • @DeeTasticGaming
      @DeeTasticGaming Рік тому

      @@vaalalves I know it's almost a year later, but thank you so much for this!!! I was going crazy lol

  • @sebastianikeman
    @sebastianikeman 10 місяців тому

    This guy was so good I wish he would return. Anyone have similar tutorial series to follow?

  • @brunch1572
    @brunch1572 3 роки тому +2

    When drawing tiles, you can do ctrl+shift + left click to draw filled box regions. Switch that to right click and you can erase.

    • @Arkeve
      @Arkeve  3 роки тому

      Thanks! Thats really helpful to know

  • @theolast9727
    @theolast9727 2 роки тому +3

    Excellent tutorial, but I have a small question. Why don't we use a tileset for the trees? You can do everything you need with a tileset as well--is there something I'm missing, or is it just personal preference?

  • @coxyca9995
    @coxyca9995 3 роки тому +2

    Great tutorial as usual, thank you!
    In terms of performances, is it better to handle the trees as tiles rather than collision instances? It's usually a pain to do so since you have to draw the top on a different layer but I'm kinda worried about performances in the long run with that many instances

  • @sempersolus5511
    @sempersolus5511 2 роки тому +1

    How does your water collision example work with the prospect of getting Surf?
    Or, more broadly, what if you want a type of tile to be passable only if a certain condition is met?

  • @Jim-gyswry
    @Jim-gyswry Рік тому

    Very good series, I think we all appreciate it a lot! 😊

  • @Baanchou
    @Baanchou 3 роки тому +1

    Thank you for these great tutorials!
    Quick question though, for the trees couldn't you just set them as a tilemap and paint them in like you can with grass? Or do you have to duplicate them because of the collision box?

  • @kyle-cg9mv
    @kyle-cg9mv 4 місяці тому +3

    came back to this video to report a potential bug in Godot 4.3. when I got to this part I had to exclude the /2 in the var desired_step: Vector2 = input_direction * TILE_SIZE /2 calc in the move function i forget why but i think it uncentered my player from the tiles when i collided with an object which made it impossible to walk over say a 1x1 grass tile etc could be due to my player being a tad larger than a 16x16 tile but anyway I have a fix.
    so instead of doing
    var desired_step: Vector2 = input_direction * TILE_SIZE /2
    ray.target_position = desired_step
    in the move func
    do ray.rotation_degrees = look_direction
    look_direction is just declared as var look_direction at the top of the script
    now in a new func _process(delta: float) -> void:
    add these if statements
    if facing_direction == 1:
    look_direction = -90
    if facing_direction == 2:
    look_direction = -180
    if facing_direction == 3:
    look_direction = 0
    if facing_direction == 0:
    look_direction = 90
    I basically printed out the facing direction and then correlated that with the rotation degrees where i wanted to rotate the racast this works the exact same and prevents the player from colliding with a tree and then walking away and being uncentered on the tiles which causes the game to function incorrectly. I also have my raycast target_position set to x: 0 and y: 14 this size firs with my sprite and may be different if your using the assets provided.
    not sure if this is a 4.3 issue or because my character is too large or what but here's the fix if anyone needs it goodluck!

    • @astrophel12
      @astrophel12 4 місяці тому +1

      I'm facing the same problem, your solution is super effective

    • @kyle-cg9mv
      @kyle-cg9mv 3 місяці тому

      @@astrophel12 glad this helped I ran into a few more problems along the way, in the future id like to find a more elegant solution to detect when a player is inside an area2D since we have custom collision this makes things a tad complicated. I went beyond this tutorial and implemented a hard coded battle system which will need to be made modular to handle different mons and such this tutorial series to a point is very good until well its not... since its outdated now sadly

  • @traversal6881
    @traversal6881 2 роки тому

    Is there much, if any, reason to do the ysort over just painting the trees in the top to bottom order from the start knowing that will occur?
    Also, what is the reason you make your sprites their own scene instead of just grouping child nodes in the main scene? Is that for reusability across scenes without constantly redeclaring them?

  • @punkysuen
    @punkysuen 2 роки тому

    2:25, what does the $ sign mean here?

  • @dkoder4748
    @dkoder4748 2 роки тому

    I know i'm kinda late, but I'm following this tutorial, I did as you did, but my flowers are still out of sync when the game plays. Even though I've added the script

  • @KingBai
    @KingBai 3 роки тому

    Thank you so much ❣️

  • @neilwalker4277
    @neilwalker4277 3 роки тому +1

    Why not turn the flowers into an animated tile, It'll save on all those scene nodes?

    • @Arkeve
      @Arkeve  3 роки тому +2

      That's a good point, if we're not going to have any other functionality for it, it's best to have it as an animated tile. I might make that change in later videos, thanks for pointing it out!

    • @Drachenbauer
      @Drachenbauer 2 роки тому

      You can use an extra tilemap for the flowers so their background can stay transparent and you easily can use them on different colored basic terrain.

  • @thunder4158
    @thunder4158 3 роки тому +1

    Pls inventory #9

  • @muajin
    @muajin 3 роки тому

    Grrrr I'm so angry. I had a few completed projects from youtube vids that I did last year. I recently had my hdd crash and had to get a new one. 2 completed projects weren't in the Godot folder when i saved on my usb. T.T Still on my broken hdd..which will cost a lot to recover some data from. :((

  • @nekusakuraba4000
    @nekusakuraba4000 3 роки тому +1

    Your twitter link in the description is broken

    • @Arkeve
      @Arkeve  3 роки тому +1

      Thanks for letting me know! :)

  • @indrarestufauzi
    @indrarestufauzi 3 роки тому

    Great 👍