Messaging C2 from IOS using Objective-c / passing variables

Get help using Construct 2

Post » Tue Jun 17, 2014 11:43 pm

I am running into an issue which is explained in another post:
viewtopic.php?t=108372

Basically I want to pause a game when an iAd is triggered / touched.
I believe a possible solution is to set a variable (for example: "AdActive") from objective-C when the banner is touched, that C2 can read as a condition.

The code itself within Objective-C is:

- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{
NSLog(@"Banner view is beginning an ad action");
BOOL shouldExecuteAction = YES;
if (!willLeave && shouldExecuteAction)
{
// stop all interactive processes in the app
// ;
// ;
}
return shouldExecuteAction;
}

- (void)bannerViewActionDidFinish:(ADBannerView *)banner
{
// resume everything you've stopped
// ;
// ;
}

But I cannot figure out what kind of variable I can set or how, that could be later read by C2..
Any ideas, any Objective C and C2 gurus?
B
10
S
4
G
1
Posts: 20
Reputation: 1,354

Post » Wed Jun 18, 2014 1:07 am

Is the game running inside Ejecta or Webkit ?
For ejecta you would have to first bridge Obj-C with Javascript: http://impactjs.com/ejecta/extending-ejecta
Then you need a bridge from Javascript to C2 objects. One solution would be creating a custom plugin:
https://www.scirra.com/manual/15/sdk
B
12
S
3
G
3
Posts: 73
Reputation: 2,647

Post » Wed Jun 18, 2014 1:16 am

Cross_,
Thank you for your answer.
I need to try this now!
And it is Ejecta!
I am sure it will take me some time to figure it out!
Thank again!
B
10
S
4
G
1
Posts: 20
Reputation: 1,354


Return to How do I....?

Who is online

Users browsing this forum: Euduardo, Kin, mikehive, ratboy3, tinhofiel, YoHoho and 43 guests