Weekly Qbasic and Qb64 Lesson Topics

QB64 lessons and tutorials,Games => Lesson Disussion => Topic started by: GarrisonRicketson on February 22, 2011, 06:36:54 am



Title: GarrysPacMan, useing putimage
Post by: GarrisonRicketson on February 22, 2011, 06:36:54 am
This is just a simple animation, useing 2 frames, of a 4 frame sprite sheet,.
You need the sprite sheet, for the image,
http://dl.dropbox.com/u/15387474/SprtSheet.PNG
Code:
    REM GarrysPacMan
DEFLNG A-Z

SCREEN _NEWIMAGE(640, 480, 32) 'our new 32bit screen!

WorkPage& = _LOADIMAGE("SPRTSHEET.png") 'create + load the sprite sheet page

_DEST 0 'tell proggy to point to screen

DO
    FOR x = 0 TO 376 STEP 94

        _PUTIMAGE (64, 100)-(220, 200), WorkPage&, 0, (x, 0)-(x + 93, 95)
        _DELAY .15
        FrameNum& = FrameNum& + 1
        ' _DELAY .1
        LOCATE 22, 10: PRINT FrameNum&
        IF FrameNum& = 2 THEN GOTO 1 '// on this, I am just useing the 2 frames,because
        '// I did not want to have to change the sprite sheet. It can be change to 4 to
        '// run all 4.
        PRINT "HELLO WORLD,guess thats about it on this."
        PLAY "MB<a20g25>"
        PRINT "Hit any key to see the sprite sheet, then anykey to exit"

    NEXT x

    1:
    FrameNum& = 0
LOOP WHILE INKEY$ = ""


SLEEP 1
SCREEN WorkPage& 'show the sprite page
SLEEP
SYSTEM
Note, if you do not like the "beeps", remark out the PLAY, or turn your speaker off. This code is based on  "old lessons" and others in lessons.
from Garry
Here is the sprite sheet,again:
(http://dl.dropbox.com/u/15387474/SprtSheet.PNG)


Title: Re: GarrysPacMan, useing putimage
Post by: Dustie Bear on March 11, 2011, 11:58:04 am

That runs realy smooth for just using three sprites.

Im going to have to study how you get part out each sprit seperatly
and remembering which _dest hold the picture and where to put it. That
makes my head swim sometimes!  :D

I will be studying this cause moving graphics is fun stuff!

Good job

Dustie




Title: Re: GarrysPacMan, useing putimage
Post by: GarrisonRicketson on March 11, 2011, 02:47:37 pm
I enjoy animations, alot, but then I realized, if they can be made interactive, as a game thats even better,...thanks on the reply,...


Title: Re: GarrysPacMan, useing putimage
Post by: GarrisonRicketson on September 05, 2011, 03:46:23 pm
Well it has been so long now, I do not remember where I was with this.