#invalid acess to prop

1 messages · Page 1 of 1 (latest)

sonic ember
#

The body variable does not exist

spare granite
#

how i can make it exist

#

and the video didnt do it

sonic ember
#

It connected the signal through the editor right

spare granite
#

like you know that video about make a flappy bird at godot

spare granite
#

ima do a var right q and call it body and see

sonic ember
#

Check in the video, they probably have something in the bracket after _on_body_entered()

spare granite
#

still not

#

they dont i can screen the video for ya if you want

#

here it is

sonic ember
spare granite
#

where

#

ahh the () ?

#

i do too

#

like loot at the pic that have the problem in it

sonic ember
spare granite
#

ohhhhhhhhh

#

lemme try rq

sonic ember
#

It won't work because it isn't a signal, but it's one step closer to being correct

spare granite
#

solved

#

but now i have a breakpoint in other script

#

what is abreakpoint

#

what is breakpoint

sonic ember
sonic ember
# spare granite what is 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

sonic ember
#

To remove breakpoint

spare granite
#

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

spare granite
sonic ember
spare granite
#

no

#

i did it still not solved

sonic ember
#

Same error still?

glad trout
#

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.

spare granite
#

so i can solve them

spare granite
#

@glad trout

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

spare granite
#

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

glad trout
#

You mean the word 'signal'? That's just an identifier to tell Godot what type of object you're adding

spare granite
#

yo bro the secong i joined here i see you typing

spare granite
spare granite
#

at the line 12

#

at the base of that line

#

the base

#

should have a id number

#

in that occasion it dont idk why

glad trout
#

Right. starting to make a bit more sense now. Expand your scene tree so I can see where 'ground' appears in your scene.

spare granite
#

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

glad trout
#

Yes, that's the point. The bird-crashed object is still Ground. which means that ground is now pointing to a null object.

spare granite
#

all the bird crashed at the script have null

#

no no like pipe_spawner is the null

#

not ground

#

sorry fro not saying that

glad trout
#

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

spare granite
#

ground already have id number

#

the pipespawner is the null here

#

he is the new problem

glad trout
#

And where is that in the scene tree?

spare granite
#

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

glad trout
#

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.

spare granite
#

so how i can do it

glad trout
#

Are you using Godot 3.x or 4.x?

spare granite
#

4

glad trout
#

In that case replace your onready var lines with @export var

spare granite
#

lemem try

glad trout
#

Then, with your object selected in the scene view, drag the required objects into the relevant boxes in the inspector.

spare granite
#

i got sooo many problmes when i did that

glad trout
#

Did you drag the variables into the relevant slots?

spare granite
#

still not

glad trout
#

Do that first.

spare granite
#

you said cahnge on ready with export

glad trout
#

That's only part of it. The rest is to actually assign those variables.

spare granite
#

how i really dont get the way your telling me that just talk to me like a 3 years old

glad trout
#

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.

spare granite
#

bro ima just give on that project

#

the one that are explaining are sump af*

#

he dont even tutorial

#

he just do fast

glad trout
#

I'll give you a recorded example. Gimme a moment.

spare granite
#

ok

#

im not gonna watch taht guy from youtube again

glad trout
spare granite
#

but its not like that for me

#

hwo di you do it

glad trout
#

What errors are you getting?

spare granite
#

i can give you my project to see it

glad trout
#

Sure. I'll take a look

spare granite
#

here it is

glad trout
#

Going to take a quick look for you

spare granite
#

tysm bro you losing time on me

glad trout
#

Desn't seem to include your pipespawner code

spare granite
#

huh ?

glad trout
#

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

spare granite
#

so its solved now

#

or those are just side errors

glad trout
#

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.

spare granite
#

fr ? the scripts isnt there ?

#

see that

glad trout
#

Sadly not. I can see the script is there in your file list in the earlier pictures though.

spare granite
#

the scripts are out of fils

glad trout
#

Right, got the files now

spare granite
#

ok

glad trout
#

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.

spare granite
#

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

glad trout
#

Looking into it for you. No promises, but I'll see if we can't work it out.

spare granite
#

tysm bro for today

spare granite
#

@glad trout did you find something

sonic ember
# spare granite

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

spare granite
#

and the game got me 3 days

#

so i need to cpmlete it

glad trout
#

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.

spare granite
#

im not type of guy who get into some thing and dont comeplete it

glad trout
#

I tested this by forcing it to move into frame, and it started working normally.

spare granite
#

how ?

#

can you say steps

glad trout
#

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.

spare granite
#

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

glad trout
#

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

spare granite
#

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

glad trout
#

Good luck.

spare granite
#

bro i reallly apreciate that

#

what your real name

#

ima put at the game

#

when i finsh

#

what is touch in gd script

glad trout
#

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.#

spare granite
#

nah i wasnt talking about that and i finished kilk func

#

i was creating a fade effect

#

the fade should appear when i die an dit appear always with a deffrent colot