Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Feature] Dynamic sprite sizes!
#53
Here's my clipper code (Dugor helped with it a long time ago, makes surfaces not disappear when off screen):

Code:
If Y < 0 Then
        rec.Top = rec.Top - Y
        Y = 0
    End If
    
    If X < 0 Then
        rec.Left = rec.Left - X
        X = 0
    End If
    
    If X + Anim_Size(AnimNum).SizeX > DDSD_BackBuffer.lWidth Then
        rec.Right = rec.Right - (X + Anim_Size(AnimNum).SizeX - DDSD_BackBuffer.lWidth)
    End If
    
    If Y + Anim_Size(AnimNum).SizeY > DDSD_BackBuffer.lHeight Then
        rec.Bottom = rec.Bottom - (Y + Anim_Size(AnimNum).SizeY - DDSD_BackBuffer.lHeight)
    End If

Just change the Anim_Size stuff to whatever the size of the surface is.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)