Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / SetSpriteScale big size

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 29th Jan 2015 13:59 Edited at: 29th Jan 2015 14:01
Hi.

I wrote a code that when click on sprite, Rescale it to custom size.
but I have a Problem when use SetSpriteScale. mean when I set my sprite to custom size (256,184) like below code, show normal size.



but when I use SetSpriteScaleByOffset() for increase Sprite size, it rescale my sprite to big size.like below code:

in this code I set my original size to (50x30) and I want after click on it, increase scale to (256x184).



for rescale it I can use setSpritesize but I want know how work SetSpriteScaleByOffset() command.



Please Guide Me.

Thanks.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 29th Jan 2015 14:36
SetSpriteScale uses a value between 0.0 and 1.0. It might be easier using SetSpriteSize if you have a specific size in mind.


Using AppGameKit V2 Tier 1
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 29th Jan 2015 14:39
Scale uses 0 -> 1 for 0% to 100%

e.g
0.5 = 50%
1 = 100%
2 = 200%

You are using numbers up to 100, remove *100 from your calculations.

Also:

if sprw# <= (256.0-50.0) then sprw# = sprw# + 2.0

Write this as:

if sprw# <= (216) then sprw# = sprw# + 2.0

Don't make your code work any harder than it has to

Quidquid latine dictum sit, altum sonatur
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 29th Jan 2015 14:41 Edited at: 29th Jan 2015 14:42
Ok

Thanks baxlash.

Thanks BatVink.

Login to post a reply

Server time is: 2024-05-05 07:28:18
Your offset time is: 2024-05-05 07:28:18