nutmix's Recent Forum Activity

  • Hi, I created a couple of mobile games with C2 6 months ago, and stopped because of a few reasons (below). Has anything been added to help any of these three areas?

    1. non-trivial info/settings screens too hard to create - no support for dialogues etc. Almost as hard as the game itself, requiring a lot of sprites, events and event hacks (as much as the game itself)

    2. Difficult to handle swipe gesture on mobile, which breaks button handling. I.e. swipe in/out different configuration/info screens.

    3. No ability to create libraries or cut and paste code across projects, requires a lot of re-entering and maintaining of duplicate code.

    Great product other than this.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I did a full feature slot game. Took me 2 weeks. Then I added swipe left/right to bring in settings and info screens, which could also be swiped up down. Took me more than 6 weeks. The result was a disaster of unmanageable code. I gave up with he project, although it was complete and 100 sexy, no way to maintain it, and it had a number of small swipe glitches (e.g. if you start swiping on a button, and finish swiping off a button, that cant count as a button press, so you have to manually manage all your own buttons - what a pain). I went the route of creating several layers, each with its own panel, then the game starts, I move them all off to the left and right just outside the visible area. The game handled different screen sizes, so this was variable. This is a very difficult way to go. If I had to do it again, I might try one big layout, with huge gaps between each "screen" filled with background to allow for different widths and heights of mobile devices. I also found that any kind of swiping ran at about 1fps on the iphone 3 and 3gs, and was not great on 4 (around 25fps). Looked fantastic on 4s and Ipad 3 though. Probably the biggest single most challenge to doing this is the fact that buttons get touch events even though they are hidden below other layers and even made visible. This requires some very quirky logic to figure out which buttons should be pressable during and after swipe events. This cannot be fixed with the enabling/disabling groups. I would advise against any form of swipe. Do it with buttons until C2 gets swipe support (which also works with pressing buttons) and the ability to make buttons disabled.

    I animated the swipe by pinning all the screens items to one object. Then I use the bullet behaviour on that. I had 4 invisible pixel object on each screen so I know if it had gone the right distance left/right/up/down. Then you have to move it back to exactly the right place as stopping a bullet leaves it in a random place.

  • I have seem some nice snake games posted, but the movement was only horizontal or vertical.

    Is there an easy way to "follow" an object, e.g. a snake body segment, to the segment before it (or the head). Then the app just needs to move the head. The pin behavior does not work in the required way, it would need something like a "follow" behavior to allow segment articulation.

    Also, how would one approach the head movement, assuming the head should turn towards the cursor or finger touch. It should not jump to face the finger, but slowly turn in that direction. Is there any way to do this without trigonometry & small incremental changes?

    Doing the Trig is straight forward enough, I was just wandering if there was any support for this time of movement built in.

    C2 doesn't seem to have any tweeting, only absolute movements.

    Thanks for any ideas or strategies.

  • Voted. The more people who buy construct 2, the more features can be developed.

  • To statically initialize a big constant array with several hundred values, is there a way other than writing your own json object (as I have done), or hundreds of set statements?

    Thanks!

  • I found this bug, and switched to using a bunch of ifs to handle the negative cases. Ill have to try your formula.

  • Ok, got it working, using this (which has the X&Y order reversed):

    "{""c2array"":true,""size"":[5,68,1],""data"":[[[0],[1],[2],[0],[1],[2],[0],[1],[2],[11],[4],[5],[6],[7],[0],[1],[2],[0],[1],[2],[0],[10],[2],[3],[4],[5],[6],[2],[0],[1],[2],[3],[0],[1],[2],[0],[1],[2],[0],[1],[2],[0],[1],[2],[4],[5],[0],[1],[2],[0],[1],[2],[0],[1],[3],[0],[1],[4],[3],[2],[11],[1],[10],[3]],[[0],[1],[2],[0],[1],[2],[0],[1],[1],[11],[4],[5],[6],[7],[0],[1],[2],[0],[1],[2],[0],[10],[2],[3],[4],[5],[6],[2],[0],[1],[2],[3],[0],[1],[2],[0],[1],[2],[0],[1],[2],[0],[1],[2],[4],[5],[0],[1],[2],[0],[1],[2],[0],[1],[3],[0],[1],[4],[3],[2],[11],[1],[10],[3]],[[0],[1],[2],[0],[1],[2],[0],[1],[1],[11],[4],[5],[6],[7],[0],[1],[2],[0],[1],[2],[0],[10],[2],[3],[4],[5],[6],[2],[0],[1],[2],[3],[0],[1],[2],[0],[1],[2],[0],[1],[2],[0],[1],[2],[4],[5],[0],[1],[2],[0],[1],[2],[0],[1],[3],[0],[1],[4],[3],[2],[11],[1],[10],[3]],[[0],[1],[2],[0],[1],[2],[0],[1],[1],[11],[4],[5],[6],[7],[0],[1],[2],[0],[1],[2],[0],[10],[2],[3],[4],[5],[6],[2],[0],[1],[2],[3],[0],[1],[2],[0],[1],[2],[0],[1],[2],[0],[1],[2],[4],[5],[0],[1],[2],[0],[1],[2],[0],[1],[3],[0],[1],[4],[3],[2],[11],[1],[10],[3]],[[0],[1],[2],[0],[1],[2],[0],[1],[1],[11],[4],[5],[6],[7],[0],[1],[2],[0],[1],[2],[0],[10],[2],[3],[4],[5],[6],[2],[0],[1],[2],[3],[0],[1],[2],[0],[1],[2],[0],[1],[2],[0],[1],[2],[4],[5],[0],[1],[2],[0],[1],[2],[0],[1],[3],[0],[1],[4],[3],[2],[11],[1],[10],[3]]]}" 
    
  • I still cant figure out away to get a 2d array into an array object using the load from json string. Has anyone done this, and perhaps can supply an example? I cant really do it using "set value" as I have 300 data points.

    Any help much appreciated.

  • Not found a solution yet, but the json array structure seems to have X and Y the wrong way round.

    set reels to be 5x3x1 (i.e. x=0-4, y=0-2)

    I tried

    set value at (0,0) to 0

    set value at (1,0) to 1

    set value at (2,0) to 2

    set value at (3,0) to 3

    set value at (4,0) to 4

    set value at (0,1) to 00

    set value at (1,1) to 11

    set value at (1,2) to 12

    etc.

    But when I display "reels.AsJSON" I get some counter intuitive results something like:

    [[

    [0],[0],[0]],[[1],[11],[0]],[[2],[12],[0]...

    I was expecting:

    [[

    [0],[1],[2],[3],[4]],[[[00],[01]...

    It would appear that the Y comes first, as if the array was 3x5 not 5x3.

  • How do I set/read a 2 dimensional array?

    I always get:

    Javascript error!
    TypeError: this.arr[x][y] is undefined
    http://172.30.5.17:50000/Arr_plugin.js, line 96 (col undefined)
    
    This is either a bug in Construct 2 or a problem in a third party plugin or behavior - please report it to the developer!
    

    I'm trying to set a 2 dimensional array, then read a value from it.

    Here is the code:

    <img src="http://ohds.co.uk/c2/array-json.PNG" border="0" />

    I was expecting it to output 3, but get a JS error.

    If I dump the array as json, I get the same json as I put in, so presumably this means I used the correct (undocumented?) format.

    I also tried reels.At(2,2,0), but this generates the same error.

  • Ok, found the problem, many apologies.

    I thought I was in origin setting mode in the sprite editor, because the origin x/y dialog was visible. It turns out it was in polygon setting mode.

    This may explain why some sprites got slightly off polygons.

    My bad, sorry.

  • Until now, I have been doing my static initialisation in a "on start of layout".

    However, on mobile, the user can switch between portrait and landscape layouts. Each time they switch back to portrait, I am guessing that "On start of layout" is run (although I dont know this for sure).

    The question is, how to only run something once ever, no matter how many times the layout is swapped?

    E.g. could I do:

    Global DoneInit = 0
    System DoneInit = 0 -> System set DoneInit to 1
                        -> (do static initialisation of stuff)
    

                  

    And this only ever get called once, or do global vars also get re-initialised when you switch layouts?

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