This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hello guys!

I have a base Scene "Enemy" with Area2D "detect_radius".
In script i do:

export (int) var detectradius
func _Ready():
$DetectRadius/CollisionShape2D.shape.radius = detect
radius

I inherit from this Scene and Change the value of the Export var.
Enemy to 30.
Endboss to 50.

Now to the Problem... in my tree if i put it like this.

-Enemy
-Endboss
Both of them has 50.

Otherway around.
-Endboss
-Enemy
Both of them has 30.

Do i understand something wrong?
Or do i Need the Area2D in every Scene and not inherit from Enemy?

in Engine by (22 points)

1 Answer

0 votes
Best answer

The problem is that they are sharing the same collision shape.
To fix this you would have to do something like this:

export (int) var detect_radius

func _ready():
    var circle = CircleShape2D.new()
    $DetectRadius/CollisionShape2D.shape = circle
    $DetectRadius/CollisionShape2D.shape.radius = detect_radius

Related video with your problem: Godot 3.0: Top-down Tank Battle - Part 5

by (252 points)
selected by

Hello and thanks!
Thats how i did it shortly after i asked.

But didnt saw my Question after asking it and couldnt delete or replay myself.

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.