LiteSnacks's Forum Posts

  • Hello Nepeo

    If you have the time I was wondering if you might expand a little more on POSTing binary data to a server via AJAX plugin?

    From my research and testing the data is POSTed to a PHP enabled server as an array, however after my different attempts to interpret the data, it all returns an empty array, (& unpacking returns an empty string). Am I missing something?

    Thank you for any help you're able to give :)

  • When you POST Binary Data (image) to a php server via Ajax, where is that binary data placed on the server? do I set the URL to a folder? or a php file that handles the data? I realize this questions is beyond Construct 3 data handling; I just need to be a able to request the binary data back via URL in AJAX.

    Thanks for any help.

    Tagged:

  • AshleyMagistross Works thanks again. Although some images i'm testing w/ simply do not load from the string, and then others do. Is there a reason you can think of why this is happening? All the files are jpg.

    What i'm doing is sending the base64 string via AJAX POST to a .php file which writes the string to a text file. Then requesting the data back w/ a .php file echoing the text file.

    Like I said it works with a couple .jpgs, but not all of them.

  • Ashley Exactly what I was looking for thank you

  • Thanks for the response! I will try that when I get home.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There's another thread like this but it's about a year old an the answer wasn't exactly clear.

    How would I go about loading an image via Base64 string from a variable or server side?

    Using the "Load image from URL" and inputting the Base64 string does not work. Is there a formatting issue i'm missing or maybe a step I may have overlooked?

    Thanks for any assistance.

    Tagged:

  • Magistross I know it's been a while but would you be able to expand a little more on the URI format you provided?

    I have the base64 string saved to a var. Would I be able to load from that? Or directly from the Server?

    Thanks

  • I meant to include "https", but the issue ended up being the SSL certificate wasn't properly configured. Thanks for the reply :D

  • I have a solid understanding of how AJAX works. My question is to get help eliminating road blocks I have overlooked; right now AJAX is returning error.

    Here's what my event attempting to "read" a text file looks like:

    Button: On Clicked ---> AJAX: Request "http://fileLocation/textfile.txt

    AJAX: On completed ---> requestStatus.text: Set text to AJAX.LastData

    AJAX: On error --------> requestStatus.txt: Set text to error

    - I do have do CORS authorization on my web server

    My web server is php enabled if that helps out.

    Any thoughts? Thank you in advance for any help :)

    Tagged:

  • try:

    on [shoot button] pressed

    repeat 5 times

    ---> create object (bullet)

    ---> set angle (bullet) to "gun.angle + random(-15,15)"

    this example creates a bullet, then sets its angle to no more than 15 degrees off the direction the gun is pointing. repeated 5 times. a bullet behavior will automatically move the bullets forward the set angle.

  • omg that's perfect, i can't believe using two different rooms for lobby & gameplay didn't cross my mind. Thanks for your input; very helpful.

  • how are your conditions set up?

    if i had to guess, you are having the jump animation begin playing while the jump button is down; like so:

    "[jump key] is down ---> play animation (from beginning)".

    if this is the case, the animation is starting from the top 60 times a second while the jump key is down, & as consequence you are only seeing the first frame; there are many solutions, but here are a couple basic ones:

    1. change "[jump key] is down ---> play animation (from beginning)" to "[jump key] pressed ---> play animation (from beginning)

    2. add a "trigger once while true" condition to "[jump key] is down ---> play animation (from beginning)" condition

    these both accomplish the same task, but option 1 is much better practice.

    hope that helps

  • i understand hosting multiple peers and starting a game w/ everyone connected & playing together. however is there any tips out there about syncing peers into groups?

    for example if 8 peers joined a room for the game "pong" (w/ a dedicated server acting as host). but when the game starts each peer is paired up & have there own game, totaling 4 games of pong. Then pretend this is repeated 7 times so every peer gets a chance to play the other peers in the room.

    i have the language set up for assigning peers their next opponent though IDs over multiple rounds, however i am stumped on syncing only one peer to another w/o the others interfering.

    i hope this was clear, & thanks for the help. i will continue studying the examples & post a solution if i come across one

  • thanks for the comments. i experimented w/ individual timers using instance variables but felt like there just had to of been a better way of going about it. perhaps its the only way.

  • say you have a sprite w/ the turret behavior & you want it shooting its fire rate no matter what; without targets, while rotating, nothing in range, ect.

    creating a "fake" shooting behavior using system events is difficult. this causes multiples of the same turret to all fire simultaneously, not independent of their own firing rate.

    ideas?

    thanks