• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Legacy GM Banner Location

J

JDSTIGER

Guest
I'm an idiot, how do I make it so my banner by AdMob is centered at the bottom of the screen no matter what the display size is..?
 

Andrey

Member
Maybe:
Code:
Social event:

var ident = ds_map_find_value(async_load, 'type');
var loaded = ds_map_find_value(async_load, 'loaded');
if(ident == 'banner_load')
{
    if(loaded)
    {
        banner_w = ds_map_find_value(async_load, 'width');
        banner_h = ds_map_find_value(async_load, 'height');

    banner_x = (display_get_width() - banner_w) / 2; // the horizontal center of the page
    banner_y = (display_get_height() - banner_h); // at the bottom of the page  
    GoogleMobileAds_MoveBanner(banner_x, banner_y);    
    }

}
 
J

JDSTIGER

Guest
Maybe:
Code:
Social event:

var ident = ds_map_find_value(async_load, 'type');
var loaded = ds_map_find_value(async_load, 'loaded');
if(ident == 'banner_load')
{
    if(loaded)
    {
        banner_w = ds_map_find_value(async_load, 'width');
        banner_h = ds_map_find_value(async_load, 'height');

    banner_x = (display_get_width() - banner_w) / 2; // the horizontal center of the page
    banner_y = (display_get_height() - banner_h); // at the bottom of the page 
    GoogleMobileAds_MoveBanner(banner_x, banner_y);   
    }

}
Its on the top left corner still :/
 

Andrey

Member
I took a snippet of the code, he works well.
Show your code then. Is not there accidentally overwriting the coordinates?
Banner you create 1 time?
 
T

thitz

Guest
Maybe:
Code:
    banner_x = (display_get_width() - banner_w) / 2; // the horizontal center of the page
    banner_y = (display_get_height() - banner_h); // at the bottom of the page 
    GoogleMobileAds_MoveBanner(banner_x, banner_y);

Can you help me how can I add the banner at the top instead of bottom? I've tried banner_y = (display_get_height() - banner_h)*2, *4, *6, *8 and it works but not for every phone.
 
J

JDSTIGER

Guest
I took a snippet of the code, he works well.
Show your code then. Is not there accidentally overwriting the coordinates?
Banner you create 1 time?

In create Event:
Code:
GoogleMobileAds_UseTestAds(true, "**********");   

global.bannerId = "ca-app-pub-******";
GoogleMobileAds_Init(global.bannerId);

GoogleMobileAds_AddBanner(global.bannerId, GoogleMobileAds_Banner);
 

Andrey

Member
The code run 1 time in Create.
Code:
GoogleMobileAds_Init("ca-app-pub-****/*****"); // application ID (!)
banner_id = "ca-app-pub-****/+++++"; // Ad banner ID (!)
GoogleMobileAds_AddBanner(banner_id, GoogleMobileAds_Banner);
GoogleMobileAds_MoveBanner(0, 0); // move banner to the zero position (for example).
Next, after receiving an asynchronous response, the banner will be moved to the right place (on position banner_x, banner_y).
 
J

JDSTIGER

Guest
The code run 1 time in Create.
Code:
GoogleMobileAds_Init("ca-app-pub-****/*****"); // application ID (!)
banner_id = "ca-app-pub-****/+++++"; // Ad banner ID (!)
GoogleMobileAds_AddBanner(banner_id, GoogleMobileAds_Banner);
GoogleMobileAds_MoveBanner(0, 0); // move banner to the zero position (for example).
Next, after receiving an asynchronous response, the banner will be moved to the right place (on position banner_x, banner_y).
I am doing exactly what you're saying It didnt work, I must be cursed or something wtf

Works like a charm! So simple! I cannot believe I didn't see this.

Thank you so MUCH for this help! ;)
How did it work for you and not me !?!?!?!?!?!?
 
T

thitz

Guest
I am doing exactly what you're saying It didnt work, I must be cursed or something wtf


How did it work for you and not me !?!?!?!?!?!?
Actually I'm not using ds_ events and assync.
I just 'stole' a few tips from Andrey and I'm using most of the demo from GMS.
 

Bingdom

Googledom
Are you changing rooms?
Try putting the obj_ad in all of the rooms.

I seem to have a bug sometimes that the ad does not move to a new position even if the object is persistent when the player quickly switches to a new room.
 
J

JDSTIGER

Guest
This is strange.
And what version of GMS, module GooplePlayService?
Make a test .gmx and available for download, I'll look at the code.
Are you changing rooms?
Try putting the obj_ad in all of the rooms.

I seem to have a bug sometimes that the ad does not move to a new position even if the object is persistent when the player quickly switches to a new room.
THANKS TO BOTH I FINALLY FIXED IT, The problem was the banner wasn't persistent.
 
Top