News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Scale-Sprite and New-Sprite don't work

Started by Bub, December 08, 2006, 03:18:19 PM

Previous topic - Next topic

Bub

I have version of Play-Basic :  V1.59 / 1.15c

Scale-Sprite : I have tried for 2 hrs now and Sprite is still the same size .

New-Sprite: I have tried for 1/2 hr. and Create-Sprite just gives me error messages no matter how I try a new approach haven't created a sprite with it yet.

`--------------------------------------------------
Scale-Sprite sample:

CreateSprite s
SpriteImage s,Snowflake
ScaleSprite s, 50  `****************
CenterSpriteHandle s
PositionSprite s,100,300
`---------------------------------------------------

New-Sprite sample:

NewSprite(s, 100, 300, Snowflake)


`---------------------------------------------------

I am now using Scale-Image to scale the sprite image down and that works fine.
I guess I'll stick to that for now.

Ian Price

Have you used the PrepareImageFX (or whatever the command is - I'm not able to access PB from here) command on the sprite image(s)? Otherwise, it won't work, which could explain your problem.
I came. I saw. I played some Nintendo.

stef

#2
for scalesprite you need rotationmode

SpriteDrawMode s,2


This is wrong:    NewSprite(s, 100, 300, Snowflake)
correct: s=NewSprite(100, 300, Snowflake)

(The explaination in helpfile

SpriteIndex = NewSprite(SpriteIndex, Xpos, Ypos, ImageIndex)

is wrong!)


P.S.
Hi Ian!
You're right. The wrong usage of 'Preparefximage' is one of my frequently mistakes. :)
But for once not here.




im=NewImage(100,100)
RenderToImage im
Cls RGB(255,0,0)
CircleC 50,50,50,1,RGB(0,0,255)

sp=NewSprite(100,100,im)
SpriteDrawMode sp,2

sp2=GetFreeSprite()
CopySprite sp,sp2

RenderToScreen

scalesprite sp,2;doublesize
drawsprite sp

ScaleSprite sp2,0.5;halfsize
PositionSprite sp2,400,100
DrawSprite sp2

Sync
WaitKey




kevin


  The following is cut and pasted straight from the ScaleSprite documentation.    Always look under the FACTs section for special considerations about a particular function.

Quote
FACTS:

* Using a negative scaling value will Flip/Mirror this sprite
* In order for sprites to be Scale, the sprites draw mode needs to be set to Rotation Mode using the SpriteDrawMode command.
* Also, the Image that a sprite is using, must be prepared as an FX image. See PrepareFXimage


Quote
The explaination in helpfile

SpriteIndex = NewSprite(SpriteIndex, Xpos, Ypos, ImageIndex)

is wrong!)

Fixed now


QuoteYou're right. The wrong usage of 'Preparefximage' is one of my frequently mistakes.

  Newer versiosn of PB don't require them to be FX images, but there's little point trying to scale/rotate a video image.  So they'd display but it'll be slow as hell !