Skip to content

Level Builder Design

smeye584 edited this page Apr 9, 2022 · 17 revisions

The Level building implements a model/view design with a binary format for a save file. the View portion includes classes that represent custom ImageViews and Panes, and the Model portion contains classes such as a singleton class that manages the model, a current level data cache, a custom save-loader class, and any classes related to objects within the level.

The Level builder will allow the user to define object, entity, and item locations either specifically or randomly, to specify the screen background, and to place the player. It will also the user to specify any entrances to other levels, or place bosses. Depending on how the game develops, the ability to define the spawn state of certain enemies will be added as well, which can include a multitude of functions.

The primary model classes include:

Current Save File Design:

Level global data
Screens
  String ID ("0,0,0")
  Background
  Items
    coords
  Entities
    coords 
  randomlyPlaced
  Object
    coords
  Misc

Example Code:

//LevelName.dat
     - [String] "lvldata": //this part depends on what the lvldata will need to store
          - [int] 15 //number of levels or something
          - null
     - [String] "screens":
        - [String] "0,0,0":
           -[String] "background":
           -[String] "items":
              -[String] mcguffin:
                 [double] 1.0
                 [double] 5.3
              - null
           - [String] "objects":
              - [repeat]
              - null
           - blahb
           - [String] "randoms":
             - [String] "objects":
               - blah 
             - null
           - null[?]
       - [String] "1,0,0":
           - blah
       - null
     - null

Clone this wiki locally