Jump to content

Can you give this ads test a try?


Recommended Posts

I made a modification to my ads code and I will be very appreciative if some of you could give it a try. What I'm trying to achieve is a persistent banner at the bottom of the game that refreshes from time to time. I am especially interested on the banner not showing at all on i-devices of low resolution because it ends up on the way of game elements. So it should be hidden on anything i-device 4 or 4th generation. I tried to keep 5 and 5th gen in and the ipads of course. The banner should also be of varying sizes depending on the device.


This are leadbolt ads and will only work on mobile devices.


Please give it a test and let me know your results on what device. I'll be happy to help you in anyway I can.





Thanks in advance!

Link to comment
Share on other sites

It is normal for the bottom portion to be cut off. That is because of the way the scaling works. That is why I want no ads to be shown on safari since they will be on top of the tool bar and on the way of game elements. The way i am trying to do it is, after initializing the ads check for ios and safari and then hide the ads if true. This is what my code looks like:


if(os_type == os_ios && browser_height <=960) { if(os_browser==browser_safari || os_browser==browser_safari_mobile) { leadbolt_hide_banner(); }}

Why is that not working? Maybe this functions are not meant for what I am using them?

Link to comment
Share on other sites

I think you do it wrong.


1. browser_height does not return 960 on iPod/iPhone 4g as you expect because of DPI.

2. You should not check type of os or browser because this is completely irrelevant.


As I told you before. You should calculate height of your game graphic and than check if the banner Y is lower or higher. If it is lower you can hide it or move it.


You know this:

1. height of your internal resolution - it's 480 pixels (GAME_RES_HEIGHT)

2. height of your game elements - it's somethink like 416 (GAME_ELEMENTS_HEIGHT)

3. Y position of the banner (bannerY)

4. height of your output resolution - I think you can use room_height for that - this depends on how your scaling method works. I don't have your source code anymore, look how I calculate the Y position of the banner, something like: bannerY = XXX - bannerH; (XXX is height of your output resolution)


so now you can do something like this:


var isBannerHidden = false;

if (output_height < GAME_RES_HEIGHT)
// You never use smaller output resolution than 480 - at least I think so
isBannerHidden = true;
var scale = output_height / internal_height;

if (GAME_ELEMENTS * scale > bannerY)
isBannerHidden = true;

if (isBannerHidden)

Link to comment
Share on other sites

Looks great in portrait on my iPhone 5S...but when you turn the phone to the side the ad is placed badly.


That's awesome! I know the ad will be in the way on landscape, but that's just covering a message to turn the device. Maybe I can hide the banner while on landscape too but I really don't care enough to trouble myself with it. I could also change the graphic of my message to be a long banner and place it near the top so the banner wont cover it. Thanks for testing.



You should calculate height of your game graphic and than check if the banner Y is lower or higher. If it is lower you can hide it or move it.


Yeah, I was just trying the easy way out like always. i will try to implement this. Thanks for coming all the way here to help me, i really didn't want to bother you with another email :) 


I will post a new version soon.

Link to comment
Share on other sites

Yes, thanks to NokFrt who customized my ads code it is now super awesome. I get to show a persistent ad on the bottom of my game whenever there is enough room for it + I can manually place them on key points without affecting the persistent ones. It was a lot of work (for him) but they work out beautifully now. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...