How to Create ENEMY MOVEMENT in Godot 4

Поділитися
Вставка
  • Опубліковано 25 вер 2024

КОМЕНТАРІ • 72

  • @jeffclark4649
    @jeffclark4649 4 місяці тому +15

    Hey DevWorm, keep doing what you're doing. These tutorials are really helpful and I'm sure I don't speak for myself when I say they are greatly appreciated.

    • @dev-worm
      @dev-worm  4 місяці тому +3

      thank you! it means the world to me! glad they are helpful!

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

      I agree with this guy. I really cannot wait for the next vid

    • @gamingdragon6165
      @gamingdragon6165 4 місяці тому

      @@dev-worm when will the next vid come though?

    • @wabsastudios
      @wabsastudios 4 місяці тому

      @@dev-worm I always want to make a Pokémon like will you ever make one?please do

  • @MrDapperton
    @MrDapperton 2 місяці тому +3

    THIS WAS EXTREMELY EFFING HELPFUL YOU ROCK I LOVE YOU.

    • @dev-worm
      @dev-worm  2 місяці тому

      haha so glad i could help!!

  • @Unknowava
    @Unknowava 28 днів тому

    Great video man. I am starting to play with godot and your work is helping a lot

    • @dev-worm
      @dev-worm  27 днів тому

      I am so glad to hear that!! I hope everything comes together wonderfully! If you ever have any questions let me know!

  • @PollyCot
    @PollyCot 4 місяці тому

    Struggling hard with AI for my game but these give me a shimmer of hope.

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

    Loving your work! Just a suggestion for the bat wander function, rather than adding to its velocity you could use lerp from velocity to a new velocity so that you gradually change between the new velocities but can’t infinitely gain speed in any direction. Code would be something like: lerp (velocity, speed * direction, delta).

    • @dev-worm
      @dev-worm  4 місяці тому +1

      very good point! thank you! this passed right over me! so thank you

  • @buzzbuzz20xx
    @buzzbuzz20xx 4 місяці тому +2

    Awesome !!! glad to see the next part is out

    • @dev-worm
      @dev-worm  4 місяці тому

      thanks!! hope it helps!

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

    Your explanation is nice. I hope you can explain how the player rides a horse and picks up weapons from the ground😊

    • @Ironpants57
      @Ironpants57 4 місяці тому

      Riding a horse would be a player state or boolean; is_riding:bool. It's much like the weapon equip in an earlier video in the series. You would also need more sprites.

    • @bradleywood1984
      @bradleywood1984 4 місяці тому

      @@Ironpants57 That's right. Personally I would use a state machine for all that since the logic can get a little much but you could just as easily use a single script with a bunch of conditonals.

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

    Hey DevWorm, I learned From You To Much! but can you make a tutorial about export game to android 8 in godot 4 becuase i saw a lot of videos and cant do it😢

  • @Pabloparsil
    @Pabloparsil 4 місяці тому +3

    Protip: arrays have a .pick_random method! (I didn't know this but I figured there had to be a function for this).
    Hope it helps!

    • @dev-worm
      @dev-worm  4 місяці тому +3

      ah thanks!! that is super helpful!

  • @gaborszafner9662
    @gaborszafner9662 4 місяці тому

    I genuinely feel like you have the most varied topics on Godot 4 on the platform. You have a video for everything. Only if you could talk 20% slower ^^ as a non-native speaker I have to keep going back. But love your videos a lot, really. Thanks for these guides.

    • @dev-worm
      @dev-worm  4 місяці тому +1

      thank you so much!! it truly means the world!! I am sorry about the speaking thing!! I really do apologize and I will take note for the future! but if you ever cant understand something then please just let me know!

    • @StepTheGlow
      @StepTheGlow 4 місяці тому

      broo you can use caption it helps out a ton except when mrbeast talks too much the youtube crash--uhadahdijihia............."THIS COMMENT WAS DELETED BY UA-cam"

  • @JiKayPh
    @JiKayPh 3 місяці тому +1

    Nice! Looking forward to the next vids!

    • @dev-worm
      @dev-worm  3 місяці тому

      thank you!! coming soon!

  • @kazmefe6574
    @kazmefe6574 2 місяці тому +1

    I get invalid get index position error

  • @901oi2
    @901oi2 2 місяці тому

    Hey absolutely love the tutorial, tho my script fails to print or move

  • @NocturnalPenguin
    @NocturnalPenguin 4 місяці тому

    You are awesome! Would it be possible to explain the process of how you let the bay access the player’s position? I saw that you had a global script and perhaps I missed it.

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

      Basically he made the player body global so that the bat script could use it. You need to go into the player script and initialize the player as self in the ready function. Then, you can call the player's body inside the bat script (or anyone else!) that you need it.

  • @htosh3837
    @htosh3837 4 місяці тому +6

    2 +2 = 4 - 1 = 3 quick maths

    • @derDooFi
      @derDooFi 4 місяці тому

      44 long and a 38, too, that’s 82 we’re doing the maths

  • @josephbaldwin9472
    @josephbaldwin9472 3 місяці тому

    I think i have to start from the beginning of the series cuz as soon as i start trying to do the player chase movement with the global script in my own game the Bat bugs out and just cant move

    • @dev-worm
      @dev-worm  3 місяці тому

      really? are you setting all the player related global variables to the correct values in the players script? Im not sure why the bat would be bugging out. Is there anything that seems off from your point of view? any errors or weird output messages or anything?

  • @sherges44
    @sherges44 2 місяці тому

    what does "Identifier "global" not declared in the current scope." mean?

    • @dev-worm
      @dev-worm  2 місяці тому

      it means you never declared global as a autoload variable!! maybe you didnt declare one at all or you declared it as Global? We create the autoload earlier in this series i believe!!

    • @sherges44
      @sherges44 2 місяці тому

      @@dev-worm sticking with one series is probably better than a bunch of sprawled out tutorials🥲

  • @slugplushie3787
    @slugplushie3787 23 дні тому

    i get an error that functions move and variable velocity is non detectable or not found in base self is there any fix?

    • @dev-worm
      @dev-worm  22 дні тому

      Im so sorry to hear that you are having an issue i hope i can help! Are you in godot 4? and are you adding the velocity variable onto a script that extends from a characterbody2d? because velocity should already a pre-build variable! Let me know if you are still having the issue, so i can help you out!!

    • @slugplushie3787
      @slugplushie3787 22 дні тому

      @@dev-worm Everything somewhat worked out, thank you so much

  • @ItsnoNoyt
    @ItsnoNoyt 2 місяці тому

    where does it come from Global?

  • @tnekkGD
    @tnekkGD 4 місяці тому

    awesome tutorial, now I'm just waiting for you to upload the movement of the frog because I'm making a game with the same concept of this and i can't make my own code for the enemy movement, so i need your help... and btw i subbed to your channel

    • @dev-worm
      @dev-worm  4 місяці тому +1

      frog is coming soon!! I'd say around episode 6... so about a week from today!! I hope it ends up being very helpful for your project!!

  • @Cryptobird_channel
    @Cryptobird_channel 4 місяці тому

    Awesome 👍😎, and finally u still didn't scale Ur editor which makes hard to see what U exactly doing 😂❤❤❤

    • @dev-worm
      @dev-worm  4 місяці тому +1

      so sorry! thanks for reminding me!! I just wrote this down on a sticky-note and Im gonna leave it on my keyboard so I remember! thanks!

  • @StepTheGlow
    @StepTheGlow 4 місяці тому

    ah can you help me it's been on my mind lately there's a game named "Swordigo" can you make a "tiny little bit" tutorial on how to make enemy slashing movement because I want similar movement and "enemy beating is fun" experience! thanks for reading!!!

    • @dev-worm
      @dev-worm  4 місяці тому

      Ill start looking into it!! thanks for letting me know!

    • @StepTheGlow
      @StepTheGlow 4 місяці тому

      @@dev-worm thanks buddy!!

  • @justpietro2186
    @justpietro2186 4 місяці тому

    Those enemies also works on top down games right?

    • @dev-worm
      @dev-worm  4 місяці тому +1

      yes of course!! maybe just make the speed a little lower

  • @bleunny
    @bleunny 3 місяці тому

    Why is Vector2 is not working for me ??

    • @dev-worm
      @dev-worm  3 місяці тому

      are you getting any errors?

  • @TheLegend-v1p
    @TheLegend-v1p 2 місяці тому

    hey next time can u make a walking enemy ai without limboa ai

  • @dyramics
    @dyramics 10 годин тому

    hey im making a top down game with these tutorials, how would i get my guy to look the direction hes moving instead of the "flip_h" method?

  • @zhenya7670
    @zhenya7670 Місяць тому

    Please tell me what to do if a bat runs away from you?

    • @dev-worm
      @dev-worm  Місяць тому +1

      it most likely means you have a + or - mixed up in the code on the line that should be moving the enemy toward the player!

  • @itsME-dc4vm
    @itsME-dc4vm 4 місяці тому

    bro is my saviour ;D

    • @dev-worm
      @dev-worm  4 місяці тому

      haha! glad it was helpful!

  • @ReddXYZ
    @ReddXYZ 18 днів тому

    Everything works well until I try and get the bat to chase the player... Bat just drifts left and up forever. Added some print statements to try and get a better idea whats going on and while it managed to fix the player body not being set properly... My bats are still broken.
    Checking if Global.playerBody is set:true
    Bat position: (317.1307, 317.8358)
    Player position: (-92.40769, 316.9241)
    Direction to player: (-0.999998, -0.002226)
    Velocity before move and slide:(-29.99993, -0.066783)
    Position after move and slide:(316.6308, 317.8347)
    Velocity after move and slide: (-29.99993, -0.066783)
    -1
    Checking if Global.playerBody is set:true
    Bat position: (316.6308, 317.8347)
    Player position: (-92.40769, 316.9241)
    Direction to player: (-0.999998, -0.002226)
    Velocity before move and slide:(-29.99993, -0.066785)
    Position after move and slide:(316.1308, 317.8336)
    Velocity after move and slide: (-29.99993, -0.066785)
    -1
    Checking if Global.playerBody is set:true
    Bat position: (316.1308, 317.8336)
    Player position: (-92.40769, 316.9241)
    Direction to player: (-0.999998, -0.002226)
    Velocity before move and slide:(-29.99993, -0.066786)
    Position after move and slide:(315.6307, 317.8325)
    Velocity after move and slide: (-29.99993, -0.066786)
    -1

  • @zirathar
    @zirathar 29 днів тому

    can you give me the script here?

  • @neptun3189
    @neptun3189 4 місяці тому

    heck yes dude, heck yes

    • @dev-worm
      @dev-worm  4 місяці тому

      hope it helps!! thanks!

  • @stormingelysium1996
    @stormingelysium1996 4 місяці тому

    It made me laugh when we first give our bat movement and mine flew straight up, then suddenly veered off and flew off the side and never came back : p

    • @dev-worm
      @dev-worm  4 місяці тому

      haha did the little bat run away... how did everything come out in the end??

  • @gryzman
    @gryzman 4 місяці тому

    there's a function that picks random value, pick_random()

    • @dev-worm
      @dev-worm  4 місяці тому

      yes! sorry about that! I could've saved a line of code!! didnt know this was a function! so thanks for letting me know!

  • @YuvanMuthuram
    @YuvanMuthuram 4 місяці тому

    what is topic of next video

    • @dev-worm
      @dev-worm  4 місяці тому

      the next tutorial will release in 3 days from now!! It is a huge tutorial and will cover combat!

  • @jasonwilliams8730
    @jasonwilliams8730 4 місяці тому

    👍

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

    First comment 🎉🎉🎉