nutmix's Recent Forum Activity

  • This fails in both versions.

    I have an animation which consists of 9 square frames of the same size, all with the origin (aka hotspot) set to 0,0.

    Now I want to add additional frames (also square with the same size).

    I add the frame in the frame editor, then "open" the image in the sprite editor, and by default the origin is already set to 0,0 - great!

    Except that when the new frame is displayed, it is using an origin which is the center of the image (not 0,0). Now if I try and change any origin (e.g. to 1,1), when I close and open the animation/sprite editor, it goes back to 0,0.

    It seems that behind the scenes the new frame is using the center as the origin, but is displaying 0,0 in the sprite editor.

    This is pretty serious - I've come to a bit of a halt.

    I cant delete the sprite and start again, as it will delete the hundreds of events which are using that sprite.

    This should be easy to reproduce (just create a sprite with a few frames, set the origin to 0,0, save the project, close C2, then open the project, add a new frame, then "open" the file containing the image, verify the origin is 0,0, then display the image in the game - it should appear offset by -0.5*width and -0.5*height

    I created the original frames in an earlier version of C2 (R95?)

    Let me know if you need a capx.

    Here is a snip of the animation in the project file:

               <frame duration="1" hotspotX="0" hotspotY="0" />
               <frame duration="1" hotspotX="0" hotspotY="0" />
               <frame duration="1" hotspotX="0" hotspotY="0" />
               <frame duration="1" hotspotX="0" hotspotY="0">
               <collision-poly>
                       <point x="0" y="0" />
                       <point x="0.991803" y="0.00819672" />
                       <point x="0.991803" y="0.991803" />
                       <point x="0" y="1" />
               </collision-poly>
               </frame>
               <frame duration="1" hotspotX="0.5" hotspotY="0.5" />
    

    Note the last frame has the wrong hotspot. However, in the sprite editor, its coming up as 0,0

    Also, why would some of the frames have a collision polly, and some not?

    Would it make the game faster if I deleted the collision plolys (which I dont need in this case)?

  • R105 fixes this issue on iphone 4 and iphone 3 and ipad

    Also, the removal of address bar works.

    Result!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Another option is to use crop fullscreen mode. Then your canvas is the maximum size possible, you have entire browser window to play with. You can make a massive background (e.g. from a single pixel tile), then put your game anywhere on it by moving your objects, incl. level backgrounds around. You can put sprites and text objects into two different families, then use bullet behavior on them to move them, or pin all your objects to a background and move that. you can also set the layer scale to make the game bigger or smaller without having to do anything (this is basically letterbox scaled mode but with the ability to set your own background colour)

  • Ashley, you are fast!

    Will this also fix the similar issue with going from portrait to landscape on the slower iphone 3?

    Thanks!

  • I've had this problem for some time, so decided to create a 2 event capx to demonstrate it as the game has failed the customers QA so im not getting paid :(

    If you go from landscape to portrait and back, it correctly flips between the landscape screen and the portrait layout.

    But if you are in landscape mode, and rotate the mobile (iphone 4) by 180 degrees, the screen goes black. As a secondary problem, in my actual game, it will not accept any input or events at this point either.

    Here is the live exported project:

    http://www.ohds.co.uk/c2/landscape_going_black_fail/

    It doesn't work in iphone 4 (ios 5) nor ipad 3, the only two platforms I have to target.

    Here is the capx:

    https://www.dropbox.com/s/f9enc1v26d4mg3t/landscape_going_black_fail.capx

    Note: there is a slight modification to the index.html to support iphone4 removing the addrss bar. But this code is not run for the ipad, so I dont think its that (and if it was, I would still need to find a solution as removing the address bar is an absolute requirement for any casino type game on the iphone, unfortunately).

    Please note:

    1) using phonegap or similar is not an option, these games have to run in HTML5 in a mobile browser.

    2) I have to use crop mode to support various screen sizes without black bars.

    In addition, on the iphone3, sometimes this black screen of death happens when you just go from portrait to landscape, or even from landscape to portrait, then it often stays black (i.e. going back to portrait still shows the broken black screen). Interestingly, this exactly what happens sometimes in my real game. So it seems to be an issue where if the phone is slow, or the app is complex and slow, the switch between portrait and landscape layouts fails frequently but not always.

    Thanks for any help, it is much appreciated.

  • Thanks Ashley. Is the layouts event sheet run in its entirety from top to bottom per tick? If so, then as you say I could be "calling" the other event sheet twice.

    I am testing out the function plugin, but Id rather be able to throw and catch my own event!

  • Different mobile phones run different FPS. Has anyone done anything in JS to detect the relative speed of the device? I have seem some JS which just loops for a few MS to see if its an iphone 3 (very slow)or iphone 4 for example.

    Obviously I can use the System-> Is on mobile device, but this doesnt tell me if if Im running say ipad3 (which is very fast) or an ipad 1 (which I need to no do some animations etc.)

    Any ideas?

    I could just do a loop a 100 times and see how long it took, but you never know what the phone is currently doing.

    I use the browser string to see if its an iphone or ipad at least, but you cant do much more than that.

  • I know what it might be - the text object which killed performance had an anchor behavior. I was overriding this to make it centered (anchors cant do this). I expect this was the problem.

  • If I create an event sheet called say "myfunction", and in it have one event:

    System 0 = 0 -> bunch of actions

    Then import the sheet in several different events in the main event sheet, will this work like a function call?

    It seems to.

    I.e. can I call the myfunction several times (not just once) from the main sheet.

  • Well, I removed each action one by one, and the one which caused to go from 60fps to 6fps was:

    [T] wonAmount -> Set X to (viewportleft("main")+viewportright("main"))/2

    However, I do exactly the same thing with sprites above it, which doesn't cause a problem, so this is odd.

    Interestingly, once I call this line, preview doesnt auto update the iphone any more, I have to refresh after hitting the "play" button at the top of C2.

    This doesnt seem possible, but I've reproduced it about 10 times.

    All the other lines put together make about 2-4fps difference btw if I disable them.

  • foolberry - using a single global would be dangerous if there is any multithreaded parts to C2 (I dont know if there are). e.g. if thread A set the "something changed" global to true, the on tick sees this, sets text, then just before it sets the "something changed" back to false, some other thread changes a value and sets the global to true it will be ignored - and the values wont be updated. Anyone one know how multithreaded C2 is? Im familiar with Actionscript, which every one says is single threaded but in fact isnt - e.g. http request callbacks can be executed any time.

    Mipey, this is my backup option, but is tedious.

    teahousemoon I could duplicate the setting of text code in every place its updated, but often I want to add something, then I would have to find and add it to every duplicate place, which in C2 is hard - I often resort to using notepad++ on the xml files.

    The solution I think I will go for is to use rexrainbows function plugin. This is poor second best to a custom event, but will allow me to abstract the updating code into a single maintainable place, but put the calls to it all over the place as required.

    Usually I would not touch a non-C2 plugin for fear of it becoming unsupported in a future version, but I dont think my project will be maintainable without it.

  • Most games have various counters such as balance, health, position etc.

    As there is no "on value change" event, MVC or similar for such values, rather than duplicate the GUI update code in every place which can update the values, I have 10 "every tick" actions to do things like:

    1) calculated and show the latest balance on screen

    2) show the latest bet amount on screen

    3) set any anchored objects to the right X/Y position based on viewport (anchor behaviour doesnt do what I need)

    etc.

    <img src="http://www.ohds.co.uk/c2/everytick.PNG" border="0" />

    When I run the game, I get 6fps when Idle (I.e. absolutely nothing happening - no movement, no animations) on the iphone 4. If I disable the onticks, I get 60fps. I still only get 1fps if I move a tiled background across the screen, but thats another post.

    I saw someone say that C2 is intelligent enough to only run the ontick action if one of the values has changed. This does not seem to be the case.

    What is the best strategy for this?

    Does everyone store the "last value" of each variable, then do checks to see if it has changed every tick? This will also incur an overhead.

    Any magic solutions, e.g. to make an event out of a value change such that it can be caught and actions can be defined in one place?

    Thanks!

nutmix's avatar

nutmix

Member since 16 Aug, 2012

None one is following nutmix yet!

Trophy Case

  • 12-Year Club

Progress

12/44
How to earn trophies