setmode and sprite coordinates
-
OK, it took me a while, but I figured it out that it's not me doing something wrong but rather that sprite coordinates start now not from top-left corner as in tutorial videos but from the center of a screen..
That'd be fine, BUT when I use setmode(1280,720) it's not the center anymore! The (0,0) coordinates stay as if the resolution was still 1920x1080 and thus become shifted from a center to the the right and bottom :(
Is there some command to make the coordinates update to a new resolution? -
Sorry about this. A change was made in version 3 to bring things into line. If you want to use the old behaviour you have to put setcompatibility("2.15.0") at the top of your program. This was the way it worked when the videos were made.
-
@pianofire well, yes, I know about setcompatibility, but is there maybe something to make this sprite-coordinates behave without reverting EVERYTHING to an older version?
UPD: after careful reading of the help reguarding the setcompatibility function I come to a conclusion that it shoudn't affect anything but this spritecamera coordinates.. Im I right to assume that?.. -
Can you show us your code? I think the order matters, you need to first set the resolution, then the sprite camera. A resolution change would keep the top left corner of the screen at the same sprite coordinages, I guess, leading to what you describe.
-
@z-mann Sure
the results of a code are on 2nd pic - with the setmode(1280,720) and on a 3rd - without it.
As you can see - if I don't use the setmode - then the 1st sprite (0,0) is in the dead center of a screen, but if I do use it - then it's moved to the right and down... -
I admit that I've not had a lot of time to use Fuze lately, and when I have I've just used a setSpriteCamera command to put things back the way they used to be pre-patch, so I'm probably not the best person to comment but it looks to me like after setting the resolution to 720p, the sprite camera needs adjusting to take this into account. Whether that is an oversight on the part of Fuze or not I'm not sure because like I say, I've not had the time to really get my head round the new sprite coordinate system yet. I really should.
-
@martin OK, but wich is better - setcompatibility or just setspritecamera?
Personally, I also like when (0,0) coordinates are in the top-left corner rather than at a center.. I wonder why you guys made it to be so in a 3.0.0 in a first place?.. -
Ultimately this will come down to personal preference, but we determined that a camera with a centered origin makes more sense than a top-left origin for the following reasons:
- If you want the camera to follow an object, you can now set the camera's location to be the same as the object and it will be centered on the object, which many users would reasonably expect
- The center-origin camera rotates about its own location instead of (0, 0), which is more intuitive
- The center-origin camera zooms in/out about its own location instead of (0, 0), which is more intuitive
We'll take a look at the issue with the camera and
setMode
, it sounds like it should be working differently than it does. In the meantime, feel free to adjust the camera manually (recommended) or usesetCompatibility("2.15.0")
to use the old camera system for now. The old camera system, as with all compatibility mode functionality, may not be supported at some point in the future. -
@willpowered Well.. thanks for the help, guys!
I've already added couple of lines of a code at the start that are looking at what is the current resolution and either call the setmode function or not and adjust the camera accordingly. -
@evilblade Do an additional update() right after setMode(). The bug simply seems to be that right after setMode, the sprite camera has not been updated to the proper screen resolution yet and picks the wrong screen centre. After the first update(), that is fixed.
Personally, I'd definitely go with the new way of setting the camera. And I'd set it up myself, not relying on any defaults, because while it is relatively clear how the camera centre and rotation should change on a setMode() (they should not change), the zoom level is less clear. Does it maintain the pixel zoom OR the general look on the screen? Both are equally right. (currently, the pixel zoom is maintainted, which is the third argument to setSpriteCamera, so that makes sense.) -
@z-mann said in setmode and sprite coordinates:
@evilblade Do an additional update() right after setMode().
Yup! That seams to do the trick. Thanks, man!