John Cutter's Recent Forum Activity

  • My online app has been coming along well but today I added a button to reset Local Storage and now I can't seem to access it anymore. (At least when previewing with LocalHost.) I may have caused the problem by clearing storage and then immediately trying to save to it. (Unfortunately, I didn't find the "On Storage Cleared" condition until later.)

    When I look at Local Storage in the debugger I see "(loading...)" in both the Key and Value fields. Pressing the Reset button has no effect. I tried doing a Reset in my "Start of layout" event. That didn't help either, nor did rebooting my computer.

    I found out how to manually delete my Local Storage (using "F12" in Google and going to the Resources tab) and it was instantly removed, but my game still seems to think the data is there and is locked up trying to load it.

    Any suggestions on how to fix this?

  • Thank you, thank you, thank you! My sprite is a simple rectangle so I assumed the collision polygon would automatically match the shape. Nope, my poly looked like a Picasso painting. Appreciate the help, guys!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I am making a web app and I have several rectangular sprites that I use as buttons. ALL of my buttons work great... except one. At first it seemed to fire off randomly when I tapped it, but there are certain places -- near the middle of the button -- that will never register a tap or click. But there are other spots on the sprite that will register a Touch event every single time. The buttons are all the same so I can't figure out why one of them only works part of the time...

    I'm sure this is an issue with my code but I don't know even know where to begin to start looking. Any suggestions? I have some invisible text objects in the same area, but they are all on the same layer so clicks should pass through, right? I made my button opaque in case it was a transparency problem, but that didn't help either...

  • It's my understanding that, in order to host an HTML5 game on Dropbox, you need access to Public Folders. As of 2012 this feature is no longer available unless you pay for a Dropbox account. (I think anyone who started using Dropbox before 2012 will still have access.)

    Just FYI.

  • Good to know, Ashley! It's possible that I was looking at a subforum when I saw that there were only about 30 people online. Sorry about that. (I don't want people to see my thread title and get the wrong idea, so feel free to delete this thread!)

  • UPDATE (and a few final questions): I finally tracked down my array/dictionary issue above. Due to an export error from Excel there was a leading space in front of all my IDs. SUE (stupid user error).

    Okay, a few more questions: For my Flashcard app to be truly useful to the other people in my French class *THEY* need to be able to enter their own words and phrases. Sounds like that might be pretty tricky, since I'm already using Local Storage to track "scores". I'm also concerned about someone losing all their entries if they ever have to clear their web cache. (That would happen, right?)

    Is there any [easy] way for me to do this? There are only a few people in the class so I'd be willing to upload their vocabulary .json files to my server. In my flashcard program is there a way for me to bring up a directory of filenames? (Then they could simply choose their own vocabulary word and use that.)

    Special thanks to blackhornet for his help, so far. It's much appreciated!

  • Strange, I just tried to post in this thread but my message didn't appear. Apologies if I accidentally double post.

    Ignaci, I noticed that your example file is using the older version of Construct 2. (I can't even open it.) You may want to update your link. Or I can post an example file if that would be easier. Let me know!

  • Thanks to blackhornet's help I have dramatically simplifed my app (and it's much faster now, too)! But I've got one more bug to fix and I'm completely stumped.

    I'm trying to update my dictionary using a value in my array and it's just not working.

    Here's my code. (I've verified that location 0,3 = "0"):

    Dictionary: Set key Array.at(0,3) to 300[/code:4k9r7w3i] 
    [i]NOTE: I've tried using: str(Array.At(0,3)) but that doesn't help.  [/i]
    
    And yet THIS works:
    [code:4k9r7w3i]Dictionary: Set key str(0) to 300[/code:4k9r7w3i]
    What am I doing wrong?
  • Wow, thank you blackhornet! I really appreciate your help!

    I haven't had a chance to look at your updates, but your response made me remember why I was prompted to write my post.

    It was my assumption that the Sort and Reverse commands for arrays would finish execution before falling through to the next line of my program. But I was running into problems when I Reversed the Y axis, and then immediately Sorted by X. My theory was that the Reverse hadn't finished before I started the Sort. When I put the delays in between (Wait didn't work), everything seemed okay.

    I think I read that some Events need a "tick" to complete. Is that the case here? Would "Wait 0" work?

  • Not sure if I'm doing this right, but here's a link to my .capx file:

    http://jmcdesign.orgfree.com/Flashcards.capx

    This is my *first* Construct 2 program... so go easy on me.

  • I thought a Flashcard app would be a fairly simple way to learn Construct 2, but I'm sort of struggling at the moment. I spend about half my time "coding" and the other half reading forum posts and looking at tutorials, but despite my research some things are just not clicking yet...

    1. If I create a function to manipulate an array, what is the execution flow? For example, let's say I have a 10 line program. Line 5 is a function call. The function is manipulating an array using "for each". Does the "for each" loop finish WITHIN the function before returning to the main program? Or does it process the loop once, increment the LoopIndex, return to the main program until it hits the Function again, at which point it process the loop, increments the LoopIndex again, etc.

    2. I try to put all my code in Groups. When one Group is finished I deactivate it and activate the next group. But what happens when I sort an array? Can I perform the sort and then immediately de-activate the group? How do I know when an array has finished sorting? Are these events asynchronous like Local Storage?

    3. Is there a way to tell how long other array and dictionary manipulation takes? I wound up writing some code like this to ensure stuff has time to finish:

    [GROUP]

    • initialize counter = 0
    • if counter = 0 reverse array
    • if counter = 15 sort array
    • if counter = 30 update array
    • if counter = 40 deactivate group
    • counter = counter + 1

    Is that necessary? Is there a better way to do it?

    Here's what I'm trying to do with my Flashcard App. If anyone has suggestions please let me know!

    DICTIONARY

    id: score

    ARRAY

    score, french phrase, english phrase, id

    I use AJAX to load data.json into my array. Then I use Local Storage to create my Dictionary object. After that I reverse the y axis of my array so the "id" is in the first column. Then I can sort the array by id. This makes it easy to update the array using the values in the dictionary object. (Everyone using the app needs to have their own "score" for each word.)

    After every card I basically do the opposite of the above to save back to Local Storage.

    It's mostly working but I'm getting weird values in weird places and none of it makes any sense. Perhaps I'm trying to sort an array before it has finished reversing, for example. Not sure.

  • That did the trick! Thank you SOOO much. It's sort of obvious now, but I sure wasn't getting it on my own. (It's late here so maybe I'm just tired...)

John Cutter's avatar

John Cutter

Member since 11 Dec, 2015

None one is following John Cutter yet!

Connect with John Cutter