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
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
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 .
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.
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 !
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 :)
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 :)
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?
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.
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?
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.
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
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
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
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 .
Oh thank you for saying, I’m gonna change it 👍☺️
I've uploaded the new one :)
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.
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 !
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 :)
@@jeanmakesgames okay, thank you so much !!
Your game looks very interesting, can't wait to play it !
@@Local-Hyena37 Thank you ☺☺☺
Excellente vidéo, continue la série Question : c'est pas mieux de mettre la camera dans la scene du player ?
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 :)
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?
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.
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?
me too
Will there be automapping and a map the player can see? And variable jump height
Map player can see yes, variable jump height yes as well ☺️ and auto mapping I don’t know what you mean by that
@@jeanmakesgames sounds good. i meant that the map updates when player finds new places. Like in most metroidvanias
@@Yoni123 Oh ok, yeah this in godot can be done with signals so definitely that'll be on the map video :)
good video, I love it
Thank you ☺️
Very helpful!
Thank you, I'm glad it helps! :)
dont work
Salut 👋
Salut! :)