Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional centered Scene on "Play Scene" #1313

Open
letsgamedev opened this issue Aug 5, 2020 · 4 comments
Open

Optional centered Scene on "Play Scene" #1313

letsgamedev opened this issue Aug 5, 2020 · 4 comments

Comments

@letsgamedev
Copy link

Describe the project you are working on:
2d Pixel Art Game

Describe the problem or limitation you are having in your project:
All my Scenes like Player, Enemies, Objekt having their origin point at 0,0.
Before I test the Scenes in the real game I run the single scene with "Play Scene" button (cmd+r)
The problem is, that 0,0 is always at the top left side, which is correct but not very useful in that case.

Enemy in editor origin position on 0,0
Bildschirmfoto 2020-08-05 um 15 04 40

Looks useless with "Play Scene"
Bildschirmfoto 2020-08-05 um 15 04 50

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
It would be nice if it would be possible to play a single scene so, that the 0,0 point is in the center of the Window to see the whole object.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
Maybe an option in the editor configs or instead of cmd+r it would be cmd+opt+r or so, to activate the centered version.

If this enhancement will not be used often, can it be worked around with a few lines of script?:
The Workaround is to drag the object to another position, but that can lead to problems especially with coded positions.

Is there a reason why this should be core and not an add-on in the asset library?:
I think this is a common problem, cause 0,0 is a natural center point for objects.

@KoBeWi
Copy link
Member

KoBeWi commented Aug 5, 2020

that can lead to problems especially with coded positions.

What problems exactly? When instancing scenes you usually set the position anyways. The only "issue" with non-zero origin is that it's saved in the tscn.

@letsgamedev
Copy link
Author

Like rotate the whole node for example. If it's at 0,0 it will rotate on the spot. if I build the object on 50,50 it will still rotate around 0,0 and so it will make a circle.

@Calinou
Copy link
Member

Calinou commented Aug 5, 2020

You could create a scene with a Camera2D as root node and add it as a singleton in the Project Settings. You'll want to find a way to disable it when running other scenes, though. (If you check the Current property in other cameras, it will override the default camera, but undefined behavior will happen if you have multiple cameras with Current enabled.)

@geekley
Copy link

geekley commented May 13, 2024

See also #9719

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants