Impact++ core that requires the primary modules and enhances ImpactJS's core.

  • Collin Hover -
// getting started with Impact++ is easy!
// add the two basic scripts to the end of your game HTML file:
// first the ImpactJS main script
<script type="text/javascript" src="lib/impact/impact.js"></script>
// then your game's main script
<script type="text/javascript" src="lib/game/main.js"></script>
// now inside your game's main script file
// you'll set it up the same as when using ImpactJS
// define the main module (script)
// then require the other modules
     // to hook Impact++ into your game
     // all you need to do is require one module
     // then don't forget your levels
// now define how your game starts up
.defines(function () {

     // always use strict
     "use strict";

     // store the config in a local variable
     // this is a good pattern to follow in general
     var _c = ig.CONFIG;

     // now have your game extend ig.GameExtended
     var myGameClass = ig.GameExtended.extend({
         // game settings go here

     // (optionally, add custom settings in 'plusplus/config-user.js')

     // then start the game as usual with your game and config
         // you'll need a canvas element with an id of 'canvas'
          // your game class
          // this value does nothing
          // the width / height / scale of your game
          // don't forget that Impact++ can scale dynamically
          // and can be resolution independent (see config)
          // and the Impact++ customizable loader
          // within which you can easily change the logos!

     // and whenever you create a new entity remember...
     // plain entities extend ig.EntityExtended
     var myEntityClass = ig.EntityExtended.extend({
         // entity settings go here
     // and in a similar vein...
     // characters entities extend ig.Character
     // creature entities extend ig.Creature
     // particles entities extend ig.Particle
     // player entities extend ig.Player
     // and so on (we've got lots of abstracts)

// for a basic tutorial
// check out the Jump n' Run example
// in the "examples/jumpnrun" directory
// or for a more advanced tutorial
// check out the SUPER COLLIDER! example
// in the "examples/supercollider" directory
// which includes almost every feature in Impact++!