Hey guys... it's me again :/ Sorry for these question spams, but i've been working on this project for a long time and every issue i've had i've written down and said to myself that once the main part is done i'd check and fix those issues, and there's almost none left!
So here's the deal: When you Fetch products from CocoonJS do you fetch the product on start of game or on start of layout(level)?
Here's an example to clarify: You're playing a shooter game and you run out of ammo so you go to the shop to buy ammo. Do you fetch the"ammo" product each time the layout (level)starts (which is many many times since you die a lot) or can you do a single fetch of the product "ammo" at the start of the game?
If it was a normal separate layout that started only once i'd do what i've always done and thats fetch on start of layout, but on a level layout that is bound to restart many times fetching each time the layout restarts seems quite wasteful of the user's resources, or does it not make a difference
Yeah hope this made some sort of sense lol, i can give more examples if you guys want
I'm not sure what you mean by fetching..
Do you mean setting the global variable?
look at this image i took from a tutorial here on the forums:
https ://www.scirra . com/ images/articles/events_6.png
Here's what it says for those of you that are lazy to copy and paste:
On start of layout CocoonJS Fetch those products from store "productname"
Now put it this way, if it's a layout of a level where you die a lot (like flappy bird) the layout will restart every 10/20 seconds so is it a good idea to fetch the products each time the layout starts or can you fetch them once at game load (very first layout/main screen load)?
Why would you fetch them again after setting the global variable?
Would it make a difference?
I have no idea that's why im asking
Im afraid that if i set the "fetch product" to start of layout of the level that every time the player dies it will restart the layout and fetch the products which would waste resources and wouldn't be very efficient
What im asking is if fetching the product once (let's say at start of main screen layout) is okay and wont cause trouble, otherwise i'd fetch it every time the level layout restarts if that wont make a difference in performance
If there is no reason to fetch the product more than once, why do it?
What benefit will fetching the product a second time have?
i really dont know.. that's why im asking! lol
Ok guys so this is what i did, since i couldn't figure something else at all:
Instead of fetching the products on each start of layout the best thing would be to fetch the products only when, for example, the player is close/near the shop zone-area that way it wont fetch every single time the player dies but only when the player is in need of the shop(and that's when he's close to it)!
As far as my understanding goes this should fix the possible repetition issue but i'd still like to know if fetching a product once, at start of game for example, would have the same results as fetching it at the start of every layout :/
Develop games in your browser. Powerful, performant & highly capable.
Let me clear your doubts:
1) Fetching of a product should be done in the same event sheet that is used to 'purchase' that product.
2) Fetching can be done at any point in time before the user could buy. For example: On start of layout, or even "On Purchase button pressed". But in this case, you should also use "is Fetched" then Purchase.
3) Only the last fetched product is purchased. So if you have multiple products, make sure you fetch each product with separate "On Button pressed" events before buying the corresponding product. It will not make sense to fetch all products together On start of layout, since only the last fetched product will be 'ready to be bought'.
Hope this helps
Hey hasan thanks for the reply !
I have fixed everything now! Any ideas on how to test if these babies actually work.. without money?
EDIT: just wanted to ask if Preloading Ads (banner/fullscreen) at the start of each layout is a bad idea as well?
(i preload ad on start of layout then show it then on close of layout i hide it and redo that eveytime the layout changes to another one)