Liberty BASIC Help Online |
Sprite Commands
Only one graphicbox or graphics window in a program may use sprites.
print #w.g, "addsprite SpriteName BmpName";
This adds a sprite with name SpriteName from loaded bitmap called BmpName.
print #w.g, "addsprite SpriteName bmp1 bmp2 bmp3 ... bmpLast";
This adds a sprite with name SpriteName from loaded bitmaps - may include any number of bitmaps.
print #w.g, "background BmpName";
This sets the background for sprites to be the loaded bitmap called BmpName.
print #w.g, "backgroundxy 25 20";
OR
x=25:y=20
print #w.g, "backgroundxy ";x;" ";y
This places the point x, y from the background bitmap at location 0, 0 of the sprite graphicbox or graphics window.
print #w.g, "centersprite SpriteName"
This causes a sprite's x, y location to refer to the center of the sprite, rather than the default upper left corner.
print #w.g, "cyclesprite SpriteName 1"
print #w.g, "cyclesprite SpriteName -1"
print #w.g, "cyclesprite SpriteName 1 once"
This causes a sprite to cycle through its image list automatically. Using "1" will cause the list to cycle forward. Using "-1" will cause the list to cycle backwards. Using the optional "once" parameter will cause the sprite to cycle through its image list only one time, other wise it cycles continuously.
print #w.g, "drawsprites";
This causes all visible sprites to be drawn on the background and it updates the display.
print #w.g, "removesprite SpriteName";
This causes the named sprite to be removed from the collection of sprites.
print #w.g, "spritecollides SpriteName";
input #w.g, list$
OR
print #w.g, "spritecollides SpriteName list$";
This causes a list of all sprites that collided with the sprite named SpriteName to be contained in the variable called "list$".
print #w.g, "spriteimage SpriteName BmpNameX";
This causes the sprite called SpriteName to be shown as the image from its image list called BmpNameX.
print #w.g, "spritemovexy SpriteName 5 5";
OR
x=5:y=5
print #w.g, "spritemovxy SpriteName ";x;" ";y
This causes a sprite called SpriteName to move x pixels in the x direction, and y pixels in the y direction each time a DRAWSPRITES command is issued to update the display.
print #w.g, "spriteoffset SpriteName 20 20";
OR
x=20:y=20
print #w.g, "spriteoffset SpriteName ";x;" ";y
This causes the sprite x, y display location to be offset by the values indicated in x and y from its coded x, y location.
print #w.g, "spriteorient SpriteName normal";
print #w.g, "spriteorient SpriteName flip";
print #w.g, "spriteorient SpriteName mirror";
print #w.g, "spriteorient SpriteName rotate180";
This causes the sprite called SpriteName to be oriented in one of the four directions: normal, flip, mirror, rotate180.
print #w.g, "spriteround SpriteName";
This causes the sprite called SpriteName to be assumed to be a rounded area within the rectangular bitmap when collisions are evaluated.
print #w.g, "spritescale SpriteName 150";
OR
percent=150
print #w.g, "spritescale SpriteName ";percent
This causes the sprite called SpriteName to be scaled by the percentage designated in both width and height.
print #w.g, "spritetoback SpriteName ";
This causes the sprite called SpriteName to be drawn first, so that it appears underneath other sprites
print #w.g, "spritetofront SpriteName ";
This causes the sprite called SpriteName to be drawn last, so that it appears on top of other sprites
#w.g "spritetravelxy SpriteName 200 250 5 [landed]"
or
#w.g "spritetravelxy SpriteName " ;X; " " ;Y; " " ;speed; " [branchHandler]"
or
#w.g "spritetravelxy SpriteName " ;X; " " ;Y; " " ;speed; " subHandler"
This causes the sprite called SpriteName to travel to the x, y location specified at the speed indicated, and to fire an event when it reaches the destination. The event can be handled at a [branchLabel] or a sub.
print #w.g, "spritevisible SpriteName on";
print #w.g, "spritevisible SpriteName off";
This causes the sprite called SpriteName to be visible if "on" is used, or to be invisible if "off" is designated.
print #w.g, "spritexy SpriteName 100 137";
OR
x=100:y=137
print #w.g, "spritexy SpriteName ";x;" ";y
This causes the sprite called SpriteName to be drawn at position x, y the next time the display is updated with the DRAWSPRITES command.
print #w.g, "spritexy? SpriteName"
input #w.g, x, y
OR
print #2.g "spritexy? SpriteName x y"
This obtains the coordinates of the sprite called SpriteName and places them into the variables x and y.
Copyright (C) 2003 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/