jsutton's Forum Posts

  • You can use the drawing canvas plugin on android and save as png or jpg(%),then export as binary or base64, etc.

  • I ran into an issue (solved) and am curious.

    Scenario: A 250x250 sprite, with 1 animation and 100 frames. Load an image from array, set size based on with or height and put it into a chat feed.

    The issue: I cloned the sprite on the project bar and used it for some other images in the same feed.

    Sprite2 images would not load properly until (and this is the part that solved the issue) I actually added Sprite2 to the layout and deleted it on start. Now "On create, load from URL" works as intended.

    Just curious if there is something about loading a URL that requires the Sprite into be in memory?

  • The short answer, all of the global variable "Random_Number".

    For clarity, I'd just change "Random_Number" to "Question_Number", and set "Question_Number" to a value prior to calling the function. Then delete the first line of code that is setting the global to a random of your array size.

  • That wasn't the point, but you are correct!

    However, if you have something like animation by name, and you quickly want to swap it.

    Or any hardcode that should really be a variable, or a variable name that you would swap to another, etc, etc, etc.

  • It would be the ability to highlight sections of code and to find/replace inside the selection.

    (Just the text part not any of the actions or objects, that's already available)

    Example: for each, loopindex of "abc" then have the ability to highlight the lines of code that have "abc", find "abc" replace with "xyz"

    It must be a pain to code that, otherwise I'd assume it would have been done.

  • There are easier ways probably, but this would work.

    Assume the array.height is 10, and the width is the number of moving pieces.

    then just subtract y value difference for the moving pieces. (abs to keep them always positive if needed)

    If you don't need the array you could just set variable to the overlapping square value and sum, etc.

  • When loading an image from url, if the image is the same as the original frame, ie the actual sprite animation frame (could be blank, or a generic picture, whatever) C3 will not overwrite the image and uses the last frame loaded from a url.

    Took me a couple hours to figure this one out.

    Finally figured it out by using the clear image data. The image that was different would override the image that mirrored the sprites actual image (but not vice versa). I fixed it by changing the color of the imported frame to where it was a shade darker than the actual animation frame and it works fine.

    Worthy of a bug report or just work around it?

  • Assuming "DRY" (don't repeat your code), how are you all sorting the hard coded functions?

    Seems like a balancing act to keep the list from getting massive. Little loops in a function, or a standard "create xyz" calls add to the list and make things difficult to find. Are y'all just hard coding the little stuff now?

  • The reason I used the array was to see what the DC.snapshot"color"at was retrieving.

    Your using 50 as your lower bound, but unless I'm mistaken, the number your getting is a 1-100 color scale (your 50 is likely the equivalent of 127.5 on the 255 scale).

    I didn't run your math, on the +/- to see if that's returning correctly (as in is it picking up 100,0,0 and so is 100,11,11 etc. as red, I figured you verified all that.)

    I'll bow out and perhaps someone else has a clue. Good luck!

  • I played around with this a bit.

    How many colors does the user get to choose from?

    And are you checking this once the user is done with a color, or at the end?

    I ended up using a 3d array (RGB and not storing Alpha), then ran a function to get the count of colors. Then used an AND statement to tell what color (in a range). It's very labor intensive to run that for anything over 500x500 pixels.

    If you could figure out how to decipher the drawingcanvas.colorvalue that might be a way to solve your issue but I couldn't figure that out. (Would eliminate the need for an array, which was very clunky)

    Or if you limited the color pallet and could key off the exact value stored (this would be much easier but not as nice for the user experience).

  • Have you considered just storing the colors used for each session in a temp array or dictionary and looping with those criteria?

  • Tested this out this morning.

    Your explanation:

    "Pick all is actually used to reset the "selected object list" (SOL) when it is currently filtered and you wish to select through all instances again."

    You are spot on.

    In testing this text1.var= worked as you indicated.

    In my main project I have multiple "picks" of text1 in sub-events (4 deep) which based on your info indicated I needed to clear the SOL (ie, use the the "pick all" in conjunction with the WHERE criteria).

    Makes sense now, works as expected, and is repeatable.

    Appreciate your responses and the education.

    (just in case someone else finds this while researching "pick")

    construct.net/en/tutorials/sol-object-scopes-that-2284

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For giggles I just saved the project as a new file and tested this out.

    Unfortunately, that too only triggers for the last tex1 and does not pick all the var=1

    addendum, adding a pick all and then your suggestion works. (Same as the pick all AND pick by comp)

    Looks like the pick all basically just needs a specific criteria (as in not a comparison or calculated field, no clue why).

  • Well I'll be. Thanks for the help. Not sure I how I missed this little nugget.

    Thank you again, I've been complicating the hell out of this process for years.

  • touch/click executes very quickly.

    If you have issues, try putting a "wait: 0.1" seconds on the touch end.

    (just putting this out here to help others too)

    Not your exact situation but a common variation of your question.

    touch start, set sprite.scale=0.9 and sprite.var_touch = 1

    On "any touch end" AND

    "touch is touching" the sprite, set scale to 1 and var_touch 0, wait: 0.1s and execute your code.

    else set scale 1 and var_touch 0

    Gives the user some feedback (shrinking, expanding, etc) and allows for smooth transitions.

    The only other tip I might add, in places where it is critical the button is only pushed once, I've found it's best to delete the button instantly upon touch end then execute (and if there is only one of that sprite check the sprite.count to be doubly sure. etc etc)