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.
Fun practice exercise suggestionHelvanikI had fun changing the thrusters code to change their scale based on boost input. It's doable with the knowledge accumulated at this point and it looks really cool ! It could be a more advanced bonus exercise !
It could even be coupled with steering logic for more smoothness.117Feb. 10, 2024
Velocity Appears Slow After Adding Space BackgroundRomanRiotHey all!
After adding the **Space Background scene,** the ship *feels* way slower. Did anyone else experience this?
**Questions I have include:**
-Is the perception of speed based on an editable variable inside the **Shader, space_material**, such as the **View Offset**?
-If so, in what way can we edit this variable to make the player feel like the ship is going faster? When I edited the value to "20, 20" I didn't see any change.
Thanks for any insight!52Feb. 11, 2024
Backgroundfew-apeHow does the background know to go on indefinitely, no matter how far I go in any direction?32Feb. 03, 2024
WHAT A GREAT START! About shaders code...PurpleSunriseI didn't imagine this course would be SO amazing. Everything is laid down so beautifully and easy to understand. I can really see the amount of planning and thinking you guys did. Well done.
One question about the shaders, I know it's not meant to be understood at this stage of the course and it's written that at the end of the course that code will make much more sense, but are you planning to integrate some shader code in the course or in any other course in the future? I think it's useful for a solo dev to have a bit of that knowledge as well.
Keep up the amazing work.21Oct. 10, 2024
Error running the scene after adding thrusters.slow-beaverI've tried running the game after adding the thrusters but I am getting the following red error: "Script inherits from native type 'Sprite2D', so it can't be assigned to an object of type: 'Line2D'".
Is there anything I should try before I start the lesson over?
61Sep. 25, 2024
Thruster not moving with shipCerealI've made my main thruster a child of the `Sprite2D` ship scene, but it stays still in one place without moving with the ship. It also goes on or off depending on if the ship moves, but it just doesn't move with the ship.41Mar. 08, 2024
I had to add the camera to the ship scene.DifioOtherwise my ship would just bug out completely. Not sure why.
Great course so far, thanks!91Feb. 09, 2024
2D object control optionsdoting-cormorantIn most every art program out there, you can select to flip an object horizontally or vertically. Very helpful at times.
When duplicating the SideThruster, being able to flip the copy vertically would've been useful, but it looks like you have to just set it manually. Does Godot have any type of horizontal/vertical flip options?11Feb. 09, 2024
Node "connections" seem confused based on file architecture. Unsure how this works across.StorytellerI had trouble both in the timer section and in the last section of M4 with node "communication." That is, the thrusters and background did not appear and attempting to call a timer crashed because the call did not reach a timer (the error was some kind of null exception.) Restarting the editor didn't seem to help, but after some poking and further resets everything worked as intended, much to my confusion.
I had initially saved my work in the Module 4 workbook, with a new folder. It seems that now the program accesses this folder, but I wasn't sure how it functioned beyond that.
How does Godot access files and how do you control where it accesses them? Can you dynamically adjust this in the file dock?10Oct. 18, 2024
Boost cooldown cloudy-buffaloHello, i have implemented a boost cooldown using a CanvasLayer containing a progressBar and Label that fills from 0 to 100 based on a Timer attached to the ship node.
I have done it in two ways and I wanted to know which one would be recommended especially when building more complex games.
The first method was simply to add the CanvasLayer containing the progressBar and Label as a child of the Ship node (Sprite2D), then use the script attached to the ship to update the value of the progress bar.
The second method was to save the CanvasLayer and the child resources as its own scene and use the main scene (space_level.tsnc) and a new attached script to control the progress bar value. This means the main scene script is reading the timer attached to the ship node and then update the value of the progressbar.
Would method would you recommend between the two ? Or do you have another recommendation to keep the code and game logic as modular as possible but also self-contained?20Sep. 24, 2024
MainThrusters Script Icon and yellow Errorsilver-foxWhy is the MainThrusters Script Icon blue highlighted and not white like the other in the Scene dock? I mose over it and the tooltyp say "the script is corrently running in the editor". It's because of that? if yes what does it means "currently running in the editor"?
~~And the script hat a yellow error* on the Debugger. I've learned that yellow errors, correct me if I’m wrong, are to warn of future bugs. Are we going to learn later in the course how to resolve these errors?~~ ok I'm in M5 and know the answer to that :)
Thanks in advance!
```gdscript
*this error: W 0:00:01:0026 The variable "angle_difference" has the same name as a built-in function. <GDScript Error>SHADOWED_GLOBAL_IDENTIFIER <GDScript Source>main_thruster.gd:84
```10Sep. 08, 2024
Cannot launch scene after adding thrustersHacinsonI get this two errors:
"Script inherits from native type 'Line2D', so it can't be assigned to an object of type: 'Sprite2D' "
"The variable 'abgle_difference' has the same name as built-in function"
20Aug. 25, 2024
Use Thrusters in a new empty ProjectMaziHi!
I would like to use the thrusters in a new, empty project -because I want to make everything from scratch /I'm a beginner and I think this is a good way to learn things/- but after I imported them they are just don't work. I mean, I can't use them.
This is the error message:
Failed loading resource: res://ship_visual_effects/main_thruster/main_thruster.tscn. Make sure resources have been imported by opening the project in the editor at least once.
Could you help me please? Or maybe they are dedicated to your projects? it can be valid and if they are I can be okay with that.
Thank you!20Aug. 23, 2024
I guess it was planned to have the thruster NOT in the Ship scene?zoidbergforpresidentOr al I wrong? Technically the truster could have been in the ship scene, not the camera and the background of course...10Aug. 19, 2024
Interested in resources on shadersraincloudI'm a little sad to see that shaders are beyond the scope of this course. Looking at the syllabus, I can see that there's already a lot planned, so it's entirely understandable. I am very interested in learning more about shaders at some point, though, and I'm finding the way y'all teach in this course to be very helpful. If you ever release a course on shaders, I'd be eager to take a look. Are there any current resources on using shaders in Godot 4 that you would recommend for a beginner? Something that might be approachable by the time I've finished this course?10Aug. 15, 2024
Great CourseDefconCavThe quality and instruction of this course is of the highest caliber!10Aug. 10, 2024
L6 main_thruster.gd debugger BIF angle_differenceFun-Old-DogHi everyone,
For L6 Assembling finished game level in godot
Issue: In the script there is a variable called angle_difference that causes a warning
W 0:00:01:0032 The variable "angle_difference" has the same name as a built-in function. <GDScript Error>SHADOWED_GLOBAL_IDENTIFIER
<GDScript Source>main_thruster.gd:85
Solution: I changed the name of the variable to thruster_angle_difference
Here is the code
`# This calculates the angle difference between the thruster's current rotation and the rotation in the last frame.`
`# We use this to make the thruster's flame curl in the direction of the ship's movement.`
` var thruster_angle_difference := wrapf(_last_frame_rotation - global_rotation, -PI, PI)`
` _last_frame_rotation = global_rotation`
` _angle_difference_smoothed = lerp_angle(_angle_difference_smoothed, thruster_angle_difference, 8.0 * delta)`
` curl = _angle_difference_smoothed * 8.0`
10Jul. 01, 2024
Crashes on OS X in Compatibiltiy modebrylieI had to switch the project to Mobile mode when dragging the MainThruster onto the scene tree. Otherwise, Godot was crashing when in Compatibility mode.70Jun. 03, 2024
Best practices approach to build script from scratch?PixelbladeAs the scripts we are writing are getting longer, I wondered about best practices to build scripts from scratch. The script in this exercise evolves beautifully from the course material and exercises. What is the approach to use when we want to build code for something completely new? How do we know which variables, functions, loops, etc. I actually need? Is there a format or structure to follow?
At the moment I start by coding for the most basic functionality (move the ship with player input) and then add functionalities one at a time. I first write the function and then declare the variables once I know which variables I need. Also helps to decide if they should be local or global variables. Then I fine tune and amend such as normalizing the direction vector, etc. I'm new to coding so I have no idea if this is the correct way to approach a new piece of code.
Is this the correct approach or are there better more efficient industry standard best practices to build code? Thanks! :)40May. 30, 2024
Issue with angle_difference variable in main_thruster.gd scriptAtomic_CocoNot sure how this error came to be, but i had just attempted to add in the camera2D to the Sprite2D node, ran the code and had the debugger yelling at me:
"W 0:00:00:0693 The variable "angle_difference" has the same name as a built-in function.
<GDScript Error>SHADOWED_GLOBAL_IDENTIFIER
<GDScript Source>main_thruster.gd:84"
I don't really know how this error was introduced, because I was able to get all three thrusters added and still able to properly compile the code to run. Anybody else have something similar?
10May. 13, 2024
Tried to played with tweens and Trusters size -good-natured-sharkHi all,
It might be a bit early to start using tweens, but I've read the documentation and they seem pretty straightforward to implement. I've added the code for the tween responsible for scaling up the thrusters when we use them, and for scaling them down after the timer times out. The side thrusters are acting a bit wonky with the scaling up, so I suspect there might be a conflict with the built-in script.
Anyway here is the code:
```gdscript
extends Sprite2D
@onready var trustM = get_node("MainThruster")
@onready var trust1 = get_node("SideThruster")
@onready var trust2 = get_node("SideThruster2")
@onready var trustAR = [trustM, trust1, trust2]
var normal_speed := 600.0
var max_speed:= 600.0
var velocity := Vector2(0,0)
var boost_speed:= 2500.0
var steering_factor := 13
func _process(delta: float) -> void:
var direction:= Vector2(0,0)
direction.x = Input.get_axis("move_left","move_right")
direction.y = Input.get_axis("move_up","move_down")
if direction.length() > 1.0:
direction = direction.normalized()
if Input.is_action_just_pressed("boost") :
var tween = get_tree().create_tween()
tween.set_parallel(true)
# Add properties to tween
tween.tween_property(trustM, "scale", Vector2(2, 2), 1)
tween.tween_property(trust1, "scale", Vector2(1.1, 1.1), 1)
tween.tween_property(trust2, "scale", Vector2(1.1, 1.1), 1)
max_speed = boost_speed
get_node("Timer").start()
var desired_velocity := max_speed * direction
var steering_vector := desired_velocity - velocity
velocity += steering_vector * steering_factor * delta
position += velocity * delta
if direction.length() > 0.0:
rotation = velocity.angle()
func _on_timer_timeout():
max_speed = normal_speed
var tween = get_tree().create_tween()
tween.set_parallel(true)
tween.tween_property(trustM, "scale", Vector2(1, 1), 0.5)
tween.tween_property(trust1, "scale", Vector2(1, 1), 0.5)
tween.tween_property(trust2, "scale", Vector2(1, 1), 0.5)
```10May. 12, 2024
My Boost Won't Work.alarmed-crocodileEvery time i press Space it makes me leave the Debug. I need to know why so i can fix it.50Apr. 23, 2024
my ship main thruster didn't curve the tail?CelsI only want to update the thruster's angle like I saw in the first page in M4.L6 something it curve when go to left and right.. any settings do this one? I read the entire script of main thruster it seems I can't figure it out?10Apr. 21, 2024
I see Node2D instead of Sprite2D when draging to SpaceLevel canvasunimportant-mooseI see Node2D instead of Sprite2D when draging to SpaceLevel canvas
Code from Output
```gdscript
New Scene Root
Rename Node
Create Node
Move CanvasItem "Node2D" to (16, -1)
```
I do exactly as shown in the gif20Apr. 17, 2024
Can I change the Color of the thrusters on inputKenseiKCI have added code to increase and reset the size of the thrusters based on the boost input, I was wondering how to change the color to blue when boosting.10Mar. 25, 2024
Thrusters in Ship sceneJankiKhanHi! Quick question, would it have made sense to add the thrusters to the Ship's scene instead of the space_level scene? It seems like thrusters are part of the ship, so I'm not sure if there is a reason or maybe some line of logic to why it was added in space_level instead of ship. Thanks!30Mar. 13, 2024
Changing camera parent node doesn't change camera fixpointChainSOVI first created the camera as a child of sidethruster2, but immediatly noticed the error.
Either drag and dropping Camera2D onto Sprite2D or using right-click/reparent fixes its
position in the scene hierarchy, but it seems the camera remains stuck on the thruster, providing some fun jank on 180 turns.
I it just a Godot bug or is there some cache clearing or other mumbo jumbo to do to have the changes be seen in the run scene output?
workaround is to delete the camera and re-add it with correct parent-node10Mar. 08, 2024
Noticed a jitter in the camera as the camera reached the shipRotalice2Following the instructions, I enabled position smoothing. but on play, the ship looked to jitter back and forth once the camera caught up to the ship! once I set the process callback to physics rather than idle it seems to have been resolved, any idea why this is? I hope my question makes sense.20Mar. 08, 2024
Issue with camera2d, i guess?MonarchWhen I added position smoothening
* the ship is supposed to go a little away from the center so we get the feeling of smoothing,
* when we stop -> the camera should move to make the ship in the center
* in my case -> camera stays still but the ship moves to the center so u get what i mean, it doesnt feel like camera is behind but the ship is coming to center.
* you know how i realized this bc when i stop, the background doesnt move to make my ship center, instead background stays still so it feels like the ship came back to center20Feb. 29, 2024
Child nodesdirect-toadHi,
First, I'd like to say I love the course. Lots of good details and explanations.
I understand why the MainThruster, SideThrusters and Camera2D are added as childs of the ship. But in my mind I would have added them directly in the Ship scene, not in the Spacelevel scene.
What was the rational?10Feb. 25, 2024
Code a chest is inaccurateunwritten-hare> "You'll code a chest that opens when you click on it and spawns items. In this module, you've instantiated scenes in the editor.
>
> With the chest project, you'll learn how to instantiate scenes dynamically when the player interacts with the game using code.
The next module is now available and has nothing to do with coding a chest as stated above. I think this text should be revised or is probably meant for a later module.
10Feb. 20, 2024
Questions About Camera SmoothingNoneApplicableGamesHi there. So you mentioned in this lesson about a feature of the camera 2D node I was not previously aware of: Smoothing and how that feature makes the camera lag behind the player object.
I am making a 2D Sidescrolling platformer and I feel like it would be a useful feature to have the camera pan ahead when you're going at speed to show more of the level. What would happen I were give the position smoothing a negative value? Would it give this desired affect? If so could I potentially write a script to have the smoothing value dependant on the player's current veloicty?30Feb. 19, 2024
Is there any notification for when a new module goes up?overlooked-wolverineI'm liking the course so far, but I've already reached the end of the currently available content in a few days. Is there a Twitter account or an email newsletter that sends updates for when new modules for the course are released?
Also, what is the rough release schedule for each module? Is it generally going to be weekly or every other week? I know you can't totally commit to a number, I'm just asking if there's a general goal for releasing content.
Thanks!30Feb. 16, 2024
My Main Screen Doesn't Change AutomaticallytesfalconWhen I added the new SpaceLevel scene to the game, it never swapped back to the 2D main screen. It stayed on Script. MOF, the Script still shows the code for ship and SpaceLevel, but there's no SpaceLevel code since I haven't attached a script to it. This is VERY odd behavior for a game engine.10Feb. 16, 2024
Error when adding Main Thrusteroutlying-storkFor some reason after adding the main and side thrusters I keep getting a error when attempting to run my program that states, "Script inherits from native type 'Line2D', so it can't be assigned to an object of type: 'Sprite2D'."
Why is this happening?10Feb. 14, 2024
Position Smoothing Not Enabled by Defaultlovely-foxThe images used in this lesson have a camera with position smoothing enabled. When I add a camera object in Godot position smoothing is disabled. I recommend adding a line in the lesson to enable position smoothing as it greatly improves the feeling of movement.10Feb. 11, 2024
If you setup different actions labels, you need to change thrusters codeHelvanikI had named my actions "up", "down", "left" and "right" instead of "move_left", "move_right", "move_up" and "move_down".
This caused the thrusters related code not to work.
It's perfectly normal but could cause incomprehension for code beginners, so I suggest you add a little help text indicating where to modify thrusters code (aka main_thruster.gd and side_thruster.gd) to listen custom labels in that case.20Feb. 10, 2024
Different type of node for main and side ThrustersDaftjoyHi! I'm curious to know what's the reason behind using a Line2D node for the MainThruster, but creating SideThrusters as Sprite2D. Are Line2D nodes frequently used for this kind of animations?
Thanks a lot and congrats on the development of the course, I'm loving it so far!20Feb. 10, 2024
Thruster modulate.a issue / playissueIrvingbrewerror on
@export_range(0.0, 1.0, 0.1) var power: = 1.0:
set(value):
power = value
scale = _initial_scale * power
modulate.a = alpha_curve.sample(power) #this one
get a "Cannot call method 'sample" on a null value"
happens when I'm doing the adding thruster part, cant test it out in playback.20Feb. 06, 2024
Issue with the block "How do the thrusters know when to turn on and off?"?iDieHello,
In the block "How do the thrusters know when to turn on and off?", it is indicated:
> We have pre-coded the thrusters to read your ship's `velocity` variable
but from what I see, the inputs are read again rather than using the ship's velocity
> we've included comments if you're curious to learn more
but I don't find any (I checked in the workbook and solution projects)
I'm using "learn-2d-gamedev-projects-0.1.0-windows.zip"
Did I miss something or is there a problem?
Thanks in advance,
Dai10Feb. 05, 2024
Thrusters not showingRudiQuite odd, I add the thrusters and I can see them in the 2D view, but when I play the scene, it doesn't show at all. Any suggestions would be appreciated!60Feb. 05, 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.