Location in game like an object with properties

0 favourites
  • 3 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hello!

    I need to do a simple game engine.

    It's something similar to text-based games.

    There is no relevant graphics here, but the story itself is important.

    The player moves between locations.

    After entering the the location, things happen:

    - messages about the given location are displayed

    - turned down the music that is played on the way to the location and volume up music for a particular location

    - at the end, the player gets a list of possibilities (he can go left, right, he can raise something, he can ask to tell the narrator about this area again, etc.)

    I thought that I would set the player on the board where the locations will be located. The view is from above.

    Everything will be symbolically represented as squares.

    If the user selects a move to location A then the player object will automatically go to that position. As soon as it reaches the goal, the game engine will start to check each condition individually.

    So the location should be an object composed of different properties:

    - what sound file for the background

    - the number of seconds passes between the music from the road and the one in the location

    - basic description

    - extended description

    - where to go (the other locations)

    - etc.

    I am asking for suggestions on how to do it.

    What should I use to create a location object?

    Maybe there are tutorials somewhere?

    I will be very grateful for every hint.

  • There are several ways to do this, depends on the complexity of the game and your programming skills.

    1. You can do this with variables and layouts. Each location will be a separate layout and you can add an invisible object (sprite) LocationInfo with a bunch of instance variables, which will contain all the data required for this location. So, when player goes to a new location, on start of the layout you read variables from LocationInfo sprite and change music, display messages etc.

    2. You can store all the data in one of several text files, which can be in XML, JSON, CSV or your own format. When changing location, read the file for this location and load the data from it. Take a look at this post to see how it can be done with XML. Also, check out the tutorials section:


    PS: Not all tutorials are good. This one demonstrates how text adventure games should not be made. Hard-coding everything in events is a bad practice and I don't recommend it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, hard-coding sucks.

    I need a simple engine that I will be able to develop,

    so thank you very much for the hints!

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