Alon's Forum Posts

  • Hi All,

    I have 2 families: 1 for buttons, 1 for text.

    Buttons are Sprites, Text are text-object that are OVER the buttons.

    I'm trying to shorten my VERY LONG code to more efficient using the families and "For Each".

    With my old VERY LONG code it works great, but I can't make it work using for each:

    Instead of using every single button (individual object for each button) and every single text-object for each means (lots of objects) like this:

    Which is NOT efficient at all! I want to to make 1 Button Object and duplicate it to how many instances I ever need, same for the Text-Object (ONLY 1 with instances)

    So I understand the "idea" that I will need to pick the UID or something for each individual instance duplication of the Object and the Text.

    The main idea, I will have only 2 objects: Button & Text with their instances (efficiency!)

    But I don't know how to make it work, here is what I start playing around with:

    I've attached a new project C3 File so you can play with to see what I'm trying to do

    >> DOWNLOAD HERE <<

    Thanks ahead! :)

    Tagged:

  • You do not have permission to view this post

  • Hi All,

    I've tried to make a dedicated layout for preloader tile background as the progress bar.

    When running (F4) it seems like it does the job, and loading but the problem is:

    It will show 100% from the moment it starts and not 0% progressing to 100% as it's my goal.

    Can anyone please have a look on my code and help me out, how do I fix it?

    Thanks ahead!

    Tagged:

  • Thanks again!

    Looks like this works: (based on few tests)

    I hope it's on the correct order, after load is complete made more sense to me

    Do I need line 310 again? this event appears already on the original "Language" Group... or maybe I should enable it just in case?

  • By the way, when you save an .alon file, Language variable is saved inside of it too. So when you load this file, language in the app may change. So you might want to restore language and other settings from LocalStorage after loading .alon files.

    OH Thanks, that's good to know!

    So... basically to keep the user language (whatever the user chose) not just when software starts but also after loading a project (file.alon) I should put the "Set Language" line after load is complete?

    Something like this will do the job? (I did a test, but want to be sure if it's efficient enough)

    I want the users to have their chosen language when software starts, but not having issues when save/load projects of course... I did a test and it works (from a quick test) but as you know I'm still a noob and any approve/suggestion is always appreciated!

    .

    EDIT:

    Nope... after few more tests, I noticed it's not working, it loads the language it saved last... :\</p>

  • Thanks again Sensei, that's very helpful!

    I I'll probably have a look on Dictionary it may be useful for other settings all together (if I get the idea right) so I can use "Settings" in general.

    Anyway... it works, but it's very new to me and I want to be sure that it's correct, if you can approve it will be very helpful!

    I have some questions since I'm curious about how it works "behind the scene":

    1 - Is Local Storage creating a file based on the key name or something like .ini or .txt file?

    2 - Is it overwrite when I will use the same key?

    3 - Is it better than the system SAVE/LOAD? I wonder about the differences (speed, efficiency, etc..)

    4 - Can I save ANYTHING to Local Storage? or it's limited to specific things?

  • Don't use Save/Load actions for saving just the language setting. It's like making a full back up of your entire hard drive to save just one document.

    Besides, this can mess with your Undo system and other things. (which that error in the console log is probably about)

    Use Local Storage to save app settings.

    Thanks for the great tip sensei!

    I never used Local Storage, it seems more complex than just "save slot" with a name...

    So I'm not sure what to do, I messed around trying to understand via the documents based on score but it just confused me when I got to my project goal (I know it shouldn't confuse me).

    So... I already have a Global Variable (string) that holds the languages, I'm not sure if I should make another one: "Default_Language" to use the local storage... or maybe no need..

    Here is just a mess (I didn't even finish playing with it) I wish it was simple as Save / Load Slot, but maybe it's not that confusing once I'll understand how it works (no thanks to the documents).

    Should I make each KEY as name of the language? what do I do next? That's a messed-up code that I'm showing you as I'm still playing around trying to understand how it works... sorry

  • Hi All,

    This is my current code:

    I'm not sure I understand the error since I'm still learning...

    When I hit "H" or "E" for testing, the console give me an error and it's not saving to the slot:

    I want the slot to be saved in the RELATIVE path of the project by default so I didn't put a path or directory but I'm not sure if it's anything to do with the error, just guessing.

    What am I doing wrong and how can I fix it?

    Thanks ahead! :)

    Tagged:

  • > Will the collision shape with multiple points SLOW-DOWN everything EVEN if the collision itself are disabled on all objects.

    No. If you don't make collision checks, the collision mask is not used at all.

    True, the objects won't use the mask (polygon shapes) for collision, But the mask used for the Mouse Cursor to recognize each one consider there are a lot of them on the screen at the same time, so I hope it won't use lots of calculating power and slowing down things while moving with the mouse around so many objects on the screen on different machines (modern and older) since I obviously can't test all by myself.

    Mouse cursor moving around over so many object to recognize each one it touches it's mask (polygon shapes with 20-40 points each) I guess it won't be heavy as calculating collisions, but I really hope it won't slow down everything as well... I have no idea how it will work on older machines.

    I hope it won't be a heavy CPU use / calculation.

  • > Will many shapes on the screen, each one with multiple polygon shapes (20-40 points) make things slower?

    Answer your own performance questions with measurements

    I probably didn't make myself clear with my question:

    Instead of just test it on my own machine (where I create my project on), I cannot test it on multiple different machines and know the results.

    So my question is more general: Will the collision shape with multiple points SLOW-DOWN everything EVEN if the collision itself are disabled on all objects.

    The ONLY reason I use them is for more precise mask for selecting via the mouse cursor.

    I hope that my question is more clear now, sorry about my bad English and thanks ahead!

  • Thanks for the quick reply Ashley I see, it make sense but unfortunately on my project it is needed that's why I asked for this.

    I guess I will have to draw manually all my shapes one by one, it will take lots of time and whenever I'll update or change I will have to do it again but it's better than nothing.

    So If I'll use more than 20-40 points for the Mouse Cursor to recognize the shapes on the very edge (as this is what I need in my case), Consider the collision are Disable (I don't need them)

    The question is:

    Will many shapes on the screen, each one with multiple polygon shapes (20-40 points) make things slower? or not necessarily because it's not calculating collision but only use as precise mask?

    If I have no choice and it won't slow-down (please consider also OLDER machines not just modern in your answer) I guess I can just draw them manually one by one...

    unless it is slowing down things, I'll have to find another solution.

    Imagine Over 200-400 or even much more objects on the screen, each with very complex multiple points for their collision polygon... (all collisions are disabled, using as mouse cursor / mask only)

  • Hi All,

    In my project I have many different objects with very complex shapes (not just box, circle, simple shape).

    I'm using the: "Mouse Cursor Over" to pick each object on the layout and tweak them,

    Once there are MANY objects it is very helpful that the mouse cursor touching the VERY EDGE of each complicated shape.

    I must draw a very close Collision Polygon for the Mouse Cursor to recognize it from it's complex shape edges, since a Circle / Box / 10 Points Polygon Shape won't do the job it won't select the objects behind very well (I tried it so many times).

    .

    My Questions:

    Is there a way to tell the Mouse Cursor to recognize the object based on their actual Pixel Shape? and NOT based on their Collision Polygon shapes?

    How can I make the Mouse Cursor to recognize the objects based on their Precise shape instead of the collision Polygon shapes?

    BTW - I'm not using COLLISION on my shapes (they are disable) all I need is 100% Precise shape for the mouse cursor to recognize when I pick each shape.

    .

    I hope there is a precise shape option in C3 since drawing collision shape for each shape (and I have lots of them) is a very time consuming and also not 100% precise anyway, Again I don't need to collision itself but a 100% MASK shape for selection.

    If there is a solution that is hidden from my eyes, please let me know, thanks ahead! :)

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I guess I didn't explain myself very well, sorry about that.

    Not on every 18th frame, but on the specific frames that I will put on the chose, it could be any number frame I want to put there for example: 2, 29, 72, 115, 188, 201, etc..

    For now I just made every specific frame to it's own event, it's just doesn't look as efficient as it could be in one event and a nice expression that I probably not familiar with like they way I used "CHOOSE" to put all the audio I wanted in one expression (I'm aware it's choosing random from the list I put) but it's a good example of one simple expression and I wonder if there is something like that for listing my animation frames, so I can also edit it if I like.

    I think your example with the string is something similar to what I look for if there is no built-in expression for that, I'm not sure but I should try it, thanks! :)

  • Thanks for the quick reply sensei!

    The first solution is not what I'm looking for because I need any of the chosen sounds to play when the specific frame play 1 then 18 then 35... and so on

    The second, I'm not sure but I think it's almost the same amount of lines as I tried and mentioned above, I didn't try it yet so I may be wrong.

    So basically there is no short cut like using the AND "&" so I get the same amount of so many lines in one event, like your second example which I need to try.

    I mean if there is an expression I should inside the Animation Frame [NUMBER] but I guess not.

  • Hi All,

    I have a sprite with long animation (many frames) when it plays SPECIFIC FRAMES I want it to play chosen files (from many files I already imported).

    For example:

    Sprite | Animation Frame = 1 | >>> | Audio | Play (choose("sfx_01","sfx_02","sfx_03" many sounds here.. )

    Sprite | Animation Frame = 18 | >>> | Audio | Play (same as above)

    Sprite | Animation Frame = 35 | >>> | Audio | Play (same as above)

    and so on...

    I tried this:

    Animation Frame = 1 & 18 & 35 but it didn't play any of the sounds...

    .

    Is there a way to do this in one line like using the "&" or even more efficient way using other expressions or something?

    Thanks ahead! :)

    Tagged: