0 votes

Hello guys. I have this issue:

First of all i have a singleton variable:

    extends Node

    var admob = null

The name of the script of singleton variable is: ad.

Also, i have a main scene named World that with my basic game code i have in this script of the World's Node and the following part of code:

var isReal = false
var isTop = true
var adBannerId = "ca-app-pub-3940256099942544/6300978111" 
var debug = null
var isbieunguloaded = false
var istrunggianloaded = false

func _ready():
    if(Engine.has_singleton("AdMob")):
        ad.admob = Engine.get_singleton("AdMob")
        ad.admob.init(isReal, get_instance_id())
        loadBanner()
    debug = get_node("Pause")
    get_tree().connect("screen_resized", self, "onResize")

func loadBanner():
    if ad.admob != null:
        ad.admob.loadBanner(adBannerId, isTop)

func _on_admob_network_error():
    debug.text = "Network Error"
    if(Engine.has_singleton("AdMob")):
        ad.admob = Engine.get_singleton("AdMob")
        ad.admob.init(isReal, get_instance_id())
        loadBanner()

func _on_admob_ad_loaded():
    get_node("Pause").set_disabled(false)

func onResize():
    if ad.admob != null:
        ad.admob.resize()

################################ PAUSE BUTTON:
func _on_Pause_pressed():
    if ad.admob == null:
        ad.admob.showBanner()
    get_tree().paused=not get_tree().paused
    $PauseScene.show()
    pass 

When someone press the Pause button, then he can see the Pause scene. The Pause scene has 3 buttons: 1) Resume, 2) Again and 3)Quit. The code parts of Resume and Again buttons are the followings:

func _on_Again_pressed():
    if ad.mob !=null:
        ad.admob.hideBanner()
....
....
...
...

func _on_Resume_pressed():
    if ad.mob !=null:
        ad.admob.hideBanner()
...
...
...
...

The point is that when i export my game on my adnroid device then i can see the banner all the time during the gameplay. I want seeing the banner when i press the Pause button and hide the banner when i press the Resume or the Again button. What's the wrong here?

Thank you in advance.

asked Jul 19 in Projects by Nick888 (191 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.