Colludium's Forum Posts

  • OK,

    I have reached the limit of my understanding (it didn't take very long).

    I am looking to add a share feature to one of my apps - currently available on Android and iOS and compiled using Phonegap. I know, Phonegap is so yesterday - but I haven't been able to get Ejecta to work with it yet and Crosswalk offers way too massive a file size (and is android only). So far I have successfully implemented a Browser URL redirection in CocoonJS so the user can go to a Facebook or Twitter link to share some game info - which is great and a reasonable backstop position. However, for this small app the CocoonJS wrapper isn't ideal because of the dreaded splash screen and the long list of permissions.

    Unfortunately, when I use the go to URL browser command in Phonegap, the app creates a browser window within itself and I have not found a way to open the default mobile browser instead (my understanding of this InAppBrowser Plugin is that it's just to enable the creation of a browser within the app, rather than to open the system default browser - I could be wrong!). Not good..

    I have found this Phonegap Social Sharing Plugin that works on the Build service. My understanding is that when it's called it will open a default share function and give the user the option of picking which means of sharing they wish to use depending on the apps and linking profiles available - like Facebook, Twitter, email, text etc - and it sounds like it might be perfect for my needs.

    So, my questions to you, dear community, are:

    1. Is what I'm hoping for here even possible - can I call this plugin by executing some JavaScript through the Browser object?

    2. If the answer to 1 is yes, does anyone have any advice on how I should call this function (aside from spending the next 2 years trying to learn JS!!)? I'm guessing that I will need to add a function that will be called from the Browser object (in the index.html file or somewhere else?) and then that will subsequently call the Phonegap Plugin.

    If you are a JavaScript expert, please accept my apologies for my ignorance!

  • Try this:

    Let's assume you want to rotate an object "Stick".

    Give Stick a boolean: Stick.Rotating and set it to false.

    Declare variable Stick.Rot_Time = x (where x is the time you want the stick to take to rotate 360 degrees).

    Declare Stick.Start_Angle = Stick.Angle (the starting angle, in case it's not zero).

    Then, when you want to rotate the Stick, set Stick.Rotating = True and use the following code:

    If Stick.Rotating = True:
    

    Trigger once: Set Stick.Start_Angle to Stick_Angle

    Set Stick.Angle to Stick.Angle + (360 * dt / Stick.Rot_Time) -- this will rotate clockwise, use a minus to rotate anti-clockwise

    If Stick.Angle is within 2 degrees of Stick.Start_angle -- this stops the stick at 1 rotation**

    > Set Stick.Rotating to False

    > Set Stick.Angle to Stick.Start_Angle[/code:3ddx4l2r]

    ** It won't work if you want it to rotate in less than 1.5 seconds because that is 4 degrees per tick at 60 fps. If the rotation rate is any faster and/or the framerate drops then it could miss this check window and carry on spinning. If that happens, just use a wider window...

    An alternative would be to have a look at the plugins - you could use Rex's Rotate To plugin for this as well.

  • If you want to be able to call the native Facebook app from your game (wrapped in CocoonJS / Ejecta / Crosswalk etc) then, as far as I know, that is not possible using C2. However, using the browser object, you can link to a URL that will open a popup window in the mobile your game is being played on.

    Have you searched the tutorials? Have you searched this forum? Those 2 links should contain all of the answers you need. Regarding the URL encode technique in the tutorial - you don't need to do that - follow the answer in the thread for a non-coder friendly way of doing it. Good luck!

    Edit - I just re-read your question. If you're looking for help on how to fill out the Facebook app page - sorry I can't help. It's a mystery to me as well!

  • Excellent news! I will give this a go later today....

  • hollowthreat - thank you for the offer of help! However, it seems that a night's sleep and a fresh look at the problem has helped me to solve this on my own. In case anyone else is looking for a solution to this problem, I used the following tool to get this to work (no need to do the conversion inside C2):

    This simple URL Encoder / decoder quickly does the job of converting a URL.

    It was just a case of substituting each URL in the browser go-to string with its converted URL. Simple!!

  • First of all can I say a big thank you to juannn91 for this excellent tutorial showing how to make posts onto Twitter and Facebook using the Browser object. The guidance in the tutorial required some modification to be made to the Browser object's js and, frankly, I stopped following at that point. I have managed to post to Twitter on iOS and Android and to Facebook on Android using an standard Browser object, but iOS requires the URL to be encoded somehow.

    hollowthreat pointed out in a comment that URLencode(str) could be used to encode the string instead. My problem is I don't know which part of the URL needs to be encoded. I've just spent a few hours trying to get this to work, by encoding all of the URL or just the last part after 'uri=', removing spaces and replacing etc and I've registered my app on Facebook and it works in Android... The best I have achieved using the URLencoder is a new Facebook window opening with the following error message:

    The dialog has passed a bad parameter

    API Error Code: 100

    API Error Description: Invalid parameter

    Error Message: redirect_uri URL is not properly formatted

    But at least it was in a new facebook window! So, I'm close but I can't think of what to do to get this last step to work. Any advice would be very welcome!

    Thanks.

  • I've had very low mopub/admob ad show rates for about a week now....

  • Is this in response to your question here that was not yet answered when you started this thread? Five hours had passed - and the answer was, in fact, to be found in a tutorial all along...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • STARTECHSTUDIOS, unfortunately custom splashes was an option before the latest update - and it isn't a replacement for the dreaded flickering nightmare splash, it's an option to add your own on top of it (after ludei's, I think).

  • On touch end - and - is touching object

    That should work. It's late and I'm using my phone to type so I cannot confirm first before posting but I'm pretty sure that's the easiest way to do it.

  • OK, after wasting (investing?) a day at getting this to work to my satisfaction, here are my lessons. Some are probably obvious with hindsight and a lot of my time was learning how to work the insufferable OS X (I now don't totally hate it any more!). Suffice to say that the Getting Started Paragraph in the Ejecta instructions page is VERY important.... LOL!

    hollowthreat, I thought iAd implementation was pretty straight forward (once I'd figured out that I had to follow the instructions exactly). After enabling iAds in iTunes Connect, I just added a sub event in C2 on start of layout - Ejecta show iAd at bottom / top. And that's it - no massive and confusing codes to copy/paste! I did not use the 0plus1 plugin or the Ejecta Kitchen files. As far as I can tell C2 adds the appropriate information to the index.js and I made the changes to the Info.plist myself. I could not get Xcode 4.5 to run the files (dozens of red js warnings like justifun reported), but everything worked perfectly in Xcode 5.

    Test ads seem to work fine although I have the same problem with the ad's placement as Zharzew said: they are aligned to the very left of the screen rather than being in the center (a bit of a pain in landscape but I think I can work around it). I've done a trawl of the Ejecta forums and a few others have asked for a solution - I only found this answer on the forum, but it's a year old and I couldn't find the mentioned file in Xcode (I've added it here in case I'm missing the obvious).

    Performance was about the same as in cocoonjs, but there's no flickering splash screen! Awesome!! Now to try leaderboards....

  • Nothing stands out - it all looks OK to me. Don't know why force would work where impulse won't. Could be that giving an impulse so close to enabling physics movable was the problem. If you get a problem with using force you could try setting the velocity instead... I'm glad it seems fixed though!

  • Have you a capx (or a screen shot of the spawn event at least) you are able to share? Is it possible that the ball is spawning inside another physics object? If you're pinning the previously spawned ball, is it possible that the pin action is affecting the wrong ball (just a guess but I've had that happen!)?

  • I have found physics on mobile browsers to not work very well and that includes on cocoonjs I'm afraid. Any fps slowdown changes the physics characteristics of the objects so object interactions are different each time you run the same scene and if you play on a different device. And collisions cause little slowdowns...

    I thought that only the cocoonjs physics worked on cocoonjs without causing crashing. Have you tried running a zip in the launcher in debug to see what errors are reported?

    As for impulse and force. Wiki might give a more detailed answer. Force pushes for the time it is applied in increments of one tick. An impulse should change a body's momentum as if a force was applied for a fixed time. In fact impulse = force x time. So, an upward force of 1 for 10 seconds will result in the same upward velocity as an upward force of 2 for 5 second or an impulse of 10 being applied.

  • Only true for individuals with a poor sense of self awareness. In either case I would rather debate with the top 10% who thinks he's not at the top (humble or unassuming) than the converse with the bottom 10%...