mrtumbles's Forum Posts

  • Array.AsJSON is a string of text in JSON format that described the data in an array. You can download a JSON of an array using the Array's action 'Download'. You can store the JSON by storing Array.AsJSON. You can load data into an array by using the Array's 'Load' action, in which you must specify a string of data in JSON format.

    So to save data simply set a localstorage value to Array.AsJSON

    And to load data, get the localstorage value, and pass it to Array>Load

    No sample capx as no upload capability, sorry <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    https://www.scirra.com/manual/108/array

  • If the JSON is stored as a project file and loaded on start, the file will be saved locally, yes.

  • Store values that represent the line on an array, store the Array.AsJSON in a localstorage value. When you re-load the data into the array, draw the line

  • Personally I would handle this using image points on your obstacle objects. In each animation frame, add additional image points wherever you want coins to appear. When you spawn an obstacle, use a loop to iterate through the additional image points, spawning the coins

  • Personally I would create the tilemaps in C2, grab their JSONs one by one, then store them in a dictionary.json which you include as a project file and load on start - rather than writing events to populate the dictionary, which I think would mean you'd have to loop through the levels on start.

  • You can save a tile map configuration using the tilemap's 'TilesJSON' expression. You can store it as a string - if I need multiple tilemaps for multiple levels I'll usually use a Dictionary with keys named for each level, and the value set to the TilesJSON for that level.

  • It's a lot easier than you'd expect, and a lot more useful. Of course, it's only limited to telling you what you explicitly ask it to tell you - but sometimes that limitation is a blessing. I usually implement some sort of home-brew debugger early on in any project that might need it.

  • From the manual:

    [quote:3673eooe]LastData

    The contents of the last response. This is set in the On completed trigger. If used in a different event, it contains the response of the last completed request.

    So long as you're loading the data into the Array object in the relevant 'On completed' trigger, the data will not conflict. Basically: you can use LastData outside an 'On completed' trigger, but you REALLY shouldn't.

  • If I have specific issues like this I'll write my own specific debugger. Usually this consists of a TextBox (set its Type to 'Textarea' so it can display scrolling multi-lines) on a 0,0 parallax layer and an action that sets its text to a readout under specific circumstances. I don't tend to make mousey-games so I'll use the mouse as my 'debugging tool' - set it so that when you click an instance the text in the textarea is set to show a readout of all the relevant values to your issue. Something like that anyway. I was inspired by learning that cheat-codes were originally just developer shortcuts for debugging.

  • The best advice I can offer is to keep a close eye on your profiler. I almost always run in debugging mode, so that I can individually check variables on instances and so-on. Whenever I find unexpected behaviours, I generally find incorrectly set instance variables, bad calculations, NaNs and floating point errors - which are entirely my fault!

    I know it sucks, but the mantra should be to 'fail faster' - then fix the fails.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For bound keys with 'Key released' functionality, I used two dictionaries. The dictionaries stored which key was down each tick by recording its keycode (you can also store the player ID in the value to simplify other code I would have thought). At the end of each tick the game loop would evaluate which dictionary keys were present this tick, and compare it to the keys present in the previous tick.

    If the key is now present, but was previously absent, call a function that corresponds to 'Key pressed'

    If the key is present in both, call a function that corresponds to 'Key down'

    If the key was present in the previous tick, and absent in the current tick, call ... 'Key released'!

  • There's a CapX here if you want it, with a few little refinements and notes.

    https://drive.google.com/open?id=0Bwizs ... 2FXaGlNbWc

  • Yeah, like the example given. A steering behaviour is a generic term for a behaviour that causes one thing to move in the direction of (or away from the direction of) another object. The simplest example in Construct 2 is using the 'Move at angle' action using the angle between the two objects.

  • I could be wrong - but I'm pretty sure the in-built sort feature includes alphabetical as well as numerical searching. You'd have to move the text over to be the first index on the X axis, but then the in-built sort function should work fine.

    EDIT: Sorry - just re-read your post. To move a group to the top of the list, simple iterate through the array checking for the identifier you're looking for. When you find that identifier, push a new value to the front of the array containing the values from that index - then delete the original index.

    If you want everything grouped beforehand, you'll need a place to store a list of all of the text values stored in the third column, then perform the above process for each item on that list.

  • To achieve this I think you'd have to have two separate objects. One object would have the drag and drop behaviour, the other object should be given a basic steering behaviour to ensure it always moves towards the other.

    Something like Move x pixels at angle(Self.X,Self.Y,DragDrop.X,DragDrop.Y)