How do I load game levels dynamically?

0 favourites
  • 8 posts
From the Asset Store
LevelsManager is a Construct 2 & 3 plugin to manage your worlds and levels easily
  • I am creating a game where number of levels can be unlimited. In order to do so, I decided to have a solid introduction and an ending. The levels in between would be loaded with javascript. If a new level is developed, all that's needed is to load a new .js file like so

    <script type="text/javascript" src="game_start.js"></script>

    <script type="text/javascript" src="level_1.js"></script>

    <script type="text/javascript" src="level_2.js"></script>

    <script type="text/javascript" src="level_3.js"></script>


    <script type="text/javascript" src="game_end.js"></script>

    So how can I do that?

  • You can't, you have to keep everything inside Construct 2. However, you can add a new level in Construct 2 and export and upload the project again, and it will download and use the new version of the game with the update. You can read more about detecting updates in the tutorial on offline support.

  • You could either create all the layouts (levels) and then use an event to only use a selection of them

    Or (if you havn't built it all already) you could use a tile based map where you generate the maps using an array and then read that array from a txt file or something using AJAX or CallJS- more about this in the How to forum post

  • Thanks a lot guys! Seems like a lengthy approach, I'd rather stick with creating all the levels inside Construct 2. Afterall it's a job security, right?! :)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ashley and All, Good to know this.

  • jwjb - FYI This is an old thread and it's now out of date. New features in Construct 2 give you more options. See this tutorial for some tips.

  • jwjb: this is an old thread.

    Since lots of features have been added.

    You can load JSON datas in arrays for example through AJAX. (check the manual)

    You can also have Project files included with the exported application.

    Edit: Hahaha ninja'd by Ash :D

  • Ashley, Very cool and thanks for pointing me in the right direction with the link and all.

    Kyatric, Same goes for you, thanks again.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)