How do I show an ad every X number of deaths

Get help using Construct 2

Post » Mon Dec 26, 2016 9:28 pm

For example If the player dies 7 times,an ad pops up and when you press back,the game continues.Player dies 7 times again,ad shows up and so on.
B
10
S
1
Posts: 18
Reputation: 555

Post » Mon Dec 26, 2016 9:55 pm

use a variable
variableDieCount = 0

now each time the player die add 1 to variableDieCount
Player die - - System add 1 to variableDieCount

now the magic
System if variableDieCount = 7 - - Appdeal (your add pluging) show Ads
syetem set variableDieCount to 0


sign up for Appodeal Ads networt Here
http://appodeal.com/+702cce69791d2fb67f4a39d2464ee1a7

and the tutorial here
https://www.scirra.com/tutorials/4979/a ... onstruct-2

hope this help
Image
B
42
S
13
G
2
Posts: 329
Reputation: 4,085

Post » Mon Dec 26, 2016 11:20 pm

You can also use modulus to test for this, without having to set your deathcount back to 0.

on player death ≫ add 1 to player.deathCount
    if player.deathCount % 7 = 0
        [show ad]

Edit: Modulus gets the remainder after a division;
5 % 3 = 2
9 % 6 = 3
B
42
S
14
G
3
Posts: 165
Reputation: 5,115


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 8 guests