GameSalad

make mini store.how ?

iraqiraqiraqiraq iraq baghdad , muslimPosts: 83

hello my brothers i want just make store(buy hero.update hero.change hero) in my game but how ? with table or another step ?
i will see some video in youtube but cant help me ! I need shortcuts steps :)

Comments

  • tatiangtatiang Posts: 10,716

    Are you wanting to use In-App Purchases? If so, there are video tutorials for that.

    If you just want a button in a Pause Scene that changes your hero's attribute values, it's as straightforward as:

    If touch is pressed
         Change Attribute game.heroStrength to game.heroStrength+15

  • iraqiraqiraqiraq iraq baghdad , muslimPosts: 83

    not for In-App Purchases.. i just need when player have1200 coin , he can buy hero cost 1200C like this https://s-media-cache-ak0.pinimg.com/236x/e7/4d/8d/e74d8d89f82ae547bf7be37817047b9d.jpg

  • tatiangtatiang Posts: 10,716

    Sure. So you would adjust the rule above as follows:

    If touch is pressed
         If game.playerMoney ≥ 1200
              Change Attribute game.heroStrength to game.heroStrength+15
              Change Attribute game.playerMoney to game.playerMoney-1200

  • Check out

  • iraqiraqiraqiraq iraq baghdad , muslimPosts: 83
    edited January 30

    thnx tatiang but what i use ? integer ? boolean ? real ?angle ? and whats mean (+15) ?
    and how i save the hero if the player buy one hero or two ? with table or another thing ? if you not busy can make for me demo file ?

  • iraqiraqiraqiraq iraq baghdad , muslimPosts: 83

    thnx
    rainwaterstudios but not worked

  • tatiangtatiang Posts: 10,716

    @iraqiraq said:
    thnx tatiang but what i use ? integer ? boolean ? real ?angle ? and whats mean (+15) ?
    and how i save the hero if the player buy one hero or two ? with table or another thing ? if you not busy can make for me demo file ?

    I don't have time to make a demo file, sorry. If you are storing whole number values, use an integer. The example I gave was just that you might want to increase the hero's strength (or other stats) by some amount.

    Saving can be done with attributes or tables. If you have more than a few attributes, I recommend using a table. There are good videos if you Google gamesalad save attribute or gamesalad save table.

  • CodeMonsterCodeMonster ACT, AustraliaPosts: 1,078
    edited February 1


    https://mediafire.com/?g51ycs07uo8g2p7

    I've attached a download link above for a quick demo i made for you with a bunch of notes to get you going. I didn't use tables in this demo, if you do plan on doing lots of upgrades and powerups with your shop, a table is the way to go. but for this case, I just made you one with some attributes. have a look, its not perfect as it was don't in a rush due to having limited free time, but hopefully it can help you out!

  • iraqiraqiraqiraq iraq baghdad , muslimPosts: 83

    @CodeMonster very thnx but i need know how i stop update the hero?example when he 80 . i need just player update to 300 and lock this number cant go to301 or more

  • iraqiraqiraqiraq iraq baghdad , muslimPosts: 83

    and how i change hero ? becuze you make hero change but no code in actor :(

  • tatiangtatiang Posts: 10,716

    @iraqiraq said:
    @CodeMonster very thnx but i need know how i stop update the hero?example when he 80 . i need just player update to 300 and lock this number cant go to301 or more

    If you are increasing an attribute value, use the minimum function to limit the value:

    Change Attribute self.speed to min(self.speed+50,300)

Sign In or Register to comment.