playMaker

Author Topic: In-game shop with ArrayMaker?  (Read 1405 times)

Pixel Witch

  • Playmaker Newbie
  • *
  • Posts: 1
In-game shop with ArrayMaker?
« on: February 06, 2016, 02:51:29 PM »
Hello!

I'm doing a simple endless runner game and I'm trying to create a shop where the player can buy skins for main character using in-game money. So far everything worked well, but that's because I had separate fsm on every button. Currently I only have 3 skins but if I want to add more it is probably a very bad idea to manually add fsm to each new one and I understand that I should make it more automatic...

I found this topic here: http://hutonggames.com/playmakerforum/index.php?topic=2948.0 but sadly those tips are not enough for me... I'm mainly a graphic artist ;)

So yeah, I understand the basic concept of keeping everything in arrays but I have no idea how to make it work using Playmaker. I already have ArrayMaker, I created 3 arrays - one with stored objects, one with prices and one for boolean (is it bought or not). I tried to create a loop that would compare price of the current object with the global money var and check if the item is bought but I have no idea what to do next.

Oh, and I'm using UI buttons for changing skins - will they even work with arrays?

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: In-game shop with ArrayMaker?
« Reply #1 on: February 06, 2016, 08:22:47 PM »
To do an inventory system like this- you'd want to use an array to hold the names(keys) of the items- you'd want to use hash tables to actually hold the data (textures, bools, game objects etc)

Hash tables hold a key(name) and a value (variable)- you store different things in different hash tables like one for textures for your ui, one with game objects, one for bools etc

You access the data by using the key- its a little difficult to understand at first but very simple once you get it-

Arraymaker calls them "hash tables" but if you want to learn more via google they are called "Dictionaries" most of the time in game dev
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!