Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
I have problem blitting sprites
#13
Your code doesnt work because of two things:

1. You declare a dual playfield display, this is why the colors are screwed up
2. You load your spritesheet into the visile bitmap 0. You need to load it into #2, and you should init it with 672x32x6, not 320x200x6.

here is some code that works:
[ab3]WBStartup

; flags for InitCopList
#smoothscroll = $10
#dualplayfield = $20
#halfbrite = $40
#ham = $80

#lores = $000
#hires = $100
#super = $200

#loressprites = $400
#hiressprites = $800
#supersprites = $c00

#fmode0 = $0000
#fmode1 = $1000
#fmode2 = $2000
#fmode3 = $3000

#agapal = $10000

#agalowres = #agapal|8


; Objects
#PALETTE_DISPLAY = 0

#BITMAP_DISPLAY = 0
#BITMAP_DISPLAY2_ = 1
#BITMAP_SPRITESHEET = 2

#SHAPE_DUMMY = 0

#BUFFER_BASE = 0
#BUFFER_BASE2_ = 1

#COPPERLIST_DISPLAY = 0

; Playfield specs
#PLAYFIELD_WIDTH = 320
#PLAYFIELD_HEIGHT = 200
#PLAYFIELD_DEPTH = 8

; Allocate Bitmaps
BitMap #BITMAP_DISPLAY , #PLAYFIELD_WIDTH, #PLAYFIELD_HEIGHT, #PLAYFIELD_DEPTH
BitMap #BITMAP_DISPLAY2_ , #PLAYFIELD_WIDTH, #PLAYFIELD_HEIGHT, #PLAYFIELD_DEPTH
BitMap #BITMAP_SPRITESHEET , 672, 32, 6

Buffer #BUFFER_BASE , 2*16384
Buffer #BUFFER_BASE2_,2*16384

; Load sprite sheet
LoadBitMap #BITMAP_SPRITESHEET, "robotstrip.iff",#PALETTE_DISPLAY
AutoCookie On
tile.w = 11
GetaShape #SHAPE_DUMMY,32*tile,0,32,32

; goto blitzmode
BLITZ

InitCopList #COPPERLIST_DISPLAY,44,#PLAYFIELD_HEIGHT,#agalowres,0,2^#PLAYFIELD_DEPTH,0
DisplayPalette #COPPERLIST_DISPLAY,#PALETTE_DISPLAY
CreateDisplay #COPPERLIST_DISPLAY
BlitMode CookieMode

db.w = 0 ; current buffer, 0 or 1
x.w = 0 ; x pos
y.w = 0 ; y pos

Repeat
VWait
x+xv : y+yv
If x>=#PLAYFIELD_WIDTH-ShapeWidth(#SHAPE_DUMMY) Then xv=-1
If x<= 0 Then xv=1
If y>=#PLAYFIELD_HEIGHT-ShapeHeight(#SHAPE_DUMMY) Then yv=-1
If y<= 0 Then yv=1

DisplayBitMap #COPPERLIST_DISPLAY,#BITMAP_DISPLAY+db
db=1-db
Use BitMap #BITMAP_DISPLAY+db
UnBuffer #BUFFER_BASE+db
BBlit #BUFFER_BASE+db, #SHAPE_DUMMY,x,y, Off
Until Joyb(0)

End[/ab3]
Zitieren


Nachrichten in diesem Thema

Gehe zu:


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