The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

I have some script "Jumpable" which has some variables

export(float) var hang_time : float = 3
export(float) var jump_speed : float  = -400

I have a script Deer and a script Player which both extend Jumpable, I'll use the player as an example

extends "res://Scripts/Jumpable.gd"

export (int) var run_speed = 100

So hangtime and jumpspeed both show up as values to be changed in my editor for the player

https://imgur.com/a/4LqT85e

but the changes I make in the editor don't affect the script at all, instead they retain their default values. But when I make changes to run_speed(which is not inherited, but specific to the Player) all works well. So I think this is a problem related to the fact that I'm inheriting these export variables. Thanks in advance.

in Engine by (25 points)

1 Answer

+1 vote
Best answer

Is there a Jumpable.tscn scene that the Jumpable.gd script is attached to? If not, create one, and then use the Scene > New Inherited Scene... menu option, select Jumpable.tscn to create a new scene which inherits Jumpable.tscn. You can change the node name, then and save it as Deer.tscn or Player.tscn. From the new nodes, detach Jumpable.gd and create and attach new script, and from that new script extend Jumpable.gd.

Following those steps works for me.

by (1,663 points)
selected by

I'm not sure why but I'm able to override the Player's value in my game scene and it works, but I can't for the Deer. Maybe I'm missing something. Check out the pictures below.

https://imgur.com/a/brTs0HM

Ah, when I didn't create a Jumpable.tscn scene, it worked. Maybe it's because I had Jumpable.tscn on a KinematicBody2D, rather than a plain Node? who knows.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.