roboscan's Recent Forum Activity

  • Hi Ashley, thanks for your reply.

    Yesterday, I tried running C3 in Edge and in Firefox. More or less, the result was the same.

    Wondering if the issue is related to some other actions I have going on in my project, I deleted my elements, layers, and actions one by one until I saw an improvement. I never did. I even tried adding some "on playback events" (stuck, error, not ready to play) to reveal some text showing when an error occurred, but no response - the preview would just crash.

    I got down to just a single layer with one video element and had it play the video on start. I then previewed multiple times. Sometimes the video played just fine.. sometimes the video was choppy but didn't crash. Sometimes it would be choppy and crash almost immediately. Sometimes it would just crash a half second after starting before it would play at all.

    Again, when I upload to my webserver, the game and video play (mostly) ok. (If my network connection is crappy, I have seen some video errors) but that is it.

    Lastly, I started building this game in C2 and only finally upgraded to C3 two weeks ago because of the improved JSON functionality (thanks, btw!). I was not having these preview issues in C2 with the same video files.

    It's not the end of the world, but obviously being able to preview successfully / repeatedly is a huge help. I was more or less hoping this might be a known thing with some kind of fix.

    (...and I realize it could be something wonky with my video files, but I've edited the video file a few times but the issue stays...)

    Thank you, again,

    J

  • Don't see how I can edit a post - I wanted to add that I am using Construct 3 in Chrome in Windows 10.

  • Hi,

    I am making a game of sorts as a joke for my co-workers. The game starts up, plays an intro screen - when you click to start, it plays a video. Every 10 seconds (time gets shorter as time goes on) a dialog pops up asking a question which they have to answer.

    When I publish this on my webserver, it is running pretty well, however when I try to preview while editing in Construct 3, the preview windows crashes shortly after the video starts playing with "STATUS_ACCESS_VIOLATION" in the browser window.

    It does not always crash at the same spot and it does not always crash. (is "crash" even appropriate here?.) But more times than not, it keeps happening.

    When I try to preview with Debug on, it will display the Debug screen, but when the video starts, the screen just freezes and I can only hear the audio. You can't interact with the game. I don't see anything out of the ordinary with respect to processor or memory.

    I have the video in both Mp4 (about 70mb) and WEBM (about 15mb) available to the game. I have tried removing either file to see if it is an issue with one format or the other, but the problem seems to happen with either.

    I almost get the feeling like the video is not loading fast-enough for playback, but I am using a pretty powerful PC and have my files on an SSD - I wouldn't think file access speed would be an issue, especially compared to streaming from a webserver, where I am NOT having these issues.

    Does anyone have any suggestions of what I can look for as possible causes?

    Thank you!

  • Hi, Went with dictionary. Worked like a charm. Simplified my unique-randomizer function, too. Thank you very much for the help and suggestion!

    J

  • I think I am going to go with a Dictionary - seems like a simpler concept for what I'm trying to do. In essence what I am creating is like a "trivia game." My goal is to simply randomize the questions ("issues" in my case) without repeating the questions.

    If I am understanding, what I am going to do is create a "issueLog" dictionary of keys with no values and just store my "already used numbers" (the "issue" indexes) as the Keys of each new dictionary entry. Then I will use the Has Key condition for the dictionary to determine if that index has already been added to the dictionary and perform the correction actions based upon that result.

    Gonna work on this now - thanks again for the advice!

  • Hi, thanks for your help... do you mean use a dictionary to store my “issueLog” instead of using an array? Just for clarification as I have done a lot with C2 but haven’t used dictionaries that much, the “if exists” functionality that you’re referring to is a dictionary-specific function as an alternative to my looping over the array and attempting to compare each value? That definitely sounds like a cleaner way to do things. I will look at that later.

    Thank you very much!

    J

  • thanks for the suggestion... I just switched from C2 to C3 last night so I didn’t even know there were any new random number tools to try. I will try that.

    (The only reason I didn’t post my code is because it’s very much a prototype at this point with lots of other issues that I was afraid would cloud the issue I was trying to get help with :-). I’m going to try some other options and will fall back to this if I’m not successful. I will post a cleaned up version of my non-working event sheet)

    Thanks again for your input!

    J

  • Hi,

    I am trying to make a unique random number picker for a project.

    The issue I seem to be having is that the loops I created to carry out this process only seem to be iterating one time and not "looping." I am wondering if I am not setting the loops up properly (meaning physically, nesting the condition and sub-events properly in the event sheet).

    My intentions are to repeatedly pick a random number, compare it to the members of a picked-number-log array. If it matches a member of the array, the program will pick another number and try again. If it does not match anything in the array, the program will add that number to the array and return that value as "thisIssue."

    (I am using the result of this as an Index to pick some JSON data.)

    Currently, I created a function ("issuePicker") that contains a Loop (I've tried both WHILE and REPEAT with the same result) that should repeat until a "unique" condition is satisfied (unique < 1).

    When the WHILE/REPEAT loop starts, it picks a random number (assigns it to the var "thisIssue").

    I then run a ForEach loop on a "issueLog" array and compare each member to "thisIssue".

    If a match is found, it adds 1 to the variable "unique" (unique = unique+1).

    If no matches are found, "unique" remains at 0.

    In the next condition, I check If unique < 1 and if so, Stop Loop.

    What I believe should be happening is that for each iteration of the WHILE/REPEAT loop, the ForEach Loop inside of it should execute for each number of elements in the "issueLog" array. If any of the ForEach checks fail, the WHILE/REPETE loop should iterate again and so on until an actual unique random number is found.

    What seems to be happening, however, is that the For Each loop is only executing one time and the WHILE/REPEAT loop is also executing one time. Even if I screwed up the exit process for the WHILE/REPEAT loop, (I think) I should be seeing the For Each loop iterate for at least the number of times there are elements in the "issueLog" array. Correct?

    (I added a test text box and have some "append texts" that should be appending the LoopIndex for the ForEach and the counting and displaying the loops for each WHILE/REPEAT iteration. Both of these text boxes only show a single entry for each of these every time I run the "issuePicker" function.

    When I look at debug, I can see that the random numbers ("thisIssue") is getting added to the "issueLog" array. (In addition I put some dummy entries in the "issueLog" array to start with just for testing... so the For Each should be running multiple times, but it is not. I even tested my WHILE loop by adding the condition "unique < 10000" (just to see if it would hang up my program for 10000 loops) there was no difference.

    Does anyone have any ideas? Does it have something do with my putting the loop inside of a function? Am I just not nesting the conditions and sub-events properly?

    Any help would be greatly appreciated.

    Thank you,

    J

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry I didn't reply sooner, but I just wanted to say thanks again for your help!

    I made that last "game" for my fiance who is an elementary school teacher doing "distance learning" activities with her students like so many others. I am in the process of making a few more interactive activities for her classes using Construct and what you showed me is making that process a bit easier for me than my first version :-). So thanks for helping educate an (early) middle-aged guy and for helping some little kids learn, too!

    J

  • Hi AllanR, thank you so much for your help / time!

    What you did is certainly what I am looking for (my EventSheet had 26 "events" on it so yours was, in fact slightly more efficient :-))

    Besides some of your logic being way more efficient / dynamic than mine, if you wouldn't mind, could you let me know if I am understanding this correctly as this is key to what I was asking:

    1. I see you used a FOR loop in the beginning to spawn new instances of the "Objects" in which you set their initial frame, position, comment and image-point instance variables you created. - This give me a much better understanding of how I can utilize instance-variables, thank you! (I wanted to use a loop to do some initial setup on my version, but since I was using multiple objects I couldn't - well, not without giving them object names ending in numbers and doing int->string conversions in my loop... seemed to complicated so I didn't bother).
    2. The "Objects on DragDrop drag start" is picking up any instance of "object."
    3. Then the object is Dropped, you are performing the actions of final positioning of the Object, adjusting the score and displaying the text all based on the object's Instance Variables???

    The last part is what I was the big one I was missing - my question here is: if I were writing Javascript, I would use "this." to reference an Object's properties... Does the script here "capture" (not sure if that's a good word) the "this." of the Object I was dragging just by dragging that specific object? If so, that is exactly what I have been missing. I was trying to figure out how to "tell" the script to use the properties of the specific object that was being clicked / dragged / touched without having to specifically code for that object.

    If I got that right, THANK YOU for enlightening me! (If I didn't, please let me know.)

    (I also didn't even know about the tokenat() function which will also come in handy for future use.)

    Again, thank you very much for taking your time to help. I really appreciate it!

    J

  • Hi, I am not sure if I am asking the question the best way, or if this answered and I can't find it or just don't understand...

    I've made a handful of small games with Construct 2 and can't seem to figure out how (unless it can't be done) to program functions or set variables dynamically based on objects that meet given criteria. (eg object clicked, or object in a specific position, etc). It seems like I have to re-write code over and over for individual, like objects.

    So for example, say I have multiple buttons and I want some actions to take place for each one that is clicked. Some of those actions may be the same for all (maybe a sound effect, or they open a menu or something) while others would be different (eg the specific action associated with that button).

    Conventionally, I would think do it this way:

    If any button was clicked:

    Determine which button it was;

    Perform some "you clicked any button action"

    Perform some other "you clicked any button action"

    Somewhere later in the code, I could have something like:

    Switch (id of button that was clicked before){

    case A:

    do something specific

    case B:

    do something else

    Case C:

    do something different

    }

    Currently, It seems I have to go about it a different way, repeating nearly all the code for each button:

    If specific button A was clicked:

    Perform some "you clicked any button action"

    Perform some other "you clicked any button action"

    Do something specific

    If specific button B was clicked:

    Perform some "you clicked any button action"

    Perform some other "you clicked any button action"

    Do something else specific.

    If specific button C was clicked:

    Perform some "you clicked any button action"

    Perform some other "you clicked any button action"

    Do something else specifically different.

    (My above example isn't that dramatic, but note the lines of repetitive code)

    of course, I have "cheated" by creating global variables that are set when each button is clicked and then later perform action based on the value of that global variable, but that still feels like a work-around, rather than a proper solution.

    To use an actual example, I recently created a simple kids game where they have to drag words from the right column over pictures on the left. When the word is over the correct picture, something happens. I created the game and it works just fine, but I know I didn't go about it the most "code-efficient" way. (see it in action here: http://jasonlipset.com/testmatch)

    I made the "words" from a sprite-sheet with the thought that I could randomize the order of the words on game start. So, I created the word objects as sprites from a sprite sheet, made 6 instances of them and had each start on a different frame - It didn't work. All the buttons started on the same frame.

    I tried giving each button an instance variable and using that as an identifier but couldn't seem to figure out how to select by the instance variable.

    Secondly, when it came to dragging-and-dropping - when I dragged one, I was dragging all of them at the same time because it seems that I could only reference the draggable object by Object Name (not the instance variable).

    So the logic of the game as it stands, is that you drag the word-object on the right and when you you "drop" it within a specified distance from the position of the correct blank-rectangle-object on the left, it performs a bunch of actions (snaps the word-object into position, colors in the graphic, plays a sound effect, adds a point).

    My logic is fine, but I ended up creating multiple clones of the my word-objects, each with a different object name (deleted the instance vars) and multiple clones of the blank-box-objects. (I could have just used X/Y coords. without actual blank-box objects, but didn't think of that until afterwards.) Then I copied and pasted (editing the relative object names accordingly) each section of code that carries out my functions for each one of the words. This does not make for very efficient scalability.

    In other programming environments, I would have probably used some kind of loop, array, If/else or switch statement that would set/select all the variables regarding position, graphic manipulation, and sound file, based on which item I was dragging in the first place and then just fired off the "function" or lines of code that perform the actions using those variables. But I can't seem to do that in the Construct 2 environment.

    If this is a limitation of the Construct 2 environment, so be it, but if I am going about things the wrong way, any help and suggestions would be greatly appreciated!

    Thank you,

    J

roboscan's avatar

roboscan

Member since 25 Jun, 2015

None one is following roboscan yet!

Trophy Case

  • 9-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

13/44
How to earn trophies