Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Game Library Sneak Peek
#1
Over the past few months I have been updating my libraries and making improvements. While doing this I also decided to update that old Sprite Library I created back in 2012. However, instead of just focusing on sprites it now focuses on game creation in general. By organizing my libraries (thank you for $INCLUDEONCE !) I've been able to really make some headway with this new library. I compiled a list of functions and subroutines I have completed and was a bit shocked at what I have finished so far.

Here's a sneak peek at the commands I've finished so far. I still have a ways to go (bugs, a few more commands, documentation, testing, example programs).

Code: (Select All)
'FUNCTION SOUND__NextIndex% ()                                                - get the next available index in the sound database
'FUNCTION SOUND_Make% (FileName AS STRING, Mode AS INTEGER, Volume AS SINGLE) - loads a sound from a sound file
'FUNCTION SOUND_Exists% (hSnd AS INTEGER)                                    - returns the existence of a sound in the sound database
'    SUB SOUND_Volume (hSnd AS INTEGER, Volume AS SINGLE)                    - set the volume level of a sound
'FUNCTION SOUND_Volume! (hSnd AS INTEGER)                                    - get the volume level of a sound
'    SUB SOUND_Delete (hSnd AS INTEGER)                                      - remove a sound from RAM and the sound database
'    SUB SOUND_Play (hSnd AS INTEGER)                                        - play a sound from the sound database
'    SUB SOUND_Stop (hSnd AS INTEGER)                                        - stop one or all sounds from playing
'    SUB SOUND_Pause (hSnd AS INTEGER)                                      - pause one or all sounds from playing
'    SUB SOUND_Resume (hSnd AS INTEGER)                                      - resume playing one or all paused sounds
'FUNCTION SOUND_Paused% (hSnd AS INTEGER)                                    - returns if a sound is paused
'FUNCTION SOUND_Playing% (hSnd AS INTEGER)                                    - returns if a sound is playing
'    SUB SOUND_PlayMode (hSnd AS INTEGER, Mode AS INTEGER)                  - sets a sound's play mode
'FUNCTION SOUND_PlayMode% (hSnd AS INTEGER)                                  - returns a sound's play mode

'FUNCTION SHEET__NextIndex% ()                                                - get the next available index in the sprite sheet database
'FUNCTION SHEET_Exists% (hSht AS INTEGER)                                    - returns the existence of a sprite sheet in the sprite sheet database
'FUNCTION SHEET_Load% (Filename AS STRING, GridWidth AS INTEGER, GridHeight AS INTEGER) - load a sprite sheet into the sprite sheet database
'    SUB SHEET_Delete (hSht AS INTEGER)                                      - removes a sprite sheet from RAM and the sprite sheet database
'FUNCTION SHEET_ClearColor~& (hSht AS INTEGER)                                - returns the transparent color of a sprite sheet
'    SUB SHEET_ClearColor (hSht AS INTEGER, cColor AS _UNSIGNED LONG)        - sets the transparent color of a sprite sheet
'    SUB SHEET_GridSize (hSht AS INTEGER, GridWidth AS INTEGER, GridHeight AS INTEGER) - define a sprite sheet's grid cell dimensions
'FUNCTION SHEET_Width% (hSht AS INTEGER)                                      - returns the width of a sprite sheet
'FUNCTION SHEET_Height% (hSht AS INTEGER)                                    - returns the height of a sprite sheet
'FUNCTION SHEET_GridWidth% (hSht AS INTEGER)                                  - returns the width of the grid cells on a sprite sheet
'FUNCTION SHEET_GridHeight% (hSht AS INTEGER)                                - returns the height of the grid cells on a sprite sheet

'FUNCTION IMAGE__NextIndex% ()                                                - get the next available index in the image database
'FUNCTION IMAGE_Exists% (hImg AS INTEGER)                                    - returns the existence of an image in the image database
'FUNCTION IMAGE_Make% (hSht AS INTEGER, Column AS INTEGER, Row AS INTEGER)    - creates a still image from an individual sprite on a sprite sheet
'FUNCTION IMAGE_Load% (FileName AS STRING)                                    - creates a still image from an image file
'    SUB IMAGE_Delete (hImg AS INTEGER)                                      - remove an image from RAM and the image database
'    SUB IMAGE_ClearColor (hImg AS INTEGER, cColor AS _UNSIGNED LONG)        - sets the transparent color of an image
'FUNCTION IMAGE_ClearColor~& (hImg AS INTEGER)                                - returns the transparent color of an image
'    SUB IMAGE_Restore (hImg AS INTEGER)                                    - restores the working image to the original image
'    SUB IMAGE_Flip (hImg AS INTEGER, Flip AS INTEGER)                      - flips the working image horizontally, vertically, or both
'    SUB IMAGE_Zoom (hImg AS INTEGER, Zoom AS SINGLE)                        - zooms the working image
'    SUB IMAGE_Rotate (hImg AS INTEGER, Degree AS SINGLE)                    - rotates the working image
'    SUB IMAGE_Put (hImg AS INTEGER, x AS INTEGER, y AS INTEGER)            - draws the working image to the screen
'FUNCTION IMAGE_Width% (hImg AS INTEGER)                                      - returns the width of the working image
'FUNCTION IMAGE_Height% (hImg AS INTEGER)                                    - returns the height of the working image
'    SUB IMAGE_Brightness (hImg AS INTEGER, Level AS SINGLE)                - change the brightness level of an image
'    SUB IMAGE_Contrast (hImg AS INTEGER, Level AS SINGLE)                  - change the contrast level of an image
'    SUB IMAGE_Gamma (hImg AS INTEGER, Level AS SINGLE)                      - change the gamma level of an image
'    SUB IMAGE_Negative (hImg AS INTEGER)                                    - convert the image to a negative
'    SUB IMAGE_GrayScale (hImg AS INTEGER)                                  - convert the image to gray scale
'    SUB IMAGE_Blur (hImg AS INTEGER, Level AS INTEGER)                      - perform a gaussian blur on the image
'    SUB IMAGE_Filter (hImg AS INTEGER, Filter AS INTEGER)                  - apply a predefined filter to an image

'FUNCTION CLIP__NextIndex% ()                                                - get the next available index in the animation clip database
'FUNCTION CLIP_Exists% (hClp AS INTEGER)                                      - returns the existence of an animation clip in the clip database
'FUNCTION CLIP_Make% (hSht AS INTEGER, c AS INTEGER, r AS INTEGER, Cells AS INTEGER, Dir AS INTEGER, Mode AS INTEGER, FPS AS INTEGER) ' make clip
'FUNCTION CLIP_Load% (FileName AS STRING, cw AS INTEGER, Dir AS INTEGER, Mode AS INTEGER, FPS AS INTEGER) - load animation clip from image file
'    SUB CLIP_Delete (hClp AS INTEGER)                                      - remove animation clip from RAM and the animation clip database
'    SUB CLIP_ClearColor (hClp AS INTEGER, cColor AS _UNSIGNED LONG)        - set the transparent color of an animation clip
'FUNCTION CLIP_ClearColor~& (hClp AS INTEGER)                                - returns the transparent color of an animation clip
'FUNCTION CLIP_CellWidth% (hClp AS INTEGER)                                  - returns the width of each animation cell within an animation clip
'FUNCTION CLIP_CellHeight% (hClp AS INTEGER)                                  - returns the height of each animation cell within an animation clip
'    SUB CLIP_FPS (hClp AS INTEGER, FPS AS INTEGER)                          - sets the frames per second rate of an animation clip
'FUNCTION CLIP_FPS% (hClp AS INTEGER)                                        - returns the frames per second rate of an animation clip
'    SUB CLIP_Direction (hClp AS INTEGER, Dir AS INTEGER)                    - set the play direction of an animation clip
'FUNCTION CLIP_Direction% (hClp AS INTEGER)                                  - return the play direction of an animation clip
'    SUB CLIP_PlayMode (hClp AS INTEGER, Mode AS INTEGER)                    - set the animation clip play back mode
'FUNCTION CLIP_PlayMode% (hClp AS INTEGER)                                    - returns the animation clip play back mode
'    SUB CLIP_SoundApply (hClp AS INTEGER, hSnd AS INTEGER)                  - apply an associated sound to an animation clip
'    SUB CLIP_Restore (hClp AS INTEGER)                                      - restore the working film strip to the original film strip
'    SUB CLIP_Brightness (hClp AS INTEGER, Level AS SINGLE)                  - change the brightness level of an animation clip
'    SUB CLIP_Blur (hClp AS INTEGER, Level AS INTEGER)                      - perform a gaussian blur on the animation clip
'    SUB CLIP_Contrast (hClp AS INTEGER, Level AS SINGLE)                    - change the contrast level of an animation clip
'    SUB CLIP_Filter (hClp AS INTEGER, Filter AS INTEGER)                    - apply a predefined filter to an animation clip
'    SUB CLIP_Gamma (hClp AS INTEGER, Level AS SINGLE)                      - change the gamma level of an animation clip
'    SUB CLIP_GrayScale (hClp AS INTEGER)                                    - convert the animation clip to gray scale
'    SUB CLIP_Negative (hClp AS INTEGER)                                    - convert the animation clip to a negative

'FUNCTION SPRITE__NextIndex% ()                                              - get the next available index in the sprite database
'FUNCTION SPRITE_Exists% (hSpr AS INTEGER)                                    - returns the existence of a sprite in the sprite database
'    SUB SPRITE_Reset (hSpr AS INTEGER)                                      - resets a sprite's settings to defaults and removes associated image
'FUNCTION SPRITE_Make% ()                                                    - creates a new sprite ready to configure
'    SUB SPRITE_Delete (hSpr AS INTEGER)                                    - removes a sprite from RAM and the sprite database
'    SUB SPRITE_ImageApply (hSpr AS INTEGER, hImg AS INTEGER)                - applies an image to a sprite
'    SUB SPRITE_ClipApply (hSpr AS INTEGER, hClp AS INTEGER)                - applies an animation clip to a sprite
'    SUB SPRITE_Justify (hSpr AS INTEGER, Justify AS INTEGER)                - sets a sprite's display justification
'FUNCTION SPRITE_Justify% (hSpr AS INTEGER)                                  - returns a sprite's display justification setting
'    SUB SPRITE_Xoffset (hSpr AS INTEGER, xoffset AS INTEGER)                - set a custom x coordinate display justification offset
'    SUB SPRITE_Yoffset (hSpr AS INTEGER, yoffset AS INTEGER)                - set a custom y coordinate display justification offset
'    SUB SPRITE_Mode (hSpr AS INTEGER, Mode AS INTEGER)                      - set the sprite to still image or animation modes
'FUNCTION SPRITE_Mode% (hSpr AS INTEGER)                                      - returns the still image or animation mode of a sprite
'FUNCTION SPRITE_ClipExists% (hSpr AS INTEGER)                                - returns if an animation clip has been applied to a sprite
'    SUB SPRITE_ClipRemove (hSpr AS INTEGER)                                - remove an animation clip from a sprite and set mode to still image
'    SUB SPRITE_ImageChange (hSpr AS INTEGER, Change AS INTEGER)            - allow changes made in the image database to affect sprite images
'    SUB SPRITE_Flip (hSpr AS INTEGER, Flip AS INTEGER) '                    - flips a sprite horizontally, vertically, or both
'FUNCTION SPRITE_Flip% (hSpr AS INTEGER)                                      - returns a sprite's flipped orientation
'    SUB SPRITE_Zoom (hSpr AS INTEGER, Percent AS INTEGER)                  - zooms a sprite
'FUNCTION SPRITE_Zoom% (hSpr AS INTEGER)                                      - returns a sprite's zoom level
'    SUB SPRITE_Rotate (hSpr AS INTEGER, Degree AS SINGLE)                  - rotates a sprite from 0 to 359.999 degrees
'FUNCTION SPRITE_Rotate! (hSpr AS INTEGER)                                    - returns a sprite's rotation degree angle
'    SUB SPRITE_RotateTowardSprite (hSprFrom AS INTEGER, hSprTo AS INTEGER, Offset AS SINGLE) - rotates a sprite toward aother sprite
'    SUB SPRITE_RotateTowardPoint (hSpr AS INTEGER, x AS INTEGER, y AS INTEGER, Offset AS SINGLE) - rotates a sprite toward an x,y point
'FUNCTION SPRITE_VectorX! (hSpr AS INTEGER)                                  - returns a sprite's normalized x vector quantity
'FUNCTION SPRITE_VectorY! (hSpr AS INTEGER)                                  - returns a sprite's normalized y vector quantity
'    SUB SPRITE_Move (hSpr AS INTEGER)                                      - move a sprite in the direction of the degree angle set
'    SUB SPRITE_Draw (hSpr AS INTEGER)                                      - draw the sprite to the screen
'    SUB SPRITE_Put (hSpr AS INTEGER, x AS SINGLE, y AS SINGLE)              - moves a sprite to an x,y coordinate location
'    SUB SPRITE_PutX (hSpr AS INTEGER, x AS SINGLE)                          - moves a sprite to an x coordinate location
'    SUB SPRITE_PutY (hSpr AS INTEGER, y AS SINGLE)                          - moves a sprite to a y coordinate location
'FUNCTION SPRITE_X! (hSpr AS INTEGER)                                        - returns a sprite's x coordinate location
'FUNCTION SPRITE_Y! (hSpr AS INTEGER)                                        - returns a sprite's y coordinate location
'    SUB SPRITE_Area (hSpr AS INTEGER, x1 AS INTEGER, y1 AS INTEGER, x2 AS INTEGER, y2 AS INTEGER) ' returns the justified rectangular area of sprite
'    SUB SPRITE__ResetCollision (hSpr AS INTEGER)                            - resets a sprite's collision detection variables
'FUNCTION SPRITE_RectCollide% (hSpr1 AS INTEGER, hSpr2 AS INTEGER)            - returns a rectangular collision between two sprites
'FUNCTION SPRITE_CircCollide% (hSpr1 AS INTEGER, hSpr2 AS INTEGER)            - returns a circular collision between two sprites
'FUNCTION SPRITE_CircRectCollide% (hSpr1 AS INTEGER, hSpr2 AS INTEGER)        - returns rectangular and circular collision between two sprites
'FUNCTION SPRITE_PixelCollide% (hSpr1 AS INTEGER, hSpr2 AS INTEGER)          - returns a pixel perfect collision between two sprites
'FUNCTION SPRITE_Collide% (hSpr1 AS INTEGER, hSpr2 AS INTEGER)                - automated collision check between two sprites
'FUNCTION SPRITE_CollidedWith% (hSpr AS INTEGER)                              - returns the sprite that this sprite collided with
'FUNCTION SPRITE_Collision% (hSpr AS INTEGER)                                - returns if a sprite has been in a collision
'    SUB SPRITE_CollisionArea (hSpr AS INTEGER, x1 AS SINGLE, y1 AS SINGLE, x2 AS SINGLE, y2 AS SINGLE) ' returns rectangular area of a collision
'    SUB SPRITE_CollisionPoint (hSpr AS INTEGER, x AS SINGLE, y AS SINGLE)  - returns the x,y point of a collision
'FUNCTION SPRITE_Distance! (hSpr1 AS INTEGER, hSpr2 AS INTEGER)              - returns the distance between two sprites
'FUNCTION SPRITE_DistanceToPoint! (hSpr AS INTEGER, x AS INTEGER, y AS INTEGER) - returns the distance between a sprite and x,y coordinate point
'FUNCTION SPRITE_DistancePointToPoint! (x1 AS SINGLE, y1 AS SINGLE, x2 AS SINGLE, y2 AS SINGLE) ' returns the distance between two x,y coordinates
'FUNCTION SPRITE_Seconds& ()                                                  - returns the number of seconds that FPS limiting has been active
'    SUB SPRITE_SpeedX (hSpr AS INTEGER, Speed AS SINGLE)                    - sets a sprite's x vector magnitude
'FUNCTION SPRITE_SpeedX! (hSpr AS INTEGER)                                    - returns a sprite's x vector magnitude
'    SUB SPRITE_SpeedY (hSpr AS INTEGER, Speed AS SINGLE)                    - sets a sprite's y vector magnitude
'FUNCTION SPRITE_SpeedY! (hSpr AS INTEGER)                                    - returns a sprite's y vector magnitude
'    SUB SPRITE_Reverse (hSpr AS INTEGER)                                    - reverse a sprite's direction by 180 degrees
'    SUB SPRITE_ReverseX (hSpr AS INTEGER)                                  - reverse a sprite's x vector direction
'    SUB SPRITE_ReverseY (hSpr AS INTEGER)                                  - reverse a sprite's y vector direction
'    SUB SPRITE_Status (hSpr AS INTEGER, Status AS INTEGER)                  - set a sprite's status (ignore, normal, pause)
'FUNCTION SPRITE_Status% (hSpr AS INTEGER)                                    - returns a sprite's status (ignore, normal, pause)
'    SUB SPRITE_Visible (hSpr AS INTEGER, Flag AS INTEGER)                  - set a sprite's on-screen visibility
'FUNCTION SPRITE_Visible% (hSpr AS INTEGER)                                  - return a sprite's on-screen visibility
'    SUB SPRITE_GlobalFPS (GlobalFPS AS INTEGER)                            - set the global frames per second rate
'FUNCTION SPRITE_GlobalFPS% ()                                                - return the global frames per second rate
'    SUB SPRITE_ResetFPS ()                                                  - reset the global frame and second counter
'    SUB SPRITE_LimitFPS ()                                                  - limit a loop to the global frames per second rate
'FUNCTION SPRITE_GlobalFrame% ()                                              - return the current global frame number
'    SUB SPRITE_ClipReset (hSpr AS INTEGER)                                  - reset a sprite's animation clip to default settings
'FUNCTION SPRITE_ClipNext% (hSpr AS INTEGER)                                  - advance to the next cell in the animation clip film strip
'    SUB SPRITE_ClipDirection (hspr AS INTEGER, Dir AS INTEGER)              - set a sprite's animation clip play direction
'FUNCTION SPRITE_ClipDirection% (hSpr AS INTEGER)                            - return a sprite's animation clip play direction
'    SUB SPRITE_ClipFPS (hSpr AS INTEGER, fps AS INTEGER)                    - set a sprite's animation clip frames per second rate
'FUNCTION SPRITE_ClipFPS% (hSpr AS INTEGER)                                  - return a sprite's animation clip frames per second rate
'    SUB SPRITE_ClipPlayMode (hSpr AS INTEGER, Mode AS INTEGER)              - set a sprite's animation clip play mode (once, loop)
'FUNCTION SPRITE_ClipPlayMode% (hSpr AS INTEGER)                              - return a sprite's animation clip play mode (once, loop)
'FUNCTION SPRITE_ClipFrame% (hSpr AS INTEGER)                                - return the frame number of a sprite's animation clip
'FUNCTION SPRITE_ClipCell% (hSpr AS INTEGER)                                  - return a sprite's current animation clip film strip cell in use
'FUNCTION SPRITE_ClipCellWidth% (hSpr AS INTEGER)                            - return a sprite's animation clip film strip cell width
'FUNCTION SPRITE_ClipCellHeight% (hSpr AS INTEGER)                            - return a sprite's animation clip film strip cell height
'    SUB SPRITE_Display ()                                                  - automated updating of all sprite characteristics and drawing
'    SUB SPRITE__Error (SubFunc AS STRING, Report AS STRING)                - report all errors found to programmer
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#2
The code, as written, runs perfectly!

Sorry, couldn't resist.

Pete Big Grin
Fake News + Phony Politicians = Real Problems

Reply
#3
(08-10-2024, 06:56 PM)Pete Wrote: The code, as written, runs perfectly!

Sorry, couldn't resist.

Pete Big Grin
I can always count on you for Beta testing Smile
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#4
Big Grin Big Grin Big Grin
Fake News + Phony Politicians = Real Problems

Reply
#5
I have some proof of concept code working. It's coming along very nicely. This little bit of code below sets up a sprite for user movement around the screen.

Keys:
    RIGHT/LEFT ARROW KEYS - move Mario back and forth across the screen
    UP/DOWN ARROW KEYS - zoom Mario in and out
    ESC KEY - exit demo and return to operating system

The ZIP file included below contains the demo code, Sprite_Test_1.BAS, and a folder named LIB that contains all of the external library files needed. Simply unzip the .ZIP file into your QB64pe root directory.

This library is still very much a work in progress but feel free to play around with it and the other libraries and individual library demo code included in the LIB folder.

Code: (Select All)
OPTION _EXPLICIT

'$INCLUDE:'.\lib\sprite\lib_sprite.bi'  library variable declarations

' -----------------
'| Begin test code |
' -----------------

DIM SHT_mario AS INTEGER '      sprite sheet
DIM IMG_standing AS INTEGER '  sprite standing still image
DIM SPR_mario AS INTEGER '      sprite
DIM CLP_walking AS INTEGER '    sprite walking animation clip
DIM AS INTEGER x1, y1, x2, y2 ' sprite rectangular area

' ----------------------
'| Create sprite sheets |
' ----------------------

SHT_mario = SHEET_Load(".\lib\sprite\mario32x32.png", 32, 32) ' load the mario sprite sheet with assigned 32x32 grid

' ---------------------
'| Create still images |
' ---------------------

IMG_standing = IMAGE_Make(SHT_mario, 1, 1) ' get standing image from sprite sheet at column 1 row 1

' ------------------------
'| Create animation clips |
' ------------------------

'Created from sprite sheet at column 2, row 1, 3 animation cells, forward animation, looping animation, 10 FPS

CLP_walking = CLIP_Make(SHT_mario, 2, 1, 3, LIB_FORWARD, LIB_LOOP, 10) ' create walking animation clip from sprite sheet

' ----------------
'| Define sprites |
' ----------------

SPR_mario = SPRITE_Make% '                  create the sprite
SPRITE_ImageApply SPR_mario, IMG_standing ' apply a still image to the sprite
SPRITE_ClipApply SPR_mario, CLP_walking '  apply an animation clip to the sprite
SPRITE_Put SPR_mario, 319, 239 '            set the x,y location of the sprite
SPRITE_Justify SPR_mario, LIB_CENTER '      center the sprite on the sprite's x,y location

' --------------
'| Define world |
' --------------

SCREEN_Make 640, 480 ' create layered graphics screen
SPRITE_GlobalFPS 60 '  screen updates will happen 60 times per second

' -----------------
'| Begin game loop |
' -----------------

DO '                                                                                            begin game loop
    SPRITE_LimitFPS '                                                                            limit loop to global FPS
    IF _KEYDOWN(19712) THEN '                                                                    RIGHT ARROW key pressed?
        SPRITE_Flip SPR_mario, LIB_NONE '                                                        yes, don't flip the sprite
        SPRITE_Mode SPR_mario, LIB_ANIMATE '                                                    animate the sprite
        SPRITE_PutX SPR_mario, SPRITE_X(SPR_mario) + SPRITE_Zoom(SPR_mario) * 2 '                update sprite's x position
    ELSEIF _KEYDOWN(19200) THEN '                                                                no, LEFT ARROW pressed?
        SPRITE_Flip SPR_mario, LIB_HORIZONTAL '                                                  yes, flip the sprite horizontally
        SPRITE_Mode SPR_mario, LIB_ANIMATE '                                                    animate the sprite
        SPRITE_PutX SPR_mario, SPRITE_X(SPR_mario) - SPRITE_Zoom(SPR_mario) * 2 '                update sprite's x position
    ELSE '                                                                                      neither RIGHT or LEFT ARROW keys pressed
        SPRITE_Mode SPR_mario, LIB_STILL '                                                      sprite is now a still image
    END IF
    IF _KEYDOWN(18432) THEN '                                                                    UP ARROW key pressed?
        IF SPRITE_Zoom(SPR_mario) < 8 THEN SPRITE_Zoom SPR_mario, SPRITE_Zoom(SPR_mario) + .1 '  yes, zoom the sprite larger
    ELSEIF _KEYDOWN(20480) THEN '                                                                no, DOWN ARROW key pressed?
        IF SPRITE_Zoom(SPR_mario) > .5 THEN SPRITE_Zoom SPR_mario, SPRITE_Zoom(SPR_mario) - .1 ' yes, zoom the sprite smaller
    END IF
    SPRITE_Area SPR_mario, x1, y1, x2, y2 '                                                      get rectangular area of sprite
    IF x1 < 0 THEN '                                                                            sprite beyond left side of screen?
        SPRITE_PutX SPR_mario, SPRITE_X(SPR_mario) + ABS(x1) '                                  yes, put it back on screen
    ELSEIF x2 > 639 THEN '                                                                      no, sprite beyond right side of screen?
        SPRITE_PutX SPR_mario, SPRITE_X(SPR_mario) - (x2 - 639) '                                yes, put it back on screen
    END IF
    SPRITE_Display '                                                                            update screen
LOOP UNTIL _KEYDOWN(27) '                                                                        leave when ESC key pressed
SYSTEM '                                                                                        return to operating system

' ---------------
'| End test code |
' ---------------

'$INCLUDE:'.\lib\sprite\lib_sprite.bm'    library subroutines and functions


Attached Files
.zip   GAMELIB.zip (Size: 207.3 KB / Downloads: 13)
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#6
Almost makes me wish I could make games. My head just ain't built for such things.
Tread on those who tread on you

Reply
#7
(08-19-2024, 05:34 PM)SpriggsySpriggs Wrote: Almost makes me wish I could make games. My head just ain't built for such things.
For years that's I what I thought too. I was the king of utility software and command line enhancements. It wasn't until I discovered QB64 and the excellent statement additions dealing with images and sounds and the speed it offered that I seriously took a crack at game programming. This is the typical formula I use:

- Create the game assets (images, sounds, object arrays to hold them)
- Set the initial values of the object arrays
- Begin loop
-    Check for player input
-    Update positions of objects in array
-    Check for object interaction
-    Update bullet and explosion arrays
-    Update display with new object , bullet, and explosion array positions
- Loop until player has no more objects

That's basically what this game library is doing in the background. It handles all the mundane array tasks, positioning, and interactions (collisions). I was tired of reinventing the wheel over and over again when I wrote a game. This library will help me crank out a game quickly and easily (at least I hope so).

There's a lot to do yet. I want to add vector drawing, line collision, game controller interaction, and very simple sprite physics as well. I'm simply taking all the personal little individual libraries I've created over the years and incorporating them into this project.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#8
Wow, sounds very cool, Terry. Can’t wait to fool around with it all.
Reply




Users browsing this thread: 1 Guest(s)