nutmix's Forum Posts

  • For mobile, you have to have two layouts - one for portrait and one for landscape.

    If I copy the portrait layout to landscape, change the landscape layout size, re-arrange the objects, change the anchor points and attached the same event sheet as for portrait - everything is good right?

    Well not quite. To handle lots of differnet screen sizes, Crop fullscreen mode has to be used, and the objects such as buttons and score are anchored so they move in/out with the resize. However, when you modify the anchor behaviour (i.e. which side its attached to) on one layout, it also changes it in the other - Doh!

    So the next avenue is to try and change the anchor properties (i.e. which side its anchored to) in an event. However this is not possible - you can only enable/disable anchors.

    The next strategy was to create two anchors on each button, and only enable the appropriate one. But you cant only create one anchor on an object.

    Does anyone have any more ideas?

    NB:Letterbox scaling is not an option has it to be full screen with no black bars, and make best use of space.

    Help much appreciated.

  • Does anyone know where the events for orientationchange and resizing are? Looked under System and Browser objects.

    Please dont tell me one has to poll the screen width/height every tick - in an event driven framework this would be crazy....

  • Why is it that when I flip from portrait to landscape the screen goes black and nothing shows until I restart the web app.?It will flip once but any subsequent flips it turns black.I am exporting in scale letterbox mode.

    I get the same problem with R99 - if I switch from portrait to landscape a few times, get a black screen, and have to refresh.

  • I have managed to get a hacky version which only works for iphone4 (breaks everything else).

    The addres bar is 120 high. The space for the game is 712+120=832.

    I made the game window 832 high, in crop fullscreen mode.

    Exported the project, then edited the index.html as below.

    Now need to wrap this in something which only does it if its the right version of android/iphone, and do scaling for android. Will this work on iphone3?

        <script>
    function hideAddressBar()
    {
      if(!window.location.hash)
      {     setTimeout( function(){ window.scrollTo(0, 1); }, 0 );
      }
    }
    window.addEventListener("load", function(){ if(!window.pageYOffset){ hideAddressBar(); } } );
    window.addEventListener("orientationchange", hideAddressBar );
    
              // Size the canvas to fill the browser viewport.
              jQuery(window).resize(function() {
                  ?cr_sizeCanvas(jQuery(window).width(), jQuery(window).height()+60);
              });
              
              window.addEventListener('orientationchange', cr_sizeCanvas, false);
         
              // Start the Construct 2 project running on window load.
              jQuery(document).ready(function ()
              {              ?
                  ?// Create new runtime using the c2canvas
                  ?cr_createRuntime("c2canvas");
                  ?
                  ?cr_sizeCanvas(jQuery(window).width(), jQuery(window).height()+60);
              });
              
    
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you are building for android you can remove it in the android manifest.

    Thanks mikepixie - is the manifest just for apps? Im looking for something for normal browser based games.

  • In iphone 4 and android, its pretty easy to hide the address bar to get the extra screen space. E.g. go to google.com or mobile.williamhill.com with either handset, and you will see the addrss bar go.

    Some sites don't do this, e.g bbc.co.uk does not hide the address bar.

    We need a solution which allows the game to play in the full (retina or non-retina) resolution available without the addess bar (i.e. on ihpone 4: 960 - (height of the bottom tool bar - height of the top status bar)).

    1) This needs to work in portrait and landscape (and allow changes between)

    2) It must work with C2 crop fullscreen mode (as some UI elements are anchored to the endges and move relative to the edge to handle different screen sizes.

    3) It should allow the game to make full use of the maximum browser space avaialble without the address bar in the standard browsers on android and iphone.

    4) Other platforms, such as desktop browsers (such as FF, Chrome, IE etc), and ipad should not be affected.

    5) it must work in R99 (as all our projects are done in this version)

    6) It should work on the standard browser of the iphone 4, 4s and android 2.2 or higher. Iphone 3 highly desirable.

    There are thousands of posts on how to remove the addres bar, and many use this code or a variation:

    // if mobile browser detected

    addEventListener("load", function() {

        window.scrollTo(1, 0);

    }, false);

    However, this requires that the page is at least the screen size wihout the bar. The construct 2 window makes itself the size with the bar, i.e. on iphone 4 with retina enabled = 640x712

    To see the address bar go, simply put some <br><br><br> at the top or bottom of the body tag of the exported index.html, add the above js, and the bar will go. however, the C2 game still thinks its only 640x712, and the <br> obvoiusly screws up the page by adding blank areas.

    A solution might be:

    1) a list of modifications to the index.html produced by the the export function.

    2) a plugin for R99

    This must not use appmobi, phonegap or any other framework which bundels the game in proprietory container.

    Payment will be made on verification of source code working on our project, via bank transfer (UK banks) or paypal.

    Payment will purhcase full excluseive rights to use the solution in any manner.

    A partial amount (?10) will be paid if someone figures out a way to hard code this for retina size iphone 4/4s only, without affecting other browsers, and noone figures out the full solution (which would include android and non-retina)

    The deadline is 5pm (GMT+1) 29th Aug.

    If more than one sumbimsion is recieved by then, the best will be selected. if there are more than one with which work perfectly, then the first will be paid.

    If there are flaws, side-effects or issues with the solution, and these can be fixed within 2 days of the deadline, the amount will still be paid.

    If no-one can find a working soluion, then we will have to abandon C2 and abandon the project. :(

  • I am still trying to find a good way of getting rid of the address bar. For a constrct 2 developer who knows HTML5, Im hoping this will be very easy.

    The partial solution is simply to put this:

    addEventListener("load", function() {
        window.scrollTo(1, 0);
    }, false);
    

    into index.html, then to make the page longer than the area which is under the address bar. E.g. I can do this by adding three or more <br> at the beginning or the end of the page, e.g.

    <body> 
        <br><br><br>
        <div id="fb-root"></div>
    

    but this puts a big black bar at the top or bottom of the page instead of the address bar, so is a lose.

    What we need is a way to force the output page to be the right size, instead of the cropped dimentions which include the address bar.

  • Looks like im on my own for iphone 4 development.

    I found a solution to the resolution issue - just switch "Use iOS retina display" to on. Now I need to check what that does to non retina displays, then Im sorted for resolution.

    For the address bar issue, its doable, its just a pain to have to hack the HTML.

    Im shocked that onone has come up against this. I.e. it seems noone is using construct 2 for browser based mobile, which some might say is the most important area of development right now.

    Why would anyone want to produce an appstore packaged game and pay apple 30%, and not beable to offer gambling games etc, when they can just do it in a web page and achive near native games?

  • Interesting.

    games.linkit.com has no games listed.

    Who runs linkit.com?

    Is it affiliated with, or part of Scirra?

    Who would develop a game (which takes weeks or months for a polished item) for $150?

  • This is probably reproted, but its driving me mad.

    I spend half an hour writing a detailed post, then when I it "Post new topic" I often get this:

    <font color=red>

    Error Error

    Only members with sufficient permission can access this page.

    A security error has occurred with authentication.

    Please ensure that all cookies are enabled on your web browser, you are not using a saved or cached copy of the page, and your Firewall/Proxy settings are not hiding or masking your IP address.

    </font>

    The killer is if you hit the back button, your post is gone. So you have to retype the whole thing. It always works the second time.

    I get this error at least once a day.

  • I've never been able to get any of those 'hide address bar' snippets working with C2's engine, can you link me to one that you know works?

    Ashley, I know why the bar is not being removed in C2 exported index.html, and how hack the files to get it to work. I cant pm you, can you pm me and we can find a way to get it put into constrcut 2?

  • I am trying to get an app working on iphone4, by setting the window size to 640x960, then using crop mode to allow the variuos IOS tool bars to cover the top and bottom of the page.

    However, what comes out is only small amount of the center of the game blown up large.

    printing the WindowWidth and WindowHeight, its coming out at 356x320, which is iphone 3 resolution (yes I am sure I have an iphone 4).

    I could create a game and assets at iphone 3 resolution, but then they will look much worse than they should on the iphone 4.

    Anyone got any idea how go get iphone4 working at its native resolution?

    Also, I cant get the address bar to go away. I have seen hundreds of posts saying this always works:

    window.addEventListener("load",function() {

    // Set a timeout...

    setTimeout(function(){

        // Hide the address bar!

        window.scrollTo(0, 1);

    }, 1000);

    });

    Or this:

    addEventListener("load", function() {

        window.scrollTo(1, 0);

    }, false);

    However, adding this to the result of any construct 2 exports (USING CROP) index.html file doesnt get rid of address bar.

    NOTE: both solutions require the page to be longer than the visible area, which mine is, or is it? I tried adding some extra <br>s at the end nd it works! I get rid of the address bar. However, now I ahve a big black gap at the bottom from by <BR>s. Construct 2 devs, please fix this!

    This is a huge problem - all the competitions games get rid of the bar, and the customer wornt accept us not getting rid of the bar to allow additional game space.

    Has anyone manged to figure out how to do this with the particlar pages that construct 2 creates in crop mode? Perhaps its the centering which is the problem?

    Thanks!

  • Creating the game only took a couple of weeks. What is taking me longer is how to simply get the game to work on mobile browsers, and its very hard.

    Im not getting many replies, so either noone is trying to support mobile with their games, or im not getting to people who have.

    How about a C2 mobile forum, where we can discuss topis like:

    How to get rid of the browser address bar

    Optimum ranges of screen size to target.

    Ipad specfic functions like swipe

    How to detect slow HW and scale back the effects.

    How to switch layouts on landscape/portrait.

    How to get rid of the black bars

    Which handsets/os versions dont work, and how to detect them.

    Etc.

  • I had a look at them, and they seem to use the object names in the actions, which looks promising. However, Im not sure why it did not let me paste events/actions from one project to another when I setup identical objects with the same names before hand in the target project (it somehow knew they were differetn instances).

    Anyway, I might try this XML copy approach for now, and hope it doesnt bite me in the but.

  • By the way you can install multiple releases side by side (in different folders obviously).

    Thats great advice - going forward Ill do this. Dont understand why they advise to uninstall old version.

    Do you make launch icons for each version?

    How do you avoid accidentally saving over a R95 project with say R100, and "losing" it?