Skip to content

Let user know when GDevelop encounters an ambiguous variable #1413

@kryptot7

Description

@kryptot7

Describe the bug

Let's say I want to make both of my Player objects always face towards my Ball object. I have the following code:
image

It behaves incorrectly.
gdev bug 1

But if I change it...
image

It gives me the intended behavior.
gdev bug 1a

I believe this is because of Player.X -- it's ambiguous because there are two "Player" objects in the scene. When I am comparing the Ball's position to Player.X, which Player do I mean? GDevelop seems to assume I mean the one on the left. (IIRC, I created that one first.) That means both Player objects adjust their orientation depending on where the first object is, not on an individual basis.

I think that GDevelop should warn the user when it encounters an ambiguous variable like this and has to assume the answer. It could display an icon next to any events with ambiguous variables to aid in bug-hunting. So in this example, after I typed "Player.X", GDevelop could have caught that there were multiple Players in the scene and warned me. Or, it could have warned me when I ran the scene with a popup like: "Variable "Player.X" is ambiguous, because there are multiple instances of "Player" in the scene."

To Reproduce

See above description and included file.
2020-02-05 Ambiguous variable.zip

Other details

Windows 10 1909 x64
GDevelop 5 beta 88

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions