This library is part of the Gamelib, created by Scott Porter and updated by Brent Silby. Gamelib is available under the terms of the GNU Library General Public Licence.
By definition a sprite has "frames" (horizontal frames) and "animations" (vertical frames). It can have only one frame so it will have 1 "frame" and 1 "animation" that are the same. To understand this better take a look at the many sprites at:
To use this library (this Class) add one line to the <HEAD> section of the web page of the Lot.
You need to click this link and "save" the library at the same folder of the web page or put it at another folder at the same server and make a reference:
If you put it at the same folder, the line would be:
To create an "object" of the Class:
someName = new Sp_Sprite();
Due to the continuing rendering problems under Linux platforms, add the following statement to your script before creating the sprites:
Read only if not especified differently
on Use this to determine whether the sprite is on/off. When off, it's not on screen. x Sprite's X position y Sprite's Y position z Sprite's z position. Sprites with higher value will pass over sprites with lower. xmin The minumum allowed x position for sprite. ymin The minimum allowed y position for sprite. xmax The maximum allowed x position for sprite. ymax The maximum allowed y position for sprite. width The width of sprite height The height of sprite xdir The direction of sprite in x axis ydir The direction of sprite in y axis xydegs The current direction of sprite as 0-359 degrees speed The speed of sprite. hard True if an sprite is hard frame The current frame being used by an animated sprite. animpos The current animation position for a frame. animdir The direction of animation, either "forward" or "backward". animspd The number of frames between animation changes. 0 means no animation. onmouseover [=String] Is R/W The string is the function name to be called when the mouse pointer has moved over the sprite. This CAN include arguments so mySprite.onmouseover="dosomething(x,y,z)" would pass the variables x,y,z to the function dosomething onmouseout [=String} Is R/W. The string is the function name to be called onclickdown [=String] Is R/W The string is the function name to be called onclickup [=String] Is R/W The string is the function name to be called
***IMPORTANT: To use the last four properties you need to create an object of the Class Mouse
bounces [=Boolean] Is R/W The sprite will collide and do not stops, reverting the direction draggable Whether the sprite is draggable or not. hitevents Whether this sprite is using hit events (see setHitEvent() method beingfollowed True if sprite is being followed by another object following The sprite this sprite is following followingx The x offset to sprite this sprite is following followingy The y offset to sprite this sprite is following