Money system and end level.

This forum is currently in read-only mode.
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • OK cool, that gives me enough information to give you some direction, at least to get started.

    Keep in mind I tend to take a very practical approach to things since I am terrible at maths... so I'm sure there are better ways of going about this, but, this should work just as good.

    Lets assume you are making an inventory that can hold 5 things, and it's a menu/quick bar somewhere on the screen.

    The first thing you will need is a global value to indicate the amount of free spots in the inventory, so in this case 5. Make a global value called "inventory" or something like that, and at the start of the layout set the number to 5, so you have 5 free spaces.

    Next, make each square of your inventory as a sprite object. You should be able to make just one object and copy+paste the rest. Each of these objects will need a private variable called something like "item", and the values will need to be set to 0 (0 for no item, 1 for item is in that spot). Again at the start of the layout set all the private variables for each box to 0.

    Now, you will obviously need some icons for your items so you can see them in the inventory when you pick them up etc. Once you have these, and have some items to collect...

    When you collect an item, compare the global value "inventory" and make sure that it is at least 1 or greater. If it is 1 or greater, then minus 1 from that value, then pick one of the inventory boxes, and compare the private value "item" and make sure that it is equal to 0. Make that value 1, then set the icon for the item type to the x.y of the inventory object.

    It is a very basic way to make an inventory system, but it should work pretty well, especially since you don't seem to require any crazy dynamic inventory sorting system.

    Basically see if that information helps... if not then I'll try to make something simple to give you the idea, but I haven't got a lot of time lately since I have been really busy at work etc. Christams is coming and we are starting to pick up in the shop already.

    Hope that helps a little at least.


  • That really helps =)

    One thing though is that when i try to add the condition 'Inventory' greater than 0, it keeps changing 'Inventory' to 'Money'.

    Is this common?

  • That really helps =)

    One thing though is that when i try to add the condition 'Inventory' greater than 0, it keeps changing 'Inventory' to 'Money'.

    Is this common?

    Not exactly sure what you mean by this?

    Each variable is seperate... do you mean the variable "money" is getting the value for the variable "inventory"?

    Maybe post your .cap or something if you can't figure it out, then I can take a look at it.


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What i mean is, when i try to say 'inventory' it automatically changes to 'money'

    PS: This isn't with the final sprites yet, i have a lot of work to do. At the moment I'm trying to make the engine.

    The problem occurs on the shop page, event # 5

    It says 'Money' greater or equal 1

    I want it to say 'Inventory' greater or equal 1

  • Change

    'Inventory'[/code:3c34awed] to [code:3c34awed]global('Inventory')[/code:3c34awed]
    I think that fixes it...
  • btw why are you changing layout to tell some1 "not enough cash" you could just make a big sprite which is always sent to front (or a top layer) and make that visible when you need it

    ( this will prevent the app from having to load the original layout which may take some time)

  • I'm not...

    I have text that starts invisible, then turns visible.

    Maybe it's a glitch.

    And the Global 'Inventory' didn't work, it still changes to inventory.


    And also, if i have 150 money, and i buy a rock for 100 it says i'm too poor.

    Is there a way for it to compare the value before, not after, so it won't say i'm too poor, because it's looking at my $50 after i buy it, not my 150 before.

  • And the Global 'Inventory' didn't work, it still changes to inventory.

    Wait, I thought thats what you wanted?

    To change

    'Money' Greater or equal 1[/code:us95rkxj] to [code:us95rkxj]'Inventory' Greater or equal 1[/code:us95rkxj]
    For me this does what you want [code:us95rkxj]global('Inventory') Greater or equal 1[/code:us95rkxj]
  • Thankyou, it seems as if i was adding an extra space, which was screwing it up =)

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