How to place an ad popup like scene in andengine - andengine

I want to start placing ads in my andengine game and an ad to appear just before my result display screen (for example fruit ninja). Since My result screen is a scene and not an activity, I want an ad to popup after my game play and just before results and on button click the ad disappears. I think there is a class called popupscene, but i am not sure if that is to be used. Can someone help?

I made an example using the GLES1 version of the engine:
https://github.com/zfoley/AndengineAdmobLayoutExample
The main thing is to use a LayoutGameActivity instead of a BaseGameActivity.
LayoutGame activity supports having additional views in addition to the GLSurfaceView.
Once you have that going, its pretty simple to implement the admob API or whatever ad service you are using. In my example I use admob.

Related

Struggling with Mobile build on phone, looking different on phone and Pc

Firstly I'm still fairly new to coding, saw people making games and fell in love with the idea of making your own game. So the past few months I've been learning unity tutorials and practicing basic games. I've come so far to be basically done with my first game. Everything is ready and I want to load and post it on playstore, but there's one last issue. When I run it on Unity on my pc it looks perfect but I loaded it onto my phone and the UI and some objects is either not showing or looking different than on the pc.Example1Example2Example3 These are examples of my problem. The IMG above is the way it should look like and the one underneath is how it shows on my phone when loaded.
It doesn´t look the same, due to the different resolutions.
Try to use a Canvas Scaler component. Set a reference resolution and the mode how you want to scale it.
If you want your UI elements to be anchored to the center/top/left etc. you should also set the anchor points. Here is a good Tutorial
A good way to instantly check the result is the "device simulator" It is a unity package
That's because of your Canvas settings & your UI GameObjects Anchor. But I think the easiest way to solve this for you - because you don't have that much experience about it - is to separate canvases for mobile & pc. This is the code:
private void Start()
{
if (Application.platform == RuntimePlatform.WindowsPlayer) // If your game's running on android
{
pcCanvas.SetActive(true); // Use PC designed canvas
mobileCanvas.SetActive(false); // Disable Mobile designed canvas
}
else // Your game is running on mobile
{
pcCanvas.SetActive(false);
mobileCanvas.SetActive(true);
}
}
Add this to a GameObject, Design 2 Canvases & assign them to script. (This will be a litte complicated, but will work) This link for more info
But if you want to use 1 canvas, you have to set its settings & its GameObjects anchors.

Project Solution | Architecture | Scenes and Views

Im new in Game Dev and new in development with Unity
(Come from Windows and Web development)
Now I want to make my first game. This will simple game (but with retrieve data from API etc.)
So I have some basic questions:
1) How to decide if I need to make new scene or build just make a lot canvases and switch between them?
In my game I see
1 scene - Loading
2 scene - Main screen with buttons--
1 button - open Store
2 button Open leaderborad
3 button - open something like map
etc...
Now I think
I need make 2 scenes - Loading and Game scene
In Game scene make some canvases
(MainState Canvas, Shop Canvas, MapCanvas, Leader board canvas etc...)
And when user clicks on button - show this canvas (its must be display like Popup)
2) If I want that map will grow up with more and more stop points (like in Candy Crush) - I need to set its to Assets Bundle and load new bundle ?
3) Best practices for Login/Authorization
I check many sites and I see that best practices for Game Authorization today - this is Google/Apple Game service and not Facebook. Right?
If I understand not correct - Can you guys give me a links what I need to read/learn ?
Thank you guys so much.
I suppose you are targeting mobiles.
1) On mobiles the decision is simple in this case. One simple scene, that is loading fast, to show your logo, game title etc. and the second scene to all other stuff. If the game has very complex levels you can start thinking about more scenes. (If it's simple and easy to change to next level, e.g change background, some enemies etc. like in your case I would use one scene)
2) Sorry I don't know what you want to achieve, but you can read about Asset Bundles here and in unity docs. Again it depends on the complexity of the project. For a simple game it may not be a big difference. Official unity video on Asset Bundles and about Bundle browser
3) I have no idea about Apple Game service so I will talk only about Google Services. It's really simple to setup. However some steps may be tricky, but take your time and try to setup everything as you need. The github page of google play games plugin for unity, where you can download the latest build of the plugin, contains a lot of information on how to configure it. Docs I mentioned above and some testing was enough to implement it in my games. However if you have troubles with setting it up there are a few videos on youtube when you can see how to configure it step by step. Also here is the site on which you can see how your code should look after implementing google play games

Interstitial Ads For Iphone Preload

I am trying to implement an interstitial ad for iPhone. My code currently works, but the ads are slow to appear (I know that I need to check if an ad is available). Is there a way to initiate iAd at start up, maybe in the appDelegate so that when my view appears the ad is ready?
Here is how my views are laid out.
Gameplay_View -> Score -> Ad -> Gameplay_View
Since I'm using three separate UIViews I'm not sure how to implement the Ad and have it load in a timely manner.
Thanks in advance!
I know there is a line of code available for ads to be preloaded, i haven't managed to try it out yet but if your curious here it is.
This is how i declared my Interstitial Ad (Just as a reference since the line of code uses the name).
var interstitialAd:ADInterstitialAd!
When the game has ended have this line of code and it is 'meant' to preload the interstitial ads for the current view controller (I say again i have not tested this to see if it works, this is just if your curious).
UIViewController.prepareInterstitialAds()

does cocoalibspotify play "nice" with the built in Iphone media player?

once again I'm here with my daily question regarding Spotify...
So, in my app, I want to have the option of the user being able to either play music from Spotify or to play music from their own IPhone media library. However, since I added the Spotify framework, whenever I am testing my app and try to load a scene that has anything to do with the MediaPicker (whether it has a link to a view controller with the media picker or if the view controller for the scene selected has media picker code inside of it) I get the following error (the redacted stuff in the error is just the name of my app)
screenshot
So my question is, can I have both Spotify and the IPod functionality inside of my app? Or is it one or the other?
Yes, of course you can. However, your screenshot has the stack trace on the left hidden, and you need to set a breakpoint to break on exceptions. As far as the log goes, it doesn't look like it's anything to do with either CocoaLibSpotify or MediaPicker.

iphone MultiTasking?

Hello I'm trying to get the multitasking work properly, but unfortunately I'm kinda lost. My problem is when I re-enter the game, it takes several seconds for the game to come back and show the pause screen. My question is; is there any way to put some sort of loading screen until the game comes back, so I can at least indicate that its not frozen? I've never used Xcode directly. I'm using Unity 3d to build my game. I made a little bit of research and if I'm not mistaken I'm supposed to use "applicationDidEnterBackground" app delegate method. My question is How can I put a custom loading screen using that method in Xcode?
Thanks
In -applicationDidEnterBackground:, you're given the opportunity to "clean up" the UI before the screenshot is taken. Apple says you should remove "sensitive data" (the screenshots might be persisted to "disk"?), but it also lets you do other things. In one app, we hide the label on a countdown timer so it doesn't appear to jump when you switch back to the app.
To change the "loading screen", simply display a full-screen view over the other views and remove it in -applicationWillEnterForeground:. Alternatively, pause the game in the first place!
(Really, you should be pausing the game in -applicationWillResignActive: which happens when the user double-taps home or the user receives a SMS/notification. I'm pretty sure it's called when the app is backgrounded, too.)