How to make Doom-style directional sprites in Godot

Поделиться
HTML-код
  • Опубликовано: 21 окт 2024
  • Got tired of waiting for 3.1 to come out so here's a new tutorial. This is for you Stefan Randa
    sprites: imgur.com/a/5W...
    imp script: pastebin.com/N...
    camera script: pastebin.com/g...

Комментарии • 52

  • @BrannoDev
    @BrannoDev 4 года назад +25

    I really do enjoy these intermediate level tutorials. Just straight to the point with enough explanation to understand why things work.

  • @Ferkiwi
    @Ferkiwi Год назад +2

    Great video! I was going crazy with vector math to try to figure out how to properly get the character direction to reflect at the same time as the relative camera position.
    I'm doing things slightly different, using a BlendSpace2D, but your video helped me figure out the right values, thank you!
    Short, easy to follow, and very useful.

  • @chef2654
    @chef2654 5 лет назад +24

    You an absolute beast, thank you so much for the tutorial :)

  • @alex2mine111
    @alex2mine111 7 месяцев назад

    Filled out multiple pages of a notebook trying to do this myself. This was so much better then what I was trying to (unsuccesfully) make!

  • @onelios
    @onelios 2 года назад +1

    I have been days stuck with this problem and your video fixed it in a moment. Thank you very much!!

  • @woodsmith3124
    @woodsmith3124 3 года назад +6

    The rotation works, but the sprite doesn't go through its walk cycle. I'm assuming something changed between versions, but I'm not sure what.

  • @gingercore69
    @gingercore69 4 года назад +2

    THIS is what i needed... Thank you very much... i subscribed

  • @stabbedbyapanda
    @stabbedbyapanda 3 месяца назад +2

    Ok got it working on Godot 4, with just a few minor changes. It actually works almost 95% out of the box. Which is a bit surprising, ty.
    - Made this one positive instead of negative: "var player_fwd = camera.global_transform.basis.z"
    - if you already have some form of AI, you need to make sure that it rotates to look at the player and what not. So i had to ensure i had something like
    "func look_at_player():
    self.look_at(player.global_transform.origin)"
    - i'm not sure how he just called flip_h and it worked(Oh just realized what it is, the animatedsprite is the root), maybe i missed something but i just called the animatedsprite3D, for example:
    "$AnimatedSprite3D.flip_h = false"
    - For people having the stuck at frame 0 issue i can't help sadly because i called animations instead of selectin specific cells in a sprite sheet :(

    • @froxdoggaming3385
      @froxdoggaming3385 3 месяца назад

      Using animatedsprite seems harder than the way shown in the video, how did you do it?

    • @stabbedbyapanda
      @stabbedbyapanda 3 месяца назад

      @@froxdoggaming3385 Yeah i know theres a better way than how i did it, just can't think of it off the top of my head, and it works so eh not too worried.
      But basically where he says do "row = SpriteFrame" I just say to play the animation. Then i have really nasty if statements for each of those based on the animation i want to play, like shoot, idle, move, and hit...
      I could do an enum at the start that is checked then just play specific enum direction but i havent messed with enum in Gdscript so meh.

  • @MoKaLu
    @MoKaLu 5 лет назад +1

    now you've gotten me sea sick! thank you for the tutorial.

  • @derhinek
    @derhinek 4 года назад

    Thanks for the tutorial, short and precise as always :)
    Near to the end I thought, why isn't he just using frame_coords, but than I saw, that Godot didn't have frame_coords on the Sprite3D back then.

  • @DanniloSN
    @DanniloSN 5 лет назад +1

    I love your tutorials.

  • @Renan_Medeiros
    @Renan_Medeiros 5 месяцев назад

    How did you do the enemy movement? For example if enemy go to the right or left, how could i know which axis (x and z) is going to be the right and left based in camera rotation?

  • @VerdeCreeper
    @VerdeCreeper 9 месяцев назад

    Do you have a similar script for individual images instead than a single sprite sheet?

  • @boymeetsdrake6438
    @boymeetsdrake6438 2 года назад +1

    oh shit gotta say your videos are great been needing to do this for my 3d game which just uses sprites, probably going to make the trees and shit with picard to make it very close to real 3d. but honestly i could come up with some good trees and rocks with just this actaully considering picard is so weird and hasnt worked for me so far i think i will. jajajajajajajaa again nice video

  • @M_tch311
    @M_tch311 4 года назад +2

    Hi! Great video, really helped me understand a lot as a new comer to Godot. I tried to implement this into a game im working on, but i have a problem with the imp facing the correct position of a moving player. I added a script to move the enemy towards the player, however if I happen to strafe the enemy the animation doesnt face the player. I tried to implement it as a child of a kinematic body so i could set a rotation speed and for the movement script as well. Any help would be appreciated.

  • @ron0studios
    @ron0studios 4 года назад

    Yay I think the godot Devs saw this! They have billboard nodes now!

  • @noobmaster-ez4nx
    @noobmaster-ez4nx 5 лет назад +3

    Epic

  • @DarkShroom
    @DarkShroom 3 года назад

    nice one thanks for the solution
    i'm trying to sort of write a helper for doing the animations with the decorate style animation frames... this saves me the stressful bit

  • @archery171093
    @archery171093 5 лет назад +2

    Hello sir, I really like your video and started a new project to test your stuff and it's very cool !
    I have a question : how is it possible to handle the fact that the front sprite (for example) switch to the front-left one when we are aligned with the forward vector but not looking directly toward it ? (you face the imp, you are aligned with the forward vector, but you gently move your camera to the left, it switches the sprite because of the dot operation)
    Thanks :)

    • @Miziziziz
      @Miziziziz  5 лет назад +4

      Try replacing the players forward vector with the direction from the player to the sprite

    • @archery171093
      @archery171093 5 лет назад +1

      Miziziziz thanks for the extremely fast reply ! As I’m new to godot can you shortly explain to me how to do it ?

    • @Miziziziz
      @Miziziziz  5 лет назад +5

      @@archery171093 basically (sprite_pos - player_pos).normalized() will give you the direction

  • @stlingt
    @stlingt 3 года назад +2

    Tried this today and it doesn't seem to work anymore, i think the set_camera function isn't doing its thing, any ideas on how to fix this?

    • @stlingt
      @stlingt 3 года назад +2

      nvm i just got it, for those who are also curious instead of using the set_camera function you import the camera directly into the imp script using get_tree().get_root().get_node and then the path to the camera

    • @woodsmith3124
      @woodsmith3124 3 года назад +1

      @@stlingt Still not working. Can you elaborate?

    • @Fishy_Chameleon
      @Fishy_Chameleon 4 месяца назад

      @@woodsmith3124 bit late but for me I just got whatever the current main camera is, as that's what you'd want to rotate the sprites off of anyways at all times, so setting the camera variable to
      get_viewport().get_camera_3d()
      should work

  • @Yoni123
    @Yoni123 Месяц назад

    Ok, but how do I actually make my own sprites?

  • @stabbedbyapanda
    @stabbedbyapanda 4 месяца назад

    Spatial Node = Node3D

  • @matkdiezmo8577
    @matkdiezmo8577 4 года назад

    Is there a way to make a 16 directional sprite? I'm still new to Godot.

  • @TheDrawnCard
    @TheDrawnCard 5 лет назад

    How do you make the coding for like 8 sides of a character

  • @chelsey843
    @chelsey843 5 лет назад +1

    Hey, I know I'm late but could you please upload a project of this and the Wolfenstein style level on Github? Thanks a lot in advance
    PS: Your videos are fucking amazing.

  • @allisongross2946
    @allisongross2946 4 года назад +2

    My characters are asymmetrical! Time to do more work :')

  • @levioptionallastname6749
    @levioptionallastname6749 7 месяцев назад

    spent like two hours on this in godot 4, was super careful for like 2 hours- it simply won't work and returns to frame "0" constantly,- weird :(

    • @goldengoblinX
      @goldengoblinX 5 месяцев назад +1

      Did you fix it?

    • @levioptionallastname6749
      @levioptionallastname6749 5 месяцев назад +1

      @@goldengoblinX totally

    • @goldengoblinX
      @goldengoblinX 5 месяцев назад

      @@levioptionallastname6749 Oh, can you explain for me 🙏🏻

    • @froxdoggaming3385
      @froxdoggaming3385 3 месяца назад

      @@levioptionallastname6749 I don't want to sound rude here, but please don't say "nvm i fixed it" and then not give any details like this

  • @little3rddegreeburns
    @little3rddegreeburns 5 лет назад

    Is it possible to transition from 2D to 3D within a game in godot?

    • @HonsHon
      @HonsHon 4 года назад

      It is possible. I would say you can bring your assets over, but you have to redo all of the logic

  • @Papajoofable
    @Papajoofable 15 дней назад

    I need this tutorial on a godot 4 :(

  • @TitlePending
    @TitlePending 5 лет назад +1

    I see, you want a stable build first.

    • @Miziziziz
      @Miziziziz  5 лет назад

      Yeah I tried doing this in the beta and it crashed several times

  • @Blenderislove
    @Blenderislove 3 года назад

    would this work in multi player situation?

    • @shwetanksingh2156
      @shwetanksingh2156 3 года назад

      I think no you need to figure out how will it look like from other player's perspective

  • @sharpeye6366
    @sharpeye6366 2 года назад

    Doom 3?

  • @longjohn7992
    @longjohn7992 Год назад +1

    Doesn’t work.

  • @Minthy445
    @Minthy445 2 года назад

    can you do in roblox studio?