Buying items with game points (Question!!)

dbsrb43

  • Posts: 2
how can i buy certain items with the "game points" and use it for buying items and put them on to the character?? Or apply some kinda skills
Haven't seen any of these techniques.

Nomosoft

  • Posts: 122
One way would be to make a behavior for each skill, attach them to your player character and disable them. Then, when the player buys or unlocks that skill, just enable it using the "enable behavior" block.

Another way is to have a simple "if" check around all the skills. So, "if (double_jump == true) { double jump code, here; }"

As for the store, itself, you can just use a bunch of Actors as buttons. When the player clicks on a button, that button has a behavior that deducts points from the player's score and enables the skill he just bought.

ipe 369

  • Posts: 1001
Another way is game attributes, but i think nomosoft's way would be cleaner :P game attributes would be useful if you wanted multiple things to happen upon buying it, spread across multiple behaviours that you didnt want to disable:)

Kiki123987

  • Posts: 29
But game attributes would be very useful if you want the player to be able to save the game, wouldn't it?

ipe 369

  • Posts: 1001

Innes

  • *
  • Posts: 1961
You could put your 'purchased' game items in a list, and iterate through the list to see if they are available at runtime.

Again, this would enable you to save the game as your list would already contain all the successfully purchased items.

To take it one step further, you could nest lists to make a 'three-dimensional' list (a list in a list, also known as an array) which could store all the available items in one 'column', and the other 'column' could contain a flag to specify whether or not the item had been purchased.

If you don't fancy trying nested lists, you could have two separate lists; one for the items, and one for the 'purchased' flag, and then you could cross-reference them to see which items had been purchased.
Visit www.TheStencylBook.com - the only published book for learning Stencyl.