Fengist's Forum Posts

  • And I run this:

    + System: On start of layout
    -> AJAX: Send "" to URL "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" (method "HEAD", tag "example")
    
    + AJAX: On "example" completed
    -> Text: Set text to "passed"
    
    + AJAX: On "example" error
    -> Text: Set text to "failed"
    

    And it comes back passed which looks exactly like what you have.

  • I personally couldn't get example.com to work. But to do a "HEAD" call which only returns the header of the site you're contacting and not all of the content (which is smaller memory wise and a fraction of a second faster), change the first line in my example to this:

    -> AJAX: Send "" to URL "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" (method "HEAD", tag "check")
    
  • Also, keep in mind that anything you have set to global is created for the duration of the game once it is created unless you specifically destroy it.

    For example. Drop a button and a text on a layout. Create another layout and drag the same button and text onto it. Have the button on layout 1 go to layout 2 and have the button on layout 2 go to layout 1.

    If you run it in the debugger, and expand the trace for the text object, you'll see that when you click the button to switch layouts, it creates an 'instance' of the text for each layout and destroys it when you switch layouts so that only one instance of the text exists at any one time even though you have it on 2 layouts.

    If you set that text to global though, it still creates a new instance when you switch layouts but doesn't destroy the one from the previous layout so you end up with two instances, just different UID's.

  • He's saying if you don't want to host your own file/site, use example.com as the url. And don't use the ajax post or get, use the head call, which I'd agree with.

    The problem I have with any site or domain other than your own, you can't guarantee that they'll always be there.

    As far as the tcp, I assume he means websockets. If c3 or c2 has some way of sending tcp/udp packets without writing JS, I'd love to know about it.

  • For that, your best bet is to likely start another topic and post a c3p file. I can think of a hundred things that would keep text from displaying.

  • Hi Fengist,

    I'm using tags, but the audio effect still plays. I'm wondering if I need to include an event connected to clicking the Left mouse button as that's what triggers the sound but I'm not sure how to do this.

    In some way, whether it's through the variable Mario suggested or through a mouse click, you'll need some event that turns it off. And once you do, make sure there's nothing else that will trigger it starting again. The Audio.Stop All should stop all sounds from playing regardless of the tag.

    Here's an example of how I'm using a mouse click on a sprite event to start music playing. Stopping it is done the same way.

    + Mouse: On Left button Clicked on NewGameButton
    + System: [X] Is ChoiceMade
    -> Functions: Call PlayEffect (Name: "UI_Quirky30")
    

    You'll notice that calls a function. One of the things I do to help keep things organized is to create an entire event sheet just to handle audio events and include it in any other event sheet that needs to play audio. That way I just call a function to play music or sound and pass the file name. If I need to adjust things or change the way all audio is played, I can change the function without having to find every single event where I play audio.

  • You are playing the sound every tick - looks like if Mario is in the air, you play the sound. Just play on the jump. (Or you can probably add 'Trigger once while true' to your condition.)

    Didn't notice that. That would definitely add some strange effects to the sound.

  • One of the tricks I use is that all music is played with the tag "background." All effects are played with the tag "effects." Whenever I need to stop one, I can audio.stop("effects").

    Are you using tags?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Fengist Dude, that was so rude of me, It didn't come out right and I didn't get a chance to edit when I got banned. I'm sorry, I misread.

    Apology accepted. Don't ever make me throw Monty Python at you again.

  • Eric Matyas is a local hero who has a huge collection of sound effects and music you can play with. Just to confirm that it may be in the conversion, go to his website, pick a sound file and test it.

    His thread is here:

    construct.net/en/forum/game-development/tools-and-resources-27/building-library-images-120828/page-8

    soundimage.org

  • Making a farce like that seems to just show ignorance.

    Oh, and if making a farce shows ignorance then the guys at Scirra should truly appreciate the humor in it.

    media.giphy.com/media/7cAGURf0zN2Bq/giphy.gif

  • The X & Y are inverted due to how early computer monitors work, so that's normal. Making a farce like that seems to just show ignorance.

    I've been writing code in one language or another since 1979 and I have never seen the x,y inverted on anything. X has always been the columns and y has always been the rows. So if I'm ignorant, I've been blissfully so for 40 years.

  • I've also popped a few neurons trying to decipher the debug output from 3D arrays.

    Ashley maybe it would make things a little bit more readable if the z layers were bracketed?

    Fengist's x=0 would then look like:

    (370,-1,-1,-1),(222,-1,-1,-1),(913,-1,-1,-1)...

    ...which is a lot easier to parse.

    That would have at least made me stop and realize it wasn't an x,y,z representation. I was working with hundreds of cells and didn't stop to count them so it never occured to me that it would be anything but x,y,z. Thank god it wasn't a 200x200x200 array, I would have lost my mind trying to figure out which was which.

  • Real simple setup. 10x10x4 array. Clear the array to -1 The test, loop through the x and y for the array, set the x,y on z=0 to a random number.

    + System: On start of layout
    -> Array: Clear to -1
    ----+ System: For "X" from 0 to 9
    --------+ System: For "Y" from 0 to 9
    ---------> Array: Set value at (LoopIndex("X"), LoopIndex("Y"), 0) to round(random(1,1000))
    

    and this is what debug showed me

    I kept thinking, "What the hell? It's skipping over the cells like it has a 'step 4' in the loop" Took me several hours (working with a much larger array, turning function bits on and off mind you) to realized what a jumbled mess that watch output is. It's not the x,y of the 0 layer like I expected. It's the y,z of the x row. What the??? Look guys, I know you Brits do things differently like driving on the wrong side of the road. But seriously, when you go to a museum, do you stand in FRONT of the painting or do you hug the wall and look at the edge of the frame (don't answer that, the dry British humor of an answer will escape me)? Because we Yanks are very x,y,z spatially oriented. Hell, we're even alphabetically oriented that way. That y,z,x thing, man, that's like... driving on the wrong side of the road.

  • I've written software in other languages that needed internet connections and what I've discovered is that many functions like .isOnline are querying some driver or some device and often don't really know if the device is connected or not.

    One of the easiest ways in Construct and one pretty much guaranteed to pass or fail, is to do an Ajax call to a website you know is going to be up and one that accepts Ajax calls from anyone. Or, create your own php file on a webserver and do an Ajax call to it.

    Google has a bunch of resources that accept open Ajax calls. One is for jquery, both current and past versions:

    ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js

    + System: On start of layout
    -> AJAX: Request "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" (tag "check")
    
    + AJAX: On "check" completed
    -> Text: Set text to "Passed"
    
    + AJAX: On any error
    -> Text: Set text to "Failed"
    

    That simple test will pass.

    So, in theory, if you set the url to the current jquery version, it should, I say should, still work years later. Version 1.2.6 came out in 2007 but if you put this url in that check:

    "https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"

    It still passes.

    The thing you have to keep in mind is that Google has a HUGE history of changing their mind about things so having it check your own url is, most of the time, a safer bet. You'll still have to worry about your host servers crashing, internet outages and such but at least the domain is yours and you can take it wherever you wish.