GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — API Reference API Reference
Selim Arsever edited this page
You will find here a description of all the functions and objects offered by gameQuery.
gameQuery allows you to declare animations. Animations are made of one image with a succession of frames just like in a css sprite. An animation in itself doesn't exist until it's associated with a sprite. These are the attributes an animation can have:
example: var myAnimation = new $.gameQuery.Animations({ imageURL: "./myAnimation.png", numberOfFrame: 10, delta: 60, rate: 90, type: $.gameQuery.ANIMATION_VERTICAL | $.gameQuery.ANIMATION_ONCE}); This function defines the div to be used to display the game. All the objects to be added to the DOM by gameQuery will be added to this element or on of its child. If more than one element results from the expression only the first will be used. Options may contain:
example: $("#someId").playground({refreshRate: 60}); Called without any parameters the playground function returns the current playground. This function will prepare the game to be started by pre-loading the resources and will start the main loop. If a function is given as a parameter it will be called once everything is loaded. example: $("#startbutton").click(function(){ $.playground().startGame(function(){ $("#welcomeScreen").remove(); }); }) This function registers a function to be called at a regular interval. The rate is the number of milliseconds between two successive calls to the function given as argument. This function will be called as long as the return value is false. This function adds a sprite to the current selected element. This element is expected to be the playground, a group or another sprite. Any sprite created this way will automatically animate itself. The sprite will stay hidden as long as the start() function hasn't been called. Options may include:
example: $(document).playground("#playground", {height: playgroundHeight, width: playgroundWidth}) .addSprite("sprite1",{animation: animation1}); ##addGroup(name, options) This function behaves almost in the same way as the addSprite one but it creates a transparent sprite. Options may include:
$(document).playground("#playground", {height: playgroundHeight, width: playgroundWidth}) .addGroup("group1",{overflow: "visible"}) .addSprite("sprite1",{animation: animation1}) .addSprite("sprite2",{animation: animation1}); This function creates a tilemap using the animations from animationList and arranging them according to the tileDescription. animationList can be an array of animation or a multi-animation. tileDescription can be an array of integer where the value of each point is the index of the animation in the animationList (or the multi-animation index) or a function taking as parameter a x and y index and returning the index of the animation for this point. Tiles created by this method are marked by the "tileType_x" class where x is the animation index (this may be useful for collision). Remark: this doesn't work if the tilemap is transformed (rotation or scaling) Options may include:
example: var multiAnimation = new $.gameQuery.Animation({imageURL: "m.png", type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_MULTI, numberOfFrame: 3, delta: 10, distance: 10, rate: 300}); $.playground().addTilemap("myTilemap", tileDef, multiAnimation, {width: 10, height: 10, sizex: 3, sizey: 3, posx: 0}); This function allow to change the animation of the element on which it's called. This element is expected to be a sprite. Callback is a function to call at the end of each animation cycle. It's an optional parameter that will only be used if the animation is of type $.gameQuery.CALLBACK. Called without any parameter this function remove the animation from the selected sprite. If the currently assigned animation is a multi-animations the animation argument can be the index of the animation you want to choose amongst one of the multi-animations. This method returns the list of elements colliding with the selected one but only those that match with the filter given as parameter. example: $("#spaceship").collision(".missiles").each(function(){ killspaceship(); explodemissil(this); }); warning deprecated in 0.5 This function sets the div to use as a loading bar. This div will see its width increase progressively from 0 to width as the items on the preload list are loaded and each time the callback function will be called with the current progress (in percent) as argument. This function a callback to be called with the current loading progress (in percent) as argument. warning You need to include a sound wrapper for this function to work This function adds the sound to the current object. If a sound is already associated with this object it will be replaced unless the add argument is set to true. In this case both sounds will be associated with the object. warning You need to include a sound wrapper for this function to work This function plays the sound or sounds associated with the current object. warning You need to include a sound wrapper for this function to work This function stops the sound or sounds associated with the current object. warning You need to include a sound wrapper for this function to work This function pauses the sound or sounds associated with the current object. warning You need to include a sound wrapper for this function to work This function mutes the sound or sounds associated with the current object or mute all sounds if no object is selected. If you pass false to the function it unmutes instead of mutes. warning Supported browser: firefox > 3.5, safari > 3.1, chrome, internet explorer > 5.5 This function rotates the selected element(s) clock-wise. The argument is a degree. The usage of this function breaks the collision detection for now ! warning Supported browser: firefox > 3.5, safari > 3.1, chrome, internet explorer > 5.5 This function change the scale of the selected element(s). The passed argument is a ratio: 1.0 = original size, 0.5 = half the original size, 2.0 = twice the original size. The usage of this funciton breaks the collision detection for now ! |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |