Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.
Feedback (Positive)apt-barracudaThank you for including a collapsible slide about how the animated runner scene was made, despite it being beyond the scope of the course to learn how to make it. Doing this helps generalists such as myself to get started looking into these topics independently.14Sep. 11, 2024
Bug in the RunnerVisual toolrewarding-chimpanzeeI was fiddeling with the RunnerVisual scene and with the exported values of the state machiene.
If you leave the animation_name to anything else than Idle, when compiling scenes you run in to:
Cannot call method 'travel' on a null value. at line 102 to 105 in the tool script depending on the state. Adding a little reset of the state at runtime will probably fix it.11Sep. 25, 2024
move_and_slide in top down need extra line for slide correctlyDowarFor `move_and_slide` to work correctly for sliding on diagonal wall you should precise to put in the `_ready` of `runner.gd` script the line `set_motion_mode(MOTION_MODE_FLOATING)` because the default motion mode `MOTION_MODE_GROUNDED` only slide on floor wich cause to only slide the slope in one way due to no gravity or real floor in top down game ^^11Sep. 05, 2024
Make the runner lose momentum correctlyHardRockIt bothered me that our character was keeping his velocity, even when an obstacle stopped it. This was very apparent when I ran into a wall that stopped me completely, then adjusted the direction to avoid the obstacle. Our character was instantly up to the previous velocity again. So I looked through the documentation for `move_and_slide()` and I think I found the correct solution. After the call to `move_and_slide()` I simply set the velocity to the value returned by `get_real_velocity()` . Not sure if this is the correct way to do this, but it doesn't seem to have resulted in any bugs and I achieved the desired result. Thanks for encouraging us to look at the documentation! :)10Dec. 17, 2024
Normalization of direction vectorPJIn one of the previous lessons, we normalized the direction vector to prevent the character from moving faster diagonally. Why doesn't this apply here? Apologies if this was explained earlier in the moduleβI jumped straight to this part from M10 and can't recall if it was covered before20Dec. 11, 2024
That character is mesmerizingNoroI went earlier in the course into the artist website, and did read an article explaining how to do this "3D" effect, the example was a goose. I was amazed, now I'm even more.
Looking into how all of this is working is overwhelming, as an example the animations on the animation player are only the .y ones, and the .x ones are done with script. That feel very very elaborate. As an example I guess the animation would add one to another and dont cause issues if there was .x ones in the animation player, but... That's in theory, and it never work like in theory x)
Anyways my point is: It's super nice you did added that asset, it shows how you can work without understanding much a very elaborate scene someone else made, and it's super nice and cute on top of that.
I have more importants things to learn right now, but I'll sure dive into this character to understand how it work and at least try to tinker it into something more personal !10Nov. 19, 2024
Code simplificationPaulFor the section where we added code that changed the runner visual angle and animation type, this was all placed in the statement: `if direction.length() > 0.0:`
But I was thinking, we already specified a variable to discern this: `var has_input_direction := direction.length() > 0.0` and created an if/else to handle the movement.
So to simplify, all of these additional visual effects we applied in the new `if` statement could all move into the previous `if has_input_direction` statement. But I'd be curious to know if this was deliberate, why in this case we would choose to do it this way?10Nov. 10, 2024
How to make character face camera when he turns from left to right (and vice versa)?aramplWhen switching direction from left to right (and vice versa) the character turns over the back, which feels somehow unpleasant.
I tried to overcome this with the next code:
```gdscript
...
if direction.y == 0.0:
_runner_visual.angle = rotate_toward(_runner_visual.angle, -direction.orthogonal().angle(), 8.0 * -delta)
else:
_runner_visual.angle = rotate_toward(_runner_visual.angle, direction.orthogonal().angle(), 8.0 * delta)
...
```
Are there more natural, "proper" way to do this?60Nov. 10, 2024
L5.P1 html code in hint 4Bob CornbobIn the fourth hint there is some html looking code `</Hint> <Hint>`10Nov. 05, 2024
Creating a character modelram876Hello! Can you tell me in which direction I should look for information on creating such models as a character in this lesson? I want to read about it.20Nov. 01, 2024
Problem Running L5.P1Cave Darr When I click the "Run" Button to evaluate my solution for this challenge, I get an error before the game begins:
@onready var metadata: Metadata = get_window().get_node(Metadata.NAME)
Clicking on the error brings me toui_test_panel.gd :
Line 31: @onready var metadata: Metadata = get_window().get_node(Metadata.NAME)
Line 113: for practice_metadata: PracticeMetadata in metadata.list:10Oct. 22, 2024
Too cute!SebThe runner is not in 3D? Really?
I read the code, I read the part about clipping mask (and watched the video). Part of my brain understands, part of it fells for the magic.
I love this.10Oct. 21, 2024
Minor visual glitches (due to Y sorting?)alarming-baboonJust to mention, there are some small glitches with the animation (arms or ears disappearing, it's also visible on the first/last video of this chapter). Here, it seems to be caused by the Y sort, because the glitch stops when I uncheck it. Is there a way to exclude some specific sub scenes from the Y sorting, or does it affect the whole subtree no matter what?
Great chapter anyway, the animated asset is impressive and really fun.10Sep. 30, 2024
Deceleration handling disappeared from final codealarming-baboonIn the last code reference, the deceleration calculation is not there anymore.
Furthermore, even if the code is working as-is (immediate stop), when taking into account deceleration, it still misses a test because even if `direction.length` is zero, with the deceleration, the velocity can still be positive. Without the condition, the animation goes back to `IDLE` immediately and it looks like the character is sliding on ice, which is fun but probably not what was intended.
Here is my complete `_physics_process` method for reference:
```gdscript
func _physics_process(delta: float) -> void:
var direction := Input.get_vector("move_left", "move_right", "move_up", "move_down")
var has_input_direction := direction.length_squared() > 0.0
if has_input_direction:
var desired_velocity := direction * max_speed
var current_speed_percent := velocity.length() / max_speed * 100.0
velocity = velocity.move_toward(desired_velocity, acceleration * delta)
_runner_visual.angle = rotate_toward(_runner_visual.angle, direction.orthogonal().angle(), rotation_speed * delta)
_runner_visual.animation_name = (
RunnerVisual.Animations.WALK
if current_speed_percent < 80.0
else RunnerVisual.Animations.RUN
)
else:
velocity = velocity.move_toward(Vector2.ZERO, deceleration * delta)
if Vector2.ZERO == velocity:
_runner_visual.animation_name = RunnerVisual.Animations.IDLE
move_and_slide()
```20Sep. 30, 2024
L5.P1 Smooth_Game - QuestionMoKTHello, so I couldn't solve the practice and I ended up looking at the solution, and the thing I did wrong was trying to specify what I wanted to rotate.
I don't understand why we're able to just put "rotation" and not have to specify "smooth_ship.rotation" or "sprite_2d.rotation", like we did in the lesson.
(assuming we add smooth_ship as an onready var)
It wouldn't work in the script but wouldn't I want to specify the item that I'm accessing it's rotation property for?
For example:
```gdscript
sprite_2d.rotation = rotate_toward(sprite_2d.rotation, direction.orthogonal().angle(), 8.0 * delta)
```30Sep. 29, 2024
Adding an Attack Animation to the RunnerVisualDkerzaUpon looking at its node scene, Iβm intrigued by the cutout animation implemented this way in Godot. Since this module is still being worked on, may I request for the said game artist to incorporate the attack animation (by also adding a sword or something) into the current RunnerVisual asset so we can analyze/break down how it functions as an extra lesson? Thanks.10Sep. 29, 2024
L5.P1 Smooth Game issuenervous-woodpeckerI'm not sure what I'm doing wrong here that is preventing the challenge from passing for the two rotation related checks. Any help is appreciated!
`extends CharacterBody2D`
`@onready var sprite_2d: Sprite2D = %Sprite2D`
`@onready var collision_shape_2d = %CollisionShape2D`
`var max_speed := 800.0`
`var acceleration := 500.0`
`var deceleration := 500.0`
`var rotation_speed := 3.0`
`func _physics_process(delta: float) -> void:`
` var direction := Input.get_vector("move_left", "move_right", "move_up", "move_down")`
` var is_moving := direction.length() > 0.0`
` if is_moving:`
` var desired_velocity := direction * max_speed`
` # make sure to make the velocity progress toward the desired state over time`
` velocity = velocity.move_toward(desired_velocity, acceleration * delta)`
` else:`
` # make sure the make the velocity process toward zero over time`
` velocity = velocity.move_toward(Vector2.ZERO, deceleration * delta)`
``
` if direction.length() > 0:`
` # make sure to make the rotation progress towards the desired angle over time`
` var angle = direction.angle()`
` angle = rotate_toward(angle, direction.orthogonal().angle(), rotation_speed * delta)`
` # make sure to use `orthogonal()`!`
` # and don't forget to use `rotation_speed``
` rotation = direction.angle()`
` move_and_slide()`
30Sep. 24, 2024
"move smoothly" broken link to M4jmagrippisHey, great stuff on this one too, working through it and excited for the rest of the modules π
Just a heads-up that there's a broken link near the start, "we made the spaceship [move smoothly]". Instead of the relative path of the internal link you may have typo'd in something weird π10Sep. 06, 2024
Small remark + "migration" issue from 0.6.0 to 0.7.0iDieHello,
It looks to me that these sentences are duplicates (maybe only one was supposed to stay):
- An artist may choose to import assets with a higher resolution to allow you to animate camera zoom later on without losing visual quality.
- Here, the artist made the character bigger to allow for more detail. The higher resolution allows for effects like zooming in on the character without losing quality.
Also, I was working using the files from `l2dfz-0.6.0-win` but I didn't want to lose my changes -> I copied the content of the folder `M09.top_down_movement_workbook` from `l2dfz-0.7.0-win` into my existing folder and I had a strange issue : the scene `runner_visual_red.tscn` was pointing to `character_visual.gd`.
This prevented me from having:
`@onready var _runner_visual: RunnerVisual = %RunnerVisualRed`
I realized it was related to the old "character" files (coming from `l2dfz-0.6.0-win`) and reattached the script `runner_visual.gd` to `runner_visual_red.tscn`.
After having a closer look, I noticed that the exact root cause was that `runner_visual_blue.tscn` has the same uid as `character_visual_blue.tscn` (same for `runner_visual_red.tscn` and `character_visual_red.tscn`).
Not sure it will impact a lot of people but I prefer to indicate it here.
Dai30Sep. 02, 2024
Lesson Q&A
Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.