0 votes

In the script of MENU scene of my game i have the following code:

extends Control

onready var m=get_parent().get_node("Menu") 

var admob = null
var real_ads = false
var banner_top = false
var ad_banner_id = "ca-app-pub-3940256099942544/6300978111"
var enable_ads = true

func _ready():
    if Engine.has_singleton("AdMob"):
        admob = Engine.get_singleton("AdMob")
        admob.init(real_ads, get_instance_id())
        admob.loadBanner(ad_banner_id, banner_top)

func show_ad_banner():
    if admob and enable_ads:

func hide_ad_banner():
    if admob:

func _on_NG_pressed():

So , when i start my game i see a banner on Menu scene and when i press the NG (New Game) button the banner is disappeared. So far all ok.

When i press the NG button the game starts with the gameplay scene (World). In the World scene i have a pause button and when i press it then opens a Pause scene.In the World tree i have as a child and the PauseScene with the following code:

extends Control

onready var l=get_parent().get_node("PauseScene") 

var admob2 = null
var real_ads2 = false
var banner_top2 = false
var ad_banner_id2 = "ca-app-pub-3940256099942544/6300978111"
var enable_ads2 = true

func _ready():
    if Engine.has_singleton("AdMob"):
        admob2 = Engine.get_singleton("AdMob")
        admob2.init(real_ads2, get_instance_id())
        admob2.loadBanner(ad_banner_id2, banner_top2)

func show_ad_banner2():
    if admob2 and enable_ads2:

func hide_ad_banner2():
    if admob2:

func _on_Quit_pressed():

func _on_Resume_pressed():
    get_tree().paused=not get_tree().paused
    visible= not visible

func _on_Again_pressed():

The problem is the following:

When the game starts, the banner after a while shows up again during the gameplay and disappears when i press only the resume button of Pause scene.
Also, while i want when someoene press the PauseButton to appear a banner, the banner doesnt appears.Instead, the banner appearing when i press the Again button
and disappears when i press the resume button of Pause scene.

Any idea please?
Thank you.

asked Jul 20, 2019 in Projects by Nick888 (216 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.