Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Question about rtg displaying graphics
#6
Here it is.
I simply cut this from AmegaOne src. I hope you see how this works.

(code)
Select enemyID
Case #ENEMY_TANK1
EnemyL()\img = #IMG_TANK1
EnemyL()\frame = 0
EnemyL()\width = image_GetWidth {imgA(EnemyL()\img)} / 16 ;16 is the number of animframes
EnemyL()\height = image_GetHeight{imgA(EnemyL()\img)}

...


ResetList EnemyL()
While NextItem(EnemyL())
...
x.l = Int(EnemyL()\x)-\mapPosX-EnemyL()\width/2
y.l = Int(EnemyL()\y)-\mapPosY-EnemyL()\height/2
image_SetBlitDims{imgA(EnemyL()\img),EnemyL()\width*Int(EnemyL()\frame),0,EnemyL()\width,EnemyL()\height}
dbl_QBlit{imgA(EnemyL()\img),x,y}
EndIf
Wend
(/code)

what it does is:
the gfx of an enemy in this case is one wide spritesheet with all frames after each other.
the width of each frame is Getwidth{...} / numframes.
later, when blitting, the actual frame gets picked with
SetBlitDims{imageid, framewidth * frame,...}
so that the frame is a multiplier to set the x-offset inside the wide spritesheet.

Is that easy to understand? i hope it is. Wink
Zitieren


Nachrichten in diesem Thema

Gehe zu:


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