Product Chat / Question question about sprite size

Author
Message
Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 7th May 2017 18:27
Just a quick one...

If I set SetSpriteSize to (my_sprite,-1,-1), it keeps its native size...but does this mean it won't scale at all on resolutions other than mine. I'm concerned the sprite might be a bit big on lower resolutions.

AE
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 7th May 2017 19:07
SetSpriteSize: SetSpriteSize ( mySprite , sizeX , sizeZ ) -- passing -1 as one of the params ensure the sprite retains its aspect ratio

SetSpriteSize to (my_sprite,-1,-1)

Only one -1 is needed, the other number would control the percentage of the size of the sprite, while the -1 in the other place would retain the aspect ratio of the sprite.

I would have the sprite made large, for the highest resolution expected, then scaling down will always give good results for you. Scaling up usually produces artifacts.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 7th May 2017 19:43
Thanks, I thought that was the case. Up to this point I've been using SetSpriteSize (my_sprite,35,-1) but the sampling is producing slight artefacts of its own.

On a related note, I'm currently triggering said sprite by pressing CAPS (though I intend to change this to TAB for the final build but it obviously clashes with the menus in Test Game). I'm using if GetScancode() == 58 then but the problem is the sprite will only display when CAPS is the only key pressed, meaning you can't be moving and pull it up. Is there a different command I could use?

AE
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 7th May 2017 23:51
Maybe try g_KeyPressTAB

This may be best answered in the script section.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 8th May 2017 10:09
Quote: "I'm using if GetScancode() == 58 then but the problem is the sprite will only display when CAPS is the only key pressed, meaning you can't be moving and pull it up. Is there a different command I could use? "


No you just have to write a little more code I'm afraid. Just set a flag with the GetScancode part and then check if said flag is on or off to display the sprite.


That's the basics for setting a simple flag. You then just have to position the sprite at the correct place (on screen or off screen as there is no hidesprite command as yet). Check out my HUD thread as that has a similar thing in for a view-able custom health bar.


SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.

Login to post a reply

Server time is: 2024-10-06 09:48:47
Your offset time is: 2024-10-06 09:48:47