Rable's Forum Posts

  • TL;DR : when created in a function, objects need a wait 0 second event before they can be modified. Is there any better way to access an object that has just been created in a function?

    [EDIT] : Solved, see below.

    Hi everyone,

    I would like to ask you something I’ve run into multiple times and makes me scratch my head. Hopefully you can help me better understand how functions work.

    I noticed that when creating an object inside a function, you can’t access this object directly in the event which called the function.

    This will only set to scale 0.2 previously existing sprites.

    ***

    However, you can access that object by inserting a “wait 0 seconds” event just after the function.

    This will set all object to scale 0.2 including the newly created sprite.

    ***

    When the object is already created, modifying it in any way takes effect immediately.

    For example you can set an existing object instance variable in a function, then in the same event that called the function access this object based on this newly set instance variable without waiting 0 seconds.

    The object is immediately destroyed.

    ***

    It goes as far as making a function which set an object’s instance variable, then creates a new identical object with the same instance variable set to the same value –

    Then in the event which called the function, deleting all objects with that given value, will only destroy the old object, not the new one.

    Only the old objects are deleted. The newly create object is not deleted, even though its number value is correctly and immediately set to 5.

    ***

    Please note that everything behaves exactly the same in C2 and C3.

    So I have to questions:

    1) Is it normal? How do you explain that behavior?

    2) What is the most correct way to access an object which was newly created in a function

    You can find the Capx with the different tests here : https://www.dropbox.com/sh/u73o34q4a3pz ... 9VKga?dl=0

  • Thanks for taking the time to explain that. It makes sense but I agree that obvious entries should be returned first, so I'll make a bug entry as you propose.

  • Hi,

    I don't post this as a bug as I'm not sure if it is intended or not. I have personally a hard time with how C3 manages the way we can type into the text field on "add action" and "add condition" dialogs.

    For example, in C2 I used to type C > enter > tr > enter

    and very quickly I added a "trigger once while true" condition to my event.

    In C3, typing "tr" after selecting system, will focus on "compare two values". (!)

    instead of "tr", the shortest string I can type to focus "trigger once while true" is "ger " which is 2 times longer, but the real problem is that we'll have to learn new fastest method to access such actions when switching to C3.

    Another example is that "compare two values" could previously be accessed by entering "co", while in C3 you have to type as much text as "compare t" for it be focus. Curiously, and as stated before, just entering "tr" selects "compare two values".

    I really have a hard time to find the logic behind the new way to select actions/condition in dialogs with the text field, which is the way I'm working 99% of the time. Would it be possible to let us know the logic behind that, or tell us if the current way is definitive or if it will be changed to be closer to the experience we had with C2?

    Thanks a lot!

  • Amazing! Thanks a lot rexrainbow , I haven't been able to reproduce the bug since the new update.

  • OddConfection

    That's a clever idea!

    I tried it (with browser orientation), and the result is sadly not what we would expect. The layout indeed rotate 90 degrees, but the window doesn't change size and doesn't rotate (I'm in letterbox scale fullscreen mode). So basically if you're holding your phone in portrait, you've got a small horizontal window in the middle , with the layout inside it rotated 90 degrees. You see a part of the rotated layout in the middle and large white borders on the left and right of the small window.

  • Both are working for me too, as well as fullscreen mode, as long as I am on desktop.

    On mobile / tablet I can't have the fullscreen to work. If you try the link I gave in the first post, are you able to play in fullscreen on both desktop and mobile?

    I personally don't.

  • FYI I still had a problem even with "Audio Effects" property set to "OFF" in the following sequence:

    On layout 1 play a music with the basic Audio plugin

    On layout 2 stop the music with basic Audio plugin

    On layout 3 stop the music with AudioHelper plugin, with 1 second fade-out (even though the music has already been stopped in layout 2)

    Go back to layout 1 before the end of the fade-out, the music has a problem similar to the one experienced in the capx I posted in my previous comment. This happens with the very last (updated today) version of the plug-in.

    I fixed it very easily be deleting the audiohelper action on layout 3 (it was useless anyway), but wanted to warn you that such error in the events could cause audio problems.

    [Edit]

    I made a capx to show you the problem.

    [Edit2]

    In the capx above, going from layout1 directly to layout3 also creates the problem. Furthermore, adding "remove all effects" from tag "music1" at the start of layout1 does not help.

    In other words, if tag "music1" is currently being faded out with audio helper, and you change layout before the end of the fade out, and the new layout wants to immediately play the tag "music1", then the tag "music1" will not play anymore.

  • Oh and it needs to be an HTML5 game playable in a browser, no export with cordova.

    Thanks for the reply, but I don't want to make an APK. The game should be playable fullscreen and horizontally in a browser. :/

  • Thanks a lot, rexrainbow !!

    I set the Audio effect property to "No" and it perfectly solves the problem in the previously attached .capx!

    Looking forward to use your plugin to its full potential!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > Any thoughts on a port for Construct 3 of the plugin?

    >

    > Thanks,

    > efinitely going to happen. I believe for now the C3 plugin sdk only supports global plugins.

    Awesome! C3 definitely needs the Spriter plug-in.

    Looking forward to it!

  • Hi rexrainbow ! I love this plugin, thanks for making it!

    However I had to stop using it because I have huge problems with tracks with a specific tag not playing anymore (at all) after being stopped with a fade out.

    I'm probably doing something wrong here, so I made a small capx to show you the problems I have. You may have a simple solution to avoid that.

    Here is an image of the capx's code. Event sheet 2 is the same with swapping music 1 for music 2 and vice-versa, and Layout 2 for Layout 1.

    I had the problem on both a version of the plugin I downloaded 1 year ago, and the latest version I downloaded today.

    Thanks in advance for any help you could provide.

  • Using rexrainbow 's plugin seem the way to go:

  • Didn't you put a "simulate control: Jump" action on start of layout or something like that?

  • Hi everyone,

    A client asks me for an HTML5 game which will be played mostly on mobile, and the game needs to be locked horizontally.

    I referred to this tutorial by Ashley, in which I learned that screen locking only happens after requesting fullscreen, and fullscreen is potentially not supported on every browser.

    So I made a test, and fullscreen mode is working fine on desktops, but not in a single mobile browser.

    I tried the following browsers:

    iOS Safari

    iOS Chrome

    Android Browser

    Android Chrome (on 2 different devices)

    and the fullscreen mode is never recognized on mobile devices. Which is a big problem for me... <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad"> Is there any workaround which would allow me to lock orientation? Or maybe did I do something wrong?

    On the link above I see that most browsers are notes as "partially supported". Do I need to do something special to access that feature?

    On the code standpoint, I defined the Orientation as "Landscape" in the project settings, and am requesting the fullscreen on the title screen, on a "Touch" trigger event.

    If you want to test the game, here is the WIP: http://test.smurf.com/drop18/

    Oh and it needs to be an HTML5 game playable in a browser, no export with cordova.

    Thanks for your help!

  • Pode

    Nice plugin! Sadly, it doesn't work for me.

    I exported your example as HTML5 (to be perfectly clear, I didn't change anything in the capx) and runned it on Chrome and Firefox, and the camera is never recognized. The UserMedia object stays black even when pressing "open" or any other button.

    Tested on Chrome on a Huawei P8 Lite (phone, not tablet) with android 5.0.1

    and on iPad Air 2 with Chrome v.58.0.3029.83 and Safari

    Then I exported to android via Phonegap, installed the app on my cell phone (Android, Huawei P8 Lite), and the UserMedia object still stays black at all times.

    When building via Phonegap, I unchecked "minify script", and checked "uses camera" and "uses media" under permissions.

    Any idea about what I'm doing wrong?

    Something to define in Phonegap Build maybe?