#invalid acess to prop
1 messages · Page 1 of 1 (latest)
It connected the signal through the editor right
like you know that video about make a flappy bird at godot
huh ?
ima do a var right q and call it body and see
Check in the video, they probably have something in the bracket after _on_body_entered()
Yep see they have body in those brackets
It won't work because it isn't a signal, but it's one step closer to being correct
solved
but now i have a breakpoint in other script
what is abreakpoint
what is breakpoint
You must have accidentally clicked the space before the column with the numbers, so a red dot will have appeared there, click it again to remove the breakpoint
Its something we use for debugging, for example if we have a big game and we are having a problem, and we have to find out where the problem is coming from, we can put breakpoints in the code which means the game will stop when it reaches that point
Using this we can analyse at what place the problem happened
Click where the yellow arrow is in the left side of the code
To remove breakpoint
no no i maked a tap by fault at the last of code i solved it now i got the first error i was having
its Invalid access to property or key 'bird_crashed' on a base object of type 'Node2D (Ground)'.
bro tysm tbh you reallly help me so much
and thats my last problem for now i think
The b in bird crashed should be capital
Same error still?
Double check you're using consistent typing in every place you're using the Bird_crashed signal. If you capitalise the B in the signal, make sure it's capitalised everywhere. I can see at least two examples in the previous screenshots where you used lowercase.
Might be you missed one.
@glad trout
Well, I can't exactly tell you what your own code is. I can only provide the examples above. What I'm saying is that Bird_crashed is not the same as bird_crashed. They're considered different variables since one has a capital B.
You might want to use the search function to find all instances of it so you can check.
CTRL-SHIFT-F is a shortcut to it
ik now the problme
you see the word before the word bird_crashed
when i press ctrl and put the crusor on it the type of it is null and idk why is that
but i still cant solve it
You mean the word 'signal'? That's just an identifier to tell Godot what type of object you're adding
yo bro the secong i joined here i see you typing
lemme highlight the word for you
in that photo
at the line 12
at the base of that line
the base
should have a id number
in that occasion it dont idk why
Right. starting to make a bit more sense now. Expand your scene tree so I can see where 'ground' appears in your scene.
no no forget about the ground
Invalid access to property or key 'bird_crashed' on a base object of type 'Nil'.
i have now another problem
i solver the one about the ground
Yes, that's the point. The bird-crashed object is still Ground. which means that ground is now pointing to a null object.
all the bird crashed at the script have null
no no like pipe_spawner is the null
not ground
sorry fro not saying that
I can see at the top you're assigning it based on its position in the scene tree - $"../Ground"
So, if there's nothing at that position, the variable 'ground' will be a null.
When you try to call that variable, using ground.bird_crashed.connect it fails
ground already have id number
the pipespawner is the null here
he is the new problem
And where is that in the scene tree?
the photo i send latley was from already solved problem
there is evrythign at that photo
like you can see down
thepipe spawner have null in it
what do you think here
So, a couple of things. Firstly, I would recommend not using the scene tree directly as a means to reference things. Particularly as your project gets larger, you can't always guarantee everything will be in the same place.
so how i can do it
Are you using Godot 3.x or 4.x?
4
In that case replace your onready var lines with @export var
lemem try
Then, with your object selected in the scene view, drag the required objects into the relevant boxes in the inspector.
i got sooo many problmes when i did that
Did you drag the variables into the relevant slots?
still not
Do that first.
you said cahnge on ready with export
That's only part of it. The rest is to actually assign those variables.
how i really dont get the way your telling me that just talk to me like a 3 years old
Let me give an example then:
Here I've used @export to expose a few variables including the Overlay, audio and a few other pieces. You can drag your objects directly into the inspector from the tree. That way they should be correctly assigned.
bro ima just give on that project
the one that are explaining are sump af*
he dont even tutorial
he just do fast
I'll give you a recorded example. Gimme a moment.
What errors are you getting?
i can give you my project to see it
Sure. I'll take a look
Going to take a quick look for you
tysm bro you losing time on me
Desn't seem to include your pipespawner code
huh ?
Ignore main.tscn. I just renamed the one that was labelled as "should be main" to main.tscn to demo what you had.
Only three script files though. bird, ground and animation_player
I mean that I don't have all of the code to test the pipespawner, which is the one that you seem to be having problems with.
It's not in the file you gave me.#
Not sure if you had an older version zipped up.
Sadly not. I can see the script is there in your file list in the earlier pictures though.
Right, got the files now
ok
Right, found your bug. And it was as clear as crystal once I had your full scene tree.
in gamemanager.gd change the following line:
@onready var Pipespawner: PipeSpawner = $"../Pipespawner" as PipeSpawner
You're using $"." which means the game manager is trying to use ITSELF as a pipespawner. It's not, so it's null
When I saw your script earlier, I assumed it was the pipespawner script so overlooked the error.
Also, doing it this way means you don't have to worry about @export. Plenty of time to learn the more advanced techniques once you've mastered the basics.
Obviously, you'll need to add a Kill() function to your bird, so there's a few gaps to fill, but I assume you're already aware of those. Little tip is to add the function then just use pass as the following line. Lets you prepare for future code and still demo it without crashing.
tysmmmm
but idk why its a strange thing
pipes should spawn right now
it dont
it was spawning before i makes the game manager script
Looking into it for you. No promises, but I'll see if we can't work it out.
tysm bro for today
@glad trout did you find something
You should probably watch a different tutorial later, this one doesn't look great, there are a couple of things which shouldn't be done but this guy is doing
im almost finished i dont think other tutorials gonna make the game liek the way she did
and the game got me 3 days
so i need to cpmlete it
I did actually find the issue. You're using a VisibleOnScreenEnabler in your pipe_pair scene. The problem is that the pipe never comes into view, so the pipe is never enabled.
im not type of guy who get into some thing and dont comeplete it
I tested this by forcing it to move into frame, and it started working normally.
Manually calling the _process function when it spawns in. it's a bit of a hack job, so not worth doing except for testing.
Let me figure out a more elegant solution and I'll get back to you. Still trying to work out why it's not spawning on screen.
bro
tysmmmmm
noone till now gived me some tipme
they say go work on another project
and to igonre promlems is bad
problems make men stron
strong
So, your problem is the bounding box on the 'VisibleOnScreenEnabler' object. go to your pipe_pair.tscn file
The little red square in the middle? make it bigger. Expand it out to the left (not the right) so that it will be visible when the object spawns
This forces it to appear on screen properly, so it's enabled. It'll still disappear normally when off screen
thx bro
lastley and i will go
i want to create a kill func at bird
so i will cerate it bymyself no youtube or something
when i will finish i will send you a message
Good luck.
bro i reallly apreciate that
what your real name
ima put at the game
when i finsh
what is touch in gd script
Names Phillip Champion. And as for touch controls, that probably needs a whole new thread. I've mostly used PC controls, so that's uncharted territory for me.#