Windows Shop System & Downloadable Levels (PDF + Project Files)

Discussion in 'Tutorials' started by Alexx, Aug 15, 2019 at 8:04 PM.

  1. Alexx

    Alexx Member

    Joined:
    Jun 21, 2016
    Posts:
    411
    GM Version: 2.2.3.436
    Target Platform: Windows
    Download: https://www.learngamemakerstudio.com/download/weekly-1/

    Summary:
    A PDF & project files showing how to set up a simple shop system, and how to download levels from a website. Includes PDF explaining how to, along with code, example project files and resources.
    Cover of ebook:
    [​IMG] https://www.learngamemakerstudio.com/wp-content/uploads/2019/08/1-600.png

    Tutorials:
    This covers 2 topics - Shop System & Downloading a Level.

    Shop System:
    Lots of game genres make use of a shop system. This tutorial shows how to make a basic shop and inventory system.
    There are lots of ways of doing this, my method is basic and easy to understand.
    Includes screenshot:
    [​IMG]
    Formatted and Commented code:
    Code:
    /// @description Sell an item
    if global.items[my_id,3]>=1//check player has item to sell
    {
        global.items[my_id,3]-=1;//reduce item counnt
        global.cash+=global.items[my_id,4];//increase cash
    }
    
    Screenshot:
    [​IMG]

    Download Level From Website:
    Being able to easily add new levels for your player to have easy access to is always a good thing. This chapter shows you how to download a level from a website and add it to your game. Also includes a working version of Sokoban.

    An example like this could be used to download new levels every week giving some great variation to your game.

    and code with explanations:
    Code:
    /// @description Commence Download
    //Start async http get file
    file = http_get_file("https://www.learngamemakerstudio.com/levels/level.txt",working_directory +"level.txt");
    str[0]="";//initiate array
    done=false;//this will be used as a flag to detect if file is downloaded
    
    Screenshot:
    [​IMG]
     
    Last edited: Aug 16, 2019 at 12:27 AM

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice