nutmix's Recent Forum Activity

  • I was struggling with the same issue for mobile. I was thinking of loading the background dynamically, and storing a ton of sizes and aspect rations on the server as images. If there is not an exact fit, I would either get a larger one and crop or scale down, or smaller and up.

    However, what I found was that although my game only displayed a few sprites at a time, there were so many outside the game (as you need to have sprites for every thing which can be touched or moved). The core game was fast, but when I added all the dumb info screens and their backgrounds, buttons, settings and all the stuff you need to put round the game, it was too slow and the code unattainable so abandoned the project even though the games themselves were complete (it was a suite of slot machines for real money for an existing online casino).

    However, I'm keeping my eye on construct 2's progress, hoping that one day it will have more support for native html 5 mobile, e.g. the ability to swipe in a settings form and a better solution for multiple screen sizes/ratios without black letterbox bars (which is currently possible, but extremely difficult when you add swipe navigation). When It does, the world we be at our feet.

  • Thanks for the replies. By Dialogues, I meant dialogue boxes for things like settings, info, rules, help etc.

    To implement swipe, you have to track x & y mouse coords, and have thresholds for dx dy etc. however, if they start/end the swipe over a button, then you get an unwanted button event also. Unless you manage all button type events yourself, which is pure pain.

    Other libs I have used have allowed more interaction with the surrounding OS, which for mobile would be the html5/css outside the canvas. I could not find a way to use this (e.g. use CSS transforms to swipe in info pages outside of the canvas, which was not designed to do this).

  • 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!

  • 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 ***** 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

nutmix's avatar

nutmix

Member since 16 Aug, 2012

None one is following nutmix yet!

Trophy Case

  • 13-Year Club
  • Forum Contributor Made 100 posts in the forums
  • RTFM Read the fabulous manual
  • Email Verified

Progress

16/44
How to earn trophies