Weekly Qbasic and Qb64 Lesson Topics
April 19, 2024, 01:38:03 pm
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
  Home Help Search Arcade Links Staff List Login Register  

My IDEA, a qb64 animation

Pages: [1]
  Print  
Author Topic: My IDEA, a qb64 animation  (Read 1115 times)
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« on: June 27, 2011, 07:53:36 am »

This is my newest on this, But  it is a boy danceing. I had trouble with useing a sprite sheet ,with frames that are small 120 x 94, when the image is enlarged to
the full window size, it becomes "rough", or not very clear,...so I made the sprite sheet with full size images and it looks better. There may be a better way to solve this, if anyone knows.
Code:
 REM Much thanks to Unseen, and his "useing a sprite sheet" tutorial, so it code I used to do this.
SCREEN _NEWIMAGE(600, 400, 32)
WINDOW SCREEN(200, 100)-(420, 250)
volume = 1 '
gamestart = False '
intromusic = _SNDOPEN("walking_1.wav", "VOL") '
_SNDVOL intromusic, volume '
_SNDLOOP intromusic '
PRINT " Music, Garry"
_DELAY 1
PRINT " MY DRAWINGS "
_DELAY 1

TYPE Rectangle
    X AS INTEGER
    Y AS INTEGER
    Width AS INTEGER
    Height AS INTEGER
END TYPE
Sprite& = _LOADIMAGE("dibujo.png")
'// GARY SAYS The sprite we are using has 49 frames, it has 10 frames on the X axis and 5 on the Y axis.
'// As we are dealing with an equally spaced sprite sheet we can load all the x/y points in a set of for loops.
DIM SpriteImageRect(50) AS Rectangle
FOR j% = 0 TO _HEIGHT(Sprite&) - (_HEIGHT(Sprite&) / 6) STEP (_HEIGHT(Sprite&) / 6)
    FOR i% = 0 TO _WIDTH(Sprite&) - (_WIDTH(Sprite&) / 2) STEP (_WIDTH(Sprite&) / 2)
        SpriteImageRect(rectcnt%).X = i%
        SpriteImageRect(rectcnt%).Y = j%
        SpriteImageRect(rectcnt%).Width = _WIDTH(Sprite&) / 2
        SpriteImageRect(rectcnt%).Height = _HEIGHT(Sprite&) / 6
        rectcnt% = rectcnt% + 1
    NEXT
NEXT
DO
    '// Draw the images in turn.skip the last image as it is blank.
    FOR i% = 0 TO 11
        _PUTIMAGE (200, 100)-(420, 250), Sprite&, , (SpriteImageRect(i%).X, SpriteImageRect(i%).Y)-(SpriteImageRect(i%).X + SpriteImageRect(i%).Width, SpriteImageRect(i%).Y + SpriteImageRect(i%).Height)
        _DISPLAY
        _DELAY .2 '////this is the _delay, can be changed to fit the music
        kb$ = INKEY$
        IF kb$ = CHR$(27) THEN SYSTEM
    NEXT
LOOP

  
Attatched is the sprite sheet and
The music is on Drop Box:
http://dl.dropbox.com/u/15387474/QB64_DanceingBoy.zip
 

or you can download this ,it is the same sprite sheet,


« Last Edit: September 13, 2011, 08:46:12 pm by GarrisonRicketson » Report Spam   Logged


Pages: [1]
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy