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...
I really do enjoy these intermediate level tutorials. Just straight to the point with enough explanation to understand why things work.
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.
You an absolute beast, thank you so much for the tutorial :)
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!
I have been days stuck with this problem and your video fixed it in a moment. Thank you very much!!
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.
THIS is what i needed... Thank you very much... i subscribed
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 :(
Using animatedsprite seems harder than the way shown in the video, how did you do it?
@@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.
now you've gotten me sea sick! thank you for the tutorial.
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.
I love your tutorials.
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?
Do you have a similar script for individual images instead than a single sprite sheet?
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
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.
Yay I think the godot Devs saw this! They have billboard nodes now!
What’s it called?
Epic
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
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 :)
Try replacing the players forward vector with the direction from the player to the sprite
Miziziziz thanks for the extremely fast reply ! As I’m new to godot can you shortly explain to me how to do it ?
@@archery171093 basically (sprite_pos - player_pos).normalized() will give you the direction
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?
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
@@stlingt Still not working. Can you elaborate?
@@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
Ok, but how do I actually make my own sprites?
Spatial Node = Node3D
Is there a way to make a 16 directional sprite? I'm still new to Godot.
How do you make the coding for like 8 sides of a character
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.
My characters are asymmetrical! Time to do more work :')
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 :(
Did you fix it?
@@goldengoblinX totally
@@levioptionallastname6749 Oh, can you explain for me 🙏🏻
@@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
Is it possible to transition from 2D to 3D within a game in godot?
It is possible. I would say you can bring your assets over, but you have to redo all of the logic
I need this tutorial on a godot 4 :(
I see, you want a stable build first.
Yeah I tried doing this in the beta and it crashed several times
would this work in multi player situation?
I think no you need to figure out how will it look like from other player's perspective
Doom 3?
Doesn’t work.
can you do in roblox studio?