Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
I have problem blitting sprites
#4
I have overlooked that you do AutoCookie, sorry. But the main problem was using a Shape Object and not a Bitmap. "GetAShape" means getting a shape out of (a part of) a bitmap. Bitmaps and Shapes are different Blitz Objects and not interchangeable.

Quick "linting" on your code:
- you don't do actually double buffering. DisplayBitmap must use "db" too, otherwise you are showing always Bitmap 0
- you should assign human readable constants (or even variables) to your BlitzBasic objects, otherwise your code will get quickly unreadable. It is already hard to understand "DisplayPalette 0,0".
Example
#BITMAP_DISPLAY0 = 0
#BITMAP_DISPLAY1 = 1
#BITMAP_SPRITESHEET = 2

Compare this two lines:
GetaShape 0,0,0,32,32
vs.
GetaShape #SHAPE_HERO, 0,0, 32,32
Prefixing the constants with the type of object gives you some "type" hint, even though BlitzBasic is untyped here.
- no need to allocate a bitmap prior to loading, since LoadBitmap will free the previous one and allocate a new for the file's dimensions.
- GetaShape takes 5 parameters, you probably mean
GetaShape #SHARE_HERO,0,0,32,32
This might be the reason for the gfx trash
- you should always use the debugger to avoid crashes. Since you use Blit and BBlit, it is very easy to crash when you move out of the bitmap (see ClipBlit).
- Palette: I don't know what goes wrong here, but you should check if the color depth of Display, Bitmap and Palette in robotstrip.iff match. If not, you will get gfx trash and/or crashes. Your Shape may have less bitplanes than the bitmap, but you need to specify the "excess" parameter in Blit/BBlit then.
- in usual BlitzBasic style you dont free the Objects explicitly. You do this only if you are going to do something else then ending the program and want to save or reuse memory.

hope this helps.
Zitieren


Nachrichten in diesem Thema

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 2 Gast/Gäste