Product Chat / Sprite Positions change based on Resolution

Author
Message
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 12th Aug 2017 02:16 Edited at: 12th Aug 2017 15:50
So I just discovered something pretty horrific today... after 6 months of work.... I have moved from a smaller monitor to a larger one. So my resolution settings have changed. When I opened my project some of my sprites are all over the place on the screen. Even though they are set via percentages nothing is lined up properly anymore.

Am I to assume that from the user perspective.. those that play the games we make will each experience different results with our UI?

I'm assuming this means I will have to create another script that detects the screen resolution (if it exists) and modify everything position around that.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 12th Aug 2017 10:06
Hi teabone, yeah I had this as well, you need to place this before any ShowSprite() or PasteSprite() commands

SetSpriteSize ( mySprite , sizeX , sizeZ ) -- passing -1 as one of the params ensure the sprite retains its aspect ratio

obviously using your own variable names, my note scripts were hit bad, but I found 45, -1 work to display my notes on the right of screen in any resolution, the -1 keeps the sprites aspect correct. Hope that helps
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, Asus GT970 STRIX 4gb Nvidia gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit, Novation Ultranova Synth, Waldorf Blofeld Synth.
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 12th Aug 2017 15:20 Edited at: 13th Aug 2017 03:07
Having a bit of a mind-blank morning. Where would put the -1 ?



EDIT: I think maybe the mistake I made was trying to trick the system into forcing the image exactly where I wanted by making the PNG the size of the entire screen with mostly negative space and having the actual image located somewhere within.

Also noticed my text elements are no longer aligned properly. :/
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 12th Aug 2017 19:29
put the -1 in either sizeX or sizeZ
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, Asus GT970 STRIX 4gb Nvidia gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit, Novation Ultranova Synth, Waldorf Blofeld Synth.
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 13th Aug 2017 02:06 Edited at: 13th Aug 2017 02:06
Hi all,
Yeah had this issue myself. An never figured out the fix....

@Tarkus1971: So should Teabone's code be something like this:


Would be nice to have a sprite layer like Construct2 - you place whatever you want on it at design time, and it gets scaled to whatever resolution the monitor is at automatically

Reliquia....
aka OldFlak
Intel(R) Core(TM) i3-4160 @ 3,60GHz. 8GB Ram. NVidia GeForce GTX 750. Acer 24" Monitors x 2 @ 1920 x 1080. Windows 10 Pro 64-bit.
PM
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 13th Aug 2017 07:57
This is part of my note script. 45,-1 means 45% of screen and -1 keeps the aspect ration correct

Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, Asus GT970 STRIX 4gb Nvidia gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit, Novation Ultranova Synth, Waldorf Blofeld Synth.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 13th Aug 2017 11:30
For this just add -1 to the Y co-ordinate. That way you will get the percentage size across the X axis as you want and GG will automatically keep the Y axis a the proper size accordingly. It's always best to get a handle on this at the start of your project, especially if you are using a lot of sprites

As far as I know this should work on any resolution as it was coded to take different resolutions from the start. With something like this it can be quite complicated and different resolutions can affect all sorts (not just the sprites look).
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 13th Aug 2017 12:27
Hi all,

Thanks @Tarkus1971 and @DVader - makes sense now - lol.

Great retro thing happening there DVader!

Reliquia....
aka OldFlak
Intel(R) Core(TM) i3-4160 @ 3,60GHz. 8GB Ram. NVidia GeForce GTX 750. Acer 24" Monitors x 2 @ 1920 x 1080. Windows 10 Pro 64-bit.
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 13th Aug 2017 17:16
Okay I'm going to have to try this today. I have made an inventory system where you move around icons... so everything has to line up preciously.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960

Login to post a reply

Server time is: 2024-11-24 12:11:15
Your offset time is: 2024-11-24 12:11:15