Scene resetting after leaving and coming back

robex50robex50 Posts: 7Member

So i am creating a game where you have shop and the actual game play so i noticed when i went to shop and purchased something and went out and came back and i was able to purchase it again (i made it so you can buy it only once) so is there way to fix this so the player can only purchase the item once and it wont reset when i leave the shop and come back


  • IceboxIcebox Posts: 1,478Member, PRO

    I think your doing it through a self attribute , instead do it as a game attribute so for example

    Create game attribute call it item1 make it a boolean

    if game.item1 is false
    change attribute self.color alpha to 1 ( optional if not purchased the alpha is 1 )
    Rule inside
    [if Touch is pressed
    Purchase item1
    After 0.1 seconds
    change attribute game.item1 to true]
    change attibute self.color to 0.3 (This is optional if purchased- it will become transparent so the user knows he cant buy it)

    then save it in another rule ( the reason you put the save in another rule is because once game.item1 becomes true the rule above wont trigger so just to make sure)

    if game.item1 is true
    save attribute game.item1

    If you have multiple items , use tables instead.

  • robex50robex50 Posts: 7Member

    there are multiple items in my shop. i used to make actors what trigger the and make the buying actions to destroy themselves after the purchase is complete. i was just looking is there way to keep scene as it was before leaving it.

  • IceboxIcebox Posts: 1,478Member, PRO

    Here is a demo , hope it helps

  • robex50robex50 Posts: 7Member

    @Icebox that looks great thanks a lot i will check that out tomorrow

Sign In or Register to comment.