Home | Rules and Guide | Sign In/Create Account | Write a Post | Reddit | #LD48 | #ludumdare on irc.afternet.org (Info)

Ludum Dare 30 — August 22nd-25th 2014 — Theme: Connected Worlds
  • Judging Ends: in 14 days, 6 hours, 6 minutes, 36 seconds
  • [ Real World Gatherings | Ludum Deals | Warmup Weekend (Games) | MiniLD #53 | Wallpaper (1) (2) (3) | Mailing List ]

    [ Play+Rate | Edit | View All Games | My Game ]


    Html5 Base-App

    Posted by (twitter: @Nehmulos)
    December 9th, 2012 10:37 am

    This weekend I created the base that I’m going to use for the next Ludum Dare.
    It uses cocos2d-javascript for graphics, box2d.js for physics and a custom Audiomanager.

    If you want to get started with cocos2d-javascript, a look on my source code might be useful for you, since the tutorials are outdated.

    Physics
    I have a custom PhysicsNode class that provides a simple constructor for box2d shapes and synchronizes a cocos2d graphics node with the box2d.body.

    Preloading images
    I modified cocos2d-javascript to allow simple resource preloading from javascript.
    Earlier versions required you to use the cocos2d commandline tool that merged all your files.
    Now you can just write this in your Application.js file:

    registerResource("images/myimage.png", "image/png");

    Audio
    The custom Audiomanager first checks which codecs are supported,
    when you give it an audio file to preload it will use the first url for a supported format:

    Audiomanager.instance.load({
        "ogg": "audio/blub.ogg",
        "aac": "audio/conversions/blub.aac"
    },"blub");

    Then you can play it with using the given alias

    Audiomanager.instance.play("blub");

    The repository also contains a small bash script that converts all ogg files in the audio directory into aac and wav files using ffmepg.

    Please feel free to use this base for your own games.
    It’s licensed under the zlib license, which means: do WTF you want, just don’t claim, that you wrote code that was written by others.

    You can test it here.

    Tags: , , , , ,

    Leave a Reply

    You must be logged in to post a comment.


    All posts, images, and comments are owned by their creators.

    [cache: storing page]