How to use sprite sheets?
#4
Code: (Select All)
Screen _NewImage(800, 600, 32)

Dim Shared CardDeck As Long
CardDeck = _LoadImage("PlayingCards.png")
If CardDeck = -1 Then Print "PlayingCards.png failed to load, bye.": End
_Source CardDeck
_ClearColor Point(0, 0), CardDeck 'set background to transparent
_Source 0

ShowCard 0, 0, 0, 0 'ace of hearts is first top left corner of image
' king of spades below
ShowCard 0, 101, 12, 3
' 9 of diamonds under
ShowCard 0, 202, 8, 2

Sub ShowCard (x, y, h, v) 'screen x, y  h= horizontal  , v =vertical  image h, v
    ' 4 (0 to 3) rows across for Ace to King  0 to 12 cards
    ' hearts 1st row then clubs, diamonds then spades with 2 jokers in row 5
    ' image size of card is 38 x 51
    ch = 38 * h + 1: cv = 51 * v + 1
    'step doubles size of cards from image
    _PutImage (x, y)-Step(76, 102), CardDeck, 0, (ch, cv)-(ch + 37, cv + 50)
End Sub

   


Attached Files Image(s)
   
b = b + ...
Reply


Messages In This Thread
How to use sprite sheets? - by 40wattstudio - 09-09-2022, 12:39 AM
RE: How to use sprite sheets? - by James D Jarvis - 09-09-2022, 12:50 AM
RE: How to use sprite sheets? - by mnrvovrfc - 09-09-2022, 12:57 AM
RE: How to use sprite sheets? - by 40wattstudio - 09-09-2022, 02:47 PM
RE: How to use sprite sheets? - by bplus - 09-09-2022, 01:52 AM
RE: How to use sprite sheets? - by 40wattstudio - 09-09-2022, 02:00 AM
RE: How to use sprite sheets? - by 40wattstudio - 09-09-2022, 01:23 PM
RE: How to use sprite sheets? - by TerryRitchie - 09-09-2022, 02:34 PM
RE: How to use sprite sheets? - by 40wattstudio - 09-09-2022, 02:43 PM
RE: How to use sprite sheets? - by 40wattstudio - 09-12-2022, 10:31 AM
RE: How to use sprite sheets? - by TerryRitchie - 09-13-2022, 01:53 AM
RE: How to use sprite sheets? - by 40wattstudio - 09-09-2022, 01:57 AM
RE: How to use sprite sheets? - by Pete - 09-12-2022, 03:54 PM



Users browsing this thread: 4 Guest(s)