AllanR's Recent Forum Activity

  • the top left corner of the screen is 0,0 for x and y. as you move down the screen, the y value increases.

  • using SSL and session IDs secures the connection between the device and your server, but on the device the user can mess with the data because it is unencrypted in memory.

    there is no bullet-proof way to prevent people from cheating - you can only make it difficult. There are quite a few threads talking about various ways to discourage tampering if you search for them.

  • Another option is to put all the variables in an array, and save the array in local storage. That takes one save and one load, and then you know you have all the variables at once.

  • sassix

    there are a couple issues with your file - you never save the OfflineTime variable, except for the first time it is run (when the local storage item is missing - and it is set to 0). And you don't really need to save that in local storage because the SavedTime is doing the same job.

    Also, at the start of layout you check for the local storage items and then set the text fields before the items are finished loading from local storage.

    And when a localstorage item exists, you set its value back to 0 instead of setting your global variables with the value from localstorage.

    when you load items from localstorage, you don't know what order they will get loaded in, so you can't do any calculations until you are sure they have all been loaded. So, I changed it so that it calculates the time away when the SavedTime item is loaded and calculates the GoldEarned, but it doesn't add it to CurrentCurrency because that item may not have loaded yet. I only add it when you click the Quit button - where it sets the SavedTime and saves the new CurrentCurrency.

    when you click the Quit button, it starts saving the localstorage items and then closes the browser. I wasn't sure it C3 would know to wait until the items were saved before closing down - and it seemed like the values didn't get saved once or twice in testing, so I made it wait until the items finished saving before quitting.

    https://www.rieperts.com/games/forum/AwayTimeFix.c3p

  • they stopped adding features to C2 long ago - they have just been doing bug fixes.

    there is no way to import a C3 project into C2. you may be able to recreate the project in C2 by looking at the events in C3 and creating similar ones in C2, but there are lots of features in C3 that don't exist in C2.

  • it does get a little confusing at first...

    I don't think of it in x,y coordinates - I always think of it as row,column

    row is the array width, column is the array height

    here is a very stripped down sample of my array functions for loading, filtering, sorting and displaying array data:

    https://www.rieperts.com/games/forum/SampleDB.c3p

  • certainly would be easier to be able to sort the main array by any column you want, but it isn't too hard to do it the way I do. Plus I can control exactly how it works - I can combine multiple columns for a primary and secondary sort order, control whether it sorts alphabetically or numerically. I have functions to do all the work. I set instance variables on the main array that indicate what column to sort by, numeric or alpha, ascending, descending, etc... I pass the UID of the array into the function because I usually have arrays with data from different tables from a database. Loading the arrays with AJAX calls also loads the field names into the dictionary, so I can change the query and don't have to worry about changing any code since I don't access data by column number, only by field name.

  • I do a lot of database work with C3.

    What I do is make the array a container and add two additional arrays - one called Filter, and one called Index. And I also add a dictionary so I can use field names instead of numbers for the columns.

    The Filter array only has one column. If I want to show a subset of the records in the main array, Filter only contains the row number of the main array for records that meet my criteria.

    Then to sort the array, I use the Index array. It has two columns - the first column contains the field (column from the main array) I want to sort by, the second column contains the row number from the main array.

    To build the index, I loop through the Filter array so only records that match the current filter are included. For each row I copy the field I want to index by to the index array (and its row number). Sort the index array by the x-axis (and reverse if I want it in descending order).

    I have used this with arrays that have thousands of records, and it works great - even on mobile! I can filter and sort a very large array instantly.

  • I would do something like this:

    I added the Pick top instance just in case you have overlapping instances, because a mouse click over multiple objects will trigger the clicked event for each object the mouse is over.

  • under System Loops you will find "For Each"

    select the object type and it will loop through each one, each time through the loop only one of the objects will be selected, or "Picked". then as an action for the loop you can set the properties of the current object, and you can use the "LoopIndex" keyword to multiply x by (it will be 0 for the first instance of the object and will increase by one each time through the loop).

  • hard to say without seeing what you have in mind...

    how many menu items are there? aligned vertically or horizontally? evenly spaced out over the menu, or top or left justified? Are the menu items sprites? text objects?

    do the menu items need to be pinned to the menu so it can slide on or off the screen?

    how are the menu items sorted? is there a sequence they need to be in?

    It would help if you could post a sample project with a general idea of what you want.

    it doesn't make much of a difference if the items are created at runtime or not.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Tab order is set by z order - the lowest in the z-order will get the focus first, then up to the highest.

    (and Ashley is male)

AllanR's avatar

AllanR

Member since 21 Nov, 2013

Twitter
AllanR has 23 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

20/44
How to earn trophies