AllanR's Forum Posts

  • the Mnk

    what 99Instances2Go said is correct - C2 does not update its internal indexes/counts until the next top level event after the create object action.

    You can continue to access the object in sub events under the one that created it, and you can pass its UID to a funtion that can pick it by UID.

    Another thing you can do is add a wait 0 to give C2 a chance to update before running actions after the wait.

  • Annilou

    at start of layout you are changing the value of the global variable, but since there are probably multiple buttons, it is getting a value other than what you are looking for.

    if you move that action to event 2, it should work. (set the global variable button to button.action in the "On Left button Clicked" event, then the sub event will work - when you click on the button that has "action" set to selectCharacter)

    another way to do it without a global variable would be to store the layout to go to in the "action" instance variable, (set button.action to "pjCreation")

    then in event 2 add an action that says: system > Go to button.action

    (then you dont need the sub event, or other sub events for other layouts).

  • Turaco

    I recently was working on doing something very similar - although I was also trying to use the entire screen (regardless of device size or orientation) by using Scale Outer and Unbounded scrolling (which added an extra level of complexity that took me an entire long weekend to work out).

    it is just a matter of calculating how far the layout is allowed to scroll, and keeping within those limits.

    So, here is how I would do what you were asking - no plugins required:

    http://www.rieperts.com/games/forum/ScrollLimit.capx

    this version does the double tap to zoom you mentioned, but I also included how I track multiple touch points, and do pinch to zoom... I also added a button to turn the limit feature on and off so that you can see that it really works.

  • nightbr

    Chipmonk Physics is a behavior. Which needs to go in the Construct2\exporters\html5\behaviors folder

    not the plugins folder.

    oh, and make sure you download ROJOhound's behavior for C2 - not the github original code. You might have to look a little farther down the page to get to the link to ROJOhounds dropbox files...

  • nightbr

    I made a slightly better version using chipmunk physics (so it requires Rojohound's plugin) https://www.scirra.com/forum/behavior-chipmunk-physics_t110815?&hilit=chipmunk

    chipmunk physics was definitely better on mobile back when I made that example. (I haven't compared the two since then)

    This version leaves a trail of the last few shots, so you can tell where you aimed. It allows different levels of zoom and has a camera system to follow the active bird. A second level and a bunch of other improvements...

    http://www.rieperts.com/games/forum/angry_birds_chipmunk.capx

  • I use php (and AJAX)) to read and write to a MySQL database. There are tutorials that helped me get started.

    My php script builds a big string of records to send all at once, that I then parse in C2 using tokenat.

    The only part that was slightly tricky was figuring out that I had to urlencode the data to avoid trouble. And to escape and urlencode the data being sent back to write...

  • ddabrahim

    I am not an expert on saving local files. but I do a lot with databases.

    As far as i know, the whole idea of writing to local files on mobile is considered a major security threat, so pretty much the only local option would be to use Local Storage. You could take an array full of data and store that in Local Storage easily. I guess it depends on how much data you want to store, and how important data integrity is - if it is local, people will find a way to modify it in ways you might not want.

    Setting up a database on a web site and passing data back and forth with AJAX calls is not that hard and works really well for me. Then you have access and a lot more control over all the data your users are saving - if you want to do any kind of statistics, or checking if anything suspicious is going on.

  • BlackFalcon7842

    actually, C2 has had this ability for years! Ashley did a tutorial back in January 2012 on how to set it up:

    https://www.scirra.com/tutorials/247/how-to-preview-on-a-local-network

    I use this to test on my iPhone all the time.

    On my phone, I had to open the preview from Safari the first time, but then you can choose "Add to Home Screen" to get an icon to directly launch the preview full screen without the Safari interface getting in the way. Once you have the icon it will launch what ever project you are previewing on your computer - so you don't need one for each project, it is a link to the server and will load what the server (your computer) is running.

    EDIT: obviously, for this to work, your phone has to be on your local wifi network so that it can talk to your computer...

    EDIT2: It also allows you to preview in Debug mode on your phone. The debugger is a little small, but it help tell you how well your phone is handling draw calls, cpu usage, etc...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The easiest way would be to add a For Each Green sprite:

    Blue sprite - DragDrop is dragging

    • For Each Green Sprite
    • - Blue sprite is overlapping Green sprite > set opacity to 10
    • - Else set opacity to 100

    This doesn't actually test for which one last collided, if blue sprite is over one Green one, it will go to 10%, if it is over both, they both will go to 10%

    If you really want only one green sprite at 10% (and the "last collided"), even if the blue one is touching both, then you would have to use instance variables to keep tract of when the green sprite collided - so you can know which one was last.

  • I definitely see what you are talking about... it looks (to me) like C2 is adjusting the global layer - stretching it out to compensate for the shrunken layers, and there is a split second when there is nothing to display around the edges of the background sprite. You can clearly see the "Back and Next" arrow sprites at the wrong location for a tick when level 2 is displayed.

    so, I tried over-sizing the background sprite way beyond the edges of the HUD layout and that seemed to help (not completely but was noticeably better - although you could still see the controls at the wrong place, but there was less flash). Obviously, you would have to know in advance how much you were going to shrink a layer and oversize the background image enough that there was something to display until the global layer is properly in place.

    I Also tried making new background layers on all the layouts (kind of defeats the purpose of a global layer) to see if local background layers would not suffer the same stretching effect. That didn't help. I also tried putting a wait 0 before you change the scale at start of layout to make that the last thing it does on the current tick - hoping that the global layer would get in place first. But that didn't solve the problem either and then you could see objects snapping to their new size.

    so, I don't think there is anything else you can do. Over-sizing the background image gave the best result. One other thing I did was make the controls invisible on the global layer, and then in the common event sheet (event sheet - rules) in the start of layout section I put a wait 0, then made the controls visible. (I put them all in a family so I could do it with one action). That helped with seeing the controls in the wrong place for a tick most of the time (although I still did occasionally see them at the incorrect location).

    Those two things make it barely acceptable (most people would not notice), but still not the solid behaviour you would expect.

    I don't know it Ashley will feel this is a big enough issue to do anything about it - and it may be a case where the cure is worse than the problem...

    if you want to see my version: http://www.rieperts.com/games/forum/zoomtest.com

  • IGDev

    actually, just set the other slider to 10 - current slider value

    so,

    slider1 On Changed > set slider2 value to 10 - slider1.value

    and

    slider2 On Changed > set slider value to 10 - slider2.value

  • Jonhyfun

    Sounds to me like you need to set up an enemy family. although I think that is not available in the free version.

  • matthew de

    ok, I definitely see what you are talking about... it looks (to me) like it is adjusting the global layer - stretching it out to compensate for the shrunken layers, and there is a split second when there is nothing to display around the edges of the background sprite.

    so, I tried over-sizing the background sprite way beyond the edges of the HUD layout and that seemed to help a little (not completely but was noticeably better). then I tried making new background layers on all the layouts (kind of defeats the purpose of a global layer). But that didn't really help. I also tried putting a wait 0 before you change the scale at start of layout to make that the last thing it does on the current tick - hoping that the global layer would get in place first. But that still didn't solve the problem and then you could see things snapping to their new size.

    so, I don't think there is anything else you can do. Over-sizing the background image gave the best result. You might want to file a bug report to have Ashley see if there is anything he can do about it.

  • Diginampl

    I have seen lag like that. The only way I was able to fix it was to pin everything to the same base object.

    So, position the hat to the imagepoint on the head, but pin the hat to the same object that your character is pinned to, and everything will move together!

  • matthew de

    I haven't looked at your capx, but I use layout scale and it works really well - I haven't seen any flashing/blinking - and I use it a lot.

    Set the "Scale Rate" of any layer you don't want to zoom to zero.

    the only issue I have ever had was with text objects - they don't zoom well because of the overhead in rendering.

    If I need to zoom, I use sprite fonts.