In App Purchasing Question
allc1865
Member, PRO Posts: 777
Hello, everyone!
I have a question about in app purchasing. I was watching GSHelper's tutorials on it and he was using integers in his table for coins, but I'm using upgrades for bullets, so I was wondering how to make it so when you buy the upgrade, it switches to the bullet you just bought.
What I have is When touch is pressed > in app purchase item rules > change attribute to the weapon you want to buy. But that doesn't work because when you touch the button, it changes the attribute whether you buy it or not, which I can't have.
Any help would be appreciated. Thanks!
I have a question about in app purchasing. I was watching GSHelper's tutorials on it and he was using integers in his table for coins, but I'm using upgrades for bullets, so I was wondering how to make it so when you buy the upgrade, it switches to the bullet you just bought.
What I have is When touch is pressed > in app purchase item rules > change attribute to the weapon you want to buy. But that doesn't work because when you touch the button, it changes the attribute whether you buy it or not, which I can't have.
Any help would be appreciated. Thanks!
Best Answers
-
grimmagelol Posts: 18Did u change in your main character when attribute =1 0r whatever the # your upgrade is to spawn the bullet of that upgrade? I'm making a game like this also
:P just without the shop. It should work the same even tho i havn't tried to make the tables yet iv been testing with a actor 10x10 pixels which i called power up which should work the same as a point on a table.
What i did was when the actor Power up collides with main Player to change attribute to 1.
In the rule where u put the fire button = space.
I made rules Under the do section for each power up. Rule is attribute = 1 . Under the do section add a timer which will spawn your bullet at a certain speed. Spawn an actor in the timer. I put Spawn level.2 Lazer bullet.
So after u pick up the power up your main bullet turns to lv.2 bullet.
It should work the same way with the table and a shop. When the player has enough $ and touches the power up in the shop change attribute to 1. Then minus his score/Cash.
When u die change power up back to 0 so u can regain your power ups from shop/Colliding with a upgrade.
I hope this helps It might not but at least i tried to answer -
j75 Posts: 235Forget about the tables. Use an attribute instead.
The tables work great for coins because of the numerous changing values, but not needed for a simple iap such as yours.
You only need a boolean attribute which has two options, true or false.
-True will equal upgraded weapon
-False will equal stock weapon
Do you see what I mean? You don't need tables and certainly not an integer. Just an on or off.
Answers
The GSHelper video was on coins and they were using integers. The table that's used says, Product ID: coins_100 > Amount: 100.
I'm not sure how to turn the amount 100 to reference my weapon upgrade instead of a number.
Try using a boolean attribute instead of a table.
if IAP is paid ... change attribute NewBullet to true
when gun trigger pressed
if New.Bullet is true ... shoot new bullets
otherwise shoot normal bullets
I'm new to this so don't quote me here
Drag the IAP behavior into your project.
You will see that it has a "Change Attribute" function.
Basically it would be like this.
When IAP is purchased, Change Attribute game.newbullets to true -- then save attribute
When the gun/firing actor is loaded, it will check game.bullets to see if it is true or false.
If true, it will shoot your custom bullets, if false, it will shoot normally.
Is this what you're talking about?
Thanks for your reply. I'm trying to understand
Thanks.
When you create an IAP on ItunesConnect you have to make a product ID. This can be named anything like, "custom_bullets_iap" etc.
Basically the line in your picture will have that name/ID in it. This line tells the game what IAP to buy.
If you had laser beams as an IAP, that product ID could be called "laser_bullets" and that would be your IAP Product ID.
Video Part #1
Video Part #2
Right. That's what I have set up and everything. But, the video I watched has coins and the integer in the table is equaled to 100. I'm trying to change that 100 to my actual weapon upgrade because I'm not using coins I'm using images. That's what I'm having trouble with.