IonicWind Software

IWBasic => General Questions => Topic started by: J B Wood (Zumwalt) on December 05, 2006, 09:37:50 PM

Title: SpriteScaleFactor Doesn't seem to work.
Post by: J B Wood (Zumwalt) on December 05, 2006, 09:37:50 PM
SpriteScaleFactor backgroundsprite, 0.50
This should scale my sprite by 50%, but the sprite doesn't change size.
Title: Re: SpriteScaleFactor Doesn't seem to work.
Post by: Ionic Wind Support Team on December 05, 2006, 09:42:11 PM
You have to set the sprite mode to one of the scaled modes.  @TRANSSCALED for example.  Users guide for 2D->Sprites.  And before you ask they are software rendered so you can't combine modes, you can only use the ones from that chart.

Title: Re: SpriteScaleFactor Doesn't seem to work.
Post by: J B Wood (Zumwalt) on December 05, 2006, 09:46:51 PM
This shifts the sprite, I even tried @Scaled, but as I reduce the sprite in size, it shifts id down on the screen.
Here is my code:



backgroundsprite = LoadSprite(GETSTARTPATH + "img\background.bmp")
if backgroundsprite <> NULL
SpriteDrawMode backgroundsprite, @SCALED
SpriteScaleFactor backgroundsprite, 0.95

Frame = 0
int mElapsed,mTimer
mTimer = timeGetTime()
exit_game=FALSE
/* Our beautiful Game Loop */
DO
FILLSCREEN 0
'ESC to exit at any time
IF KEYDOWN(1) then exit_game = TRUE
SpriteFrame backgroundsprite, 0
    DrawSpriteXY backgroundsprite,0,0

'target 75 frames per second for movement.
mElapsed = timeGetTime() - mTimer
mTimer = timeGetTime()
mAdjust = mElapsed / 13.3333
fps = FLIP 1

UNTIL exit_game
FREESPRITE backgroundsprite
ENDIF
CLOSESCREEN
Title: Re: SpriteScaleFactor Doesn't seem to work.
Post by: Ionic Wind Support Team on December 05, 2006, 09:49:45 PM
Scaling is based on the center of the sprite.  Any more questions?
Title: Re: SpriteScaleFactor Doesn't seem to work.
Post by: J B Wood (Zumwalt) on December 05, 2006, 09:50:28 PM
Yea how do I move the scaled sprite if DrawSpriteXY doesn't move it? I want the scaled version to be placed with upper left at 0,0
Title: Re: SpriteScaleFactor Doesn't seem to work.
Post by: Ionic Wind Support Team on December 05, 2006, 09:53:36 PM
DrawSpriteXY sprite, -w/2 * scale, -h/2 * scale

Would be my guess.  Either that or just create a bitmap of the correct size in the first place ;)

Title: Re: SpriteScaleFactor Doesn't seem to work.
Post by: J B Wood (Zumwalt) on December 05, 2006, 09:54:59 PM
Takes out half the fun of messing with the methods to see what I can dork up.
I'll let you sleep now :) going to work on this more tomorrow night :) Thanks