weathertopper / json-as-a-game

0 stars 0 forks source link

JaaG (JSON as a Game)

Instead of building a Résumé-as-a-Game (as I originally planned), I will take the easier route and build a full-out side-scroller game 'engine'.

I say 'engine'... but that's a little strong. I will define a list of possibilities, actions, roles, etc. Then, a game can be created with nothing but a JSON configuration file (a BIG configuration file).

How to Run

game_config.js

I will keep the game_config.js template here for reference.

let game_config = {
  'hero': `{game_object}`,
  'playing_level': str,
  'frame_rate': num,
  'movement': {
    'actions' : { 
      'left' : num,  
      'right': num,
      'jet'  : num,
      'jump' : num,
      'duck' : num,
      'shoot': num
    },
    'jet' : {
      'start_vel' : num,
      'delta_factor': num, // not currently used
      'vel_cap': num,
      'timeout': num
    },
    'jump' : {
      'start_vel' : num,
      'delta_factor': num,
      'vel_cap': num,
      'timeout': num
    },
    'apex' : {
      'frame_count' : num,
      'timeout': num
    }, 
    'fall' : {
      'start_vel' : num,
      'delta_factor': num,
      'vel_cap': num,
      'timeout': num
    },
    'x_interval' : num
  },
  'levels' : {
    '{level_id}' : {
      'objects' : {
        'background' : {
          '{game_object_id}': '{game_object}',
          '{game_object_id}': '{game_object}',
          ...
        },
        'arena' : {
          '{game_object_id}': '{game_object}',
          '{game_object_id}': '{game_object}',
          ...
        }
      }
    },
    ...
  }
}

game_config Notes

game_object Notes

Possible Attributes

CONSTANTS

The object CONSTANTS will have a set of values usable in game_config. CONSTANTS is as follows:

Mutator Methods

getConfig(...args)

returns attribute value found at game_config[args[0]][args[1]]...[args[n]]

setConfig(updated_val, ...args)

sets updated_val at game_config[args[0]][args[1]]...[args[n]]

README UPDATES TO MAKE: