Rotation sprite

<< < (2/5) > >>

bedndarc:
:(

Mattias Gustavsson:
I'm not sure what your problem is. There is both a sprite manager and a resource manager, but you shouldn't need to use them directly (they are both in use in the tutorial samples). Could you provide more details?

bedndarc:
Probably I have missed something.
Details: By pressing a key, there is a change sprites. 5 images are used. The structure approximately following, is applied switch case1, case2..., case5. Images are replaced consistently at button deduction. At the moment of change of the image, game process loses FPS. It is probably necessary to load all images into memory, and after already remove to work. 5 cases, 5 commands of loading are now applied on all:
case 1:
spr.setbitmap ("../data/1.png");
break;
case 2:
spr.setbitmap ("../data/2.png");
break;
Etc.

Mattias Gustavsson:
Oh, ok, you see a slowdown in FPS when you change the bitmap? That's easily fixed.
 
Put some code like this in before you enter the main game loop:

Code:

siResourceManager->LoadBitmapStrip("Data/1.png");
siResourceManager->LoadBitmapStrip("Data/2.png");


Which will make sure that the images stay loaded until you unload them, and switching images will be fast (if you don't do this, the bitmap will be loaded from file everytime you switch).

To unload images, put this code after you exit the game loop:
Code:

siResourceManager->UnloadBitmapStrip("Data/1.png");
siResourceManager->UnloadBitmapStrip("Data/2.png");


If you want to speed up both the loading time and rendering of images, you should convert them from PNG to Pixie's own image format PIX. In the PixieLib folder there's a program called PixiePCT, and if you drag your PNG to one of the .bat files (for example, "RLE8 dither.bat", it will produce a .PIX file which you can use instead. (There's also a program called PixView, which can be used to view .PIX files).

Also, the "Strip ...bat" versions can take several PNG files and put them together into one .PIX file, and if you use that file on a sprite ( spr.setbitmap("img.pix"); ), you can call something like spr.SetCel(spr.GetCel()+deltaTime) to animate between those images.

Remember, that the source code of the example games (http://pixieuniversity.com/downloads.php) are very good for reference on how to do various things in Pixie.

bedndarc:
Perfectly! Many thanks :)
I am sorry for a considerable quantity of questions.

Navigation

[0] Message Index

[#] Next page

[*] Previous page