archive-org.com » ORG » G » GAMEJS.ORG

Total: 19

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • CommonJs Modules
    or property which you attach to exports in your module will be exposed and can be imported by other modules exports zardar function exposes a function zardar require foobar returns an object holding all exposed properties of a module foobar Anatomy of a Module Every JavaScript file is treated as a module A simple module in the file foobar js might look like the following I want to expose the

    Original URL path: http://gamejs.org/modules.html (2016-04-29)
    Open archived version from archive



  • the individual images Single images can be accessed by call get index on the SpriteSheet instance var imageDimensions width 64 height 128 var spriteSheet new SpriteSheet images coins png imageDimensions var firstImage spriteSheet get 0 The SpriteSheet class delegates most of its work to gamejs Surface blit The SpriteSheet constructor builds an array of individual images the surfaceCache by creating one small Surface for each animation cycle image On to that surface we only blit the currently interesting area of the sprite sheet and put it into the surfaceCache var SpriteSheet function imagePath sheetSpec this get function id return surfaceCache id var width sheetSpec width var height sheetSpec height var image gamejs image load imagePath var surfaceCache var imgSize new gamejs Rect 0 0 width height extract the single images from big spritesheet image for var i 0 i image rect width i width for var j 0 j image rect height j height var surface new gamejs Surface width height var rect new gamejs Rect i j width height surface blit image imgSize rect surfaceCache push surface return this Now that we solved the problem of accessing single images in a sprite sheet we can turn to cycling through those images We need an Animation class which takes a SpriteSheet and an animation specification The animation specification defines all cycles held by the sprite sheet ie the cycle name and the two index position of the first and last image making up a cycle Three named cycles are defined in the following animation specification The first cycle uses all 6 images with index 0 to 5 and is named flying while the second cycle pause consist of only one image flying 0 5 pause 5 We can later use the cycle names to start the cycle The animation will

    Original URL path: http://gamejs.org/animation-and-spritesheet.html (2016-04-29)
    Open archived version from archive


  • input event hands A director could also keep track of a stack of scenes which would allow you to push and pop but this useful extension is not covered in the tutorial The director is created var director new Director Our director will manage the screen i e create the screen and let the active scene draw on it Let s think about the scene API for a moment the director needs to tell the scene to draw itself onto the display the scene receives events the scene updates with the usual update msDuration calls every game tick This is how a start screen could look like var StartScene function director this handleEvent function event if event type gamejs event MOUSE UP director replaceScene new GameScene director this draw function display display blit startPicture var startPicture gamejs image load images start png return this This scene doesn t have a update msDuration function because the start screen never changes It waits for a gamejs event MOUSE UP event to switch to the next scene by calling director replaceScene nextScene Initially our director is paused and has no scene active We start the game by calling director start firstScene var firstScene

    Original URL path: http://gamejs.org/director-scene.html (2016-04-29)
    Open archived version from archive


  • 2013 04 Overview Not backwards compatible due to changes in event handling and game loop adapting your game should be rather easy Major changes and new features improved gamejs worker module use gamejs onEvent instead of the removed gamejs event get use gamejs onTick instead of the removed gamejs time functions new gamejs draw quadraticCurve and gamejs draw bezierCurve new flag gamejs display FULLSCREEN experimental see examples event new flag

    Original URL path: http://gamejs.org/release2013-04.html (2016-04-29)
    Open archived version from archive


  • actions which are triggered by key presses For example the browser s default action when space is pressed is to scroll the page GameJs now only supresses the default browser action of a key if the canvas has focus The new display flag gamejs display DISABLE SMOOTHING is especially useful for retro graphics when you do not want GameJs to smooth the images when they are rotated or scaled Major changes and new features new gamejs time interval using requestAnimationFrame were available supersedes the now deprecated gamejs time fpsCallback new flag gamejs display DISABLE SMOOTHING to disable image smoothing when scaling or rotating e g useful for retro graphics new seedable pseudo random number generator gamejs utils prng new noise generator gamejs noise module new function Sprite groups returns the array of groups this sprite is contained in do not supress any default browser actions by keypress unless the GameJs display canvas has focus example browser action search opens in firefox if is pressed Surface clear accepts rect argument module moved gamejs base64 gamejs utils base64 Changes and bugfixes fix bottomleft bottomright topright accessors not setting values correctly gamejs utils vectors angle now returns the normalized value implement argument for

    Original URL path: http://gamejs.org/release2013-02.html (2016-04-29)
    Open archived version from archive


  • The benefit is that code running in a Worker will not slow down your rendering code Checkout the new example as well as the extensive docs on the new gamejs worker module In other news tiled maps produced by the excellent general purposed map editor Tiled can now be loaded with the new gamejs tmx module There s a new GameJs example tmxmap to get you started Other changes new

    Original URL path: http://gamejs.org/release2012-08.html (2016-04-29)
    Open archived version from archive


  • qUnit and more unit tests added gamejs mixer now has Channels thus it can play a Sound multiple times concurrently multiple fixes for SurfaceArray most importantly it works for images loaded with gamejs image load fixes gamejs sprite Group remove removing the last sprite if the sprite passed as argument is not in the group fixes Group forEach and Group map not respecting the this argument fixes bash scripts for

    Original URL path: http://gamejs.org/release2012-02.html (2016-04-29)
    Open archived version from archive


  • Breaking changes gamejs transform scale used to accept scale factor now the second argument represents the new width height Improvements API doc improvements fixes API documentation now ships with GameJs check your docs api folder adds various new Rect methods and properties adds more gamejs utils vectors functions fixes display Surface access speed fixes gamejs transform rotate not resizing the surface if the rotation requires it bugfixes minor enhancements See

    Original URL path: http://gamejs.org/release2011-10.html (2016-04-29)
    Open archived version from archive



  •