brick334's Forum Posts

  • It chooses a colour then checks if the limit was reached for that colour, if not then it assigns that colour. If it hit the limit then it runs the function again, it'll keep running the function until it chooses a colour that hasn't hit the limit. The block at the top where it sets variable to 99 stops the function from looping forever when you create more orb objects than the limit so at that point it will just keep creating the grey default ones, for example in a scenario where you said no more than 3 can appear which would be 12 orbs and you decide to spawn 16 orbs, the last 4 will be grey.

    Yeah, I see that now. I had to really buckle down and even wrote it out on paper to understand it. It's a very simple and elegant solution, well to me atleast. Bravo my guy. So in theory, if I add another color, I would just extend the code in two ways:

    1. Add another variable for the corresponding color.

    2. Add another condition in the function for that color.

    I am curious though, is this bit of code needed:

    -> Browser: Log in console: "setting "&Orb_Base.UID&" to red"

    I would assume no, but I wanted to ask first.

  • This would be my approach to it, though there are probably many ways to do it :

    https://www.dropbox.com/s/vuvyzca319jct0l/ArcadeStacker_edited.c3p?dl=0

    is that a Construct 3 file? I don't have construct 3, only 2.

    **EDIT**

    So i figured out how to open it in c3 free edition and I can't seem to make heads or tails. I can see you made a function, but not sure how that function works (pardon the pun?)

  • Howdy Y'all, I'm here again asking for some wisdom.

    What I'm trying trying to achieve is make several instances of a object. Then limit how many of that type of object there can be. So for example, lets say I spawn five objects, in three seperate rows and assign a random color to each (red,blue,yellow). I want to make it that there can never be more than three of the same color. So, for example:

    red, red, blue, yellow, yellow

    yellow, blue, blue, red, blue

    red, blue, red, yellow, yellow

    so in the above, I know there are 5 of each color and want it so that no matter how many times I run the code, there will always be 5 just in different spots.

    I attached a capx and have tried adding to a global variable but that didn't work out and for each is not exactly doing it. Any help would be greatly appreciated.

    app.box.com/s/b0n9w15me7iulddtlaisox90ed10v44v

  • > That is completely fair and I'm sorry, I'm a bit spastic. I could try to summarise it in three sentences? I think I can do that or just make a new thread. Also, how do you post a project? I just realized I never looked into that. Do I have to use drop box?

    No worries, just trying to make your life simpler.

    If you want to do some training you could fill in some bugs on C3 Github to see what is like You will will be a Master in no time))

    > I could try to summarise it in three sentences? I think I can do that or just make a new thread

    >

    Even with "summarise" the thread can end up 3 pages long lol so the best thing is to open a new thread, also by doing that someone else with the same issue can find your thread because the title will match that specific issue so many more users can benefit.

    > how do you post a project? I just realized I never looked into that. Do I have to use drop box?

    Yes, Dropbox, Onedrive, Googledrive etc...

    Upload it in any of those and they will give a link so you can share it here.

    I will definitely take your advice to heart. Thanks again for your patience.

  • Honestly, I'm totally lost as I'm not sure what are you trying to do or what is the issue as is so many mixes of comments, etc...

    A few tips so they can help you quickly in the future:

    1-Post if possible a minimum project with just the code for those events that are not working so they dont have to go through walls of code.

    2-Explain in sort why is not working.

    3-Explain in sort what is your expected result.

    This way it will make it easier for the user that will try to help you and your issue will resolve much quicker.

    That is completely fair and I'm sorry, I'm a bit spastic. I could try to summarise it in three sentences? I think I can do that or just make a new thread. Also, how do you post a project? I just realized I never looked into that. Do I have to use drop box?

  • > > Hmm, I think some of the content links are dead... but if you use the left navigation it works, which takes you here: https://www.construct.net/en/construct-2/manuals/construct-2/system-object-reference/system-expressions

    >

    >

    > I ask for your patience for a little longer, but I have an awkward question to ask. Have conditions flipped in construct 2?

    >

    > I have some code and I can't help but feel its not working right.

    >

    > it runs along the lines of:

    >

    > If Global Variable "Apple" is NOT equal to "Hold", then start Timer "Fall".

    >

    > The Global Variable "Apple" starts off as equal to "Hold". This means, the above code should not work. However, once I change it to say "Snap", the code should then proc.

    >

    > The thing is, I don't know if its a bug or what but right now construct 2 is not working that way. Right now, the variable is "Hold" and it procs but when i flip the script, it does not work.

    >

    > I'm not a pro, but again, I can't help but feel its not right.

    >

    > Here's a picture to better illustrate.

    > snipboard.io/Jlftxk.jpg

    I think the issue is with your event 4:

    As long as that condition is true it will keep starting the Timers so it will never trigger because you keep resetting both Timers.

    One way to avoid that is to add to that condition a System "Trigger Once" so it only runs once when is true.

    Also, are you sure that you need that timer to run Regularly? As it will never stop, it will keep triggering every "Your Target" second. Though if you need it that way then is all good, but if not then change it to "Type = Once".

    So funny thing, I did some experimentation. Under that same condition, i set it so that it destroys an object when triggered. It worked without a hitch. However, the timer works backwards. To illustrate, I guess set it up like this:

    IF Global Variable Apple is NOT "Still", then start timer and destroy a square

    Again, the Variable Apple is loaded as "Still". When I change it to "Fall", the half the code works, that is the square ( a random one I made) is destroyed but the timer is not triggered. It's not till I change it back to "Still" that the timer starts working. Also, the reason I set the timer to "Regular" is so that as long as the statement is true, it loops. I couldn't get it to loop otherwise.

    Also, to clarify, the above is an example of what I was doing. Its a bit strange that the timers work backward. I tried it in a naked project and same thing.

  • Hmm, I think some of the content links are dead... but if you use the left navigation it works, which takes you here: https://www.construct.net/en/construct-2/manuals/construct-2/system-object-reference/system-expressions

    I ask for your patience for a little longer, but I have an awkward question to ask. Have conditions flipped in construct 2?

    I have some code and I can't help but feel its not working right.

    it runs along the lines of:

    If Global Variable "Apple" is NOT equal to "Hold", then start Timer "Fall".

    The Global Variable "Apple" starts off as equal to "Hold". This means, the above code should not work. However, once I change it to say "Snap", the code should then proc.

    The thing is, I don't know if its a bug or what but right now construct 2 is not working that way. Right now, the variable is "Hold" and it procs but when i flip the script, it does not work.

    I'm not a pro, but again, I can't help but feel its not right.

    Here's a picture to better illustrate.

    snipboard.io/Jlftxk.jpg

  • > > To simplify yourself use "Timers" instead as they use already dt internally.

    > >

    > >

    > >

    > > > On Timer "Increase Speed": 
    > > ------------ad 1 to "Paddlespeed"
    > > ------------Start Timer "Paddlespeed" for 1.5 sec 
    > > 

    >

    > I've been looking into timers, but I'm not sure it would fix what I'm after. Question, in that code; does it add 1 to "Paddlespeed" every 1.5 secs? Or, would I end up with 1 and a half?

    Sorry, I misspelt that you should start the timer with the same tag "Increase Speed" not the name of the variable.

    > On Timer "Increase Speed": 
    ------------ad 1 to "Paddlespeed"
    ------------Start Timer "Increase Speed" for 1.5 sec 
    

    Yes, it will add 1 to "Paddlespeed" every 1.5 second

    The best and quickest way to find out is to test it:

    https://www.dropbox.com/s/afhw6d3smk3xizs/Timers2.capx?dl=0

    Test Both the "Every X Seconds" and the "Timers" and see which one you like more is the same, I prefer the Timer just because has that trigger and its easier to visualize that you running a timer because of the icon, but if you prefer "Every X Seconds" then that is a good option too as its the same, it's all by preference.

    AH, so it does start and stop from the point you "pause" the game. I made a simple test using the capx you gave me. Left click will set time scale to 0 and right will set it to 1. Great way to visualize the actual effect, thank you kindly again.

  • > > To simplify yourself use "Timers" instead as they use already dt internally.

    > >

    > >

    > >

    > > > On Timer "Increase Speed": 
    > > ------------ad 1 to "Paddlespeed"
    > > ------------Start Timer "Paddlespeed" for 1.5 sec 
    > > 

    >

    > I've been looking into timers, but I'm not sure it would fix what I'm after. Question, in that code; does it add 1 to "Paddlespeed" every 1.5 secs? Or, would I end up with 1 and a half?

    Sorry, I misspelt that you should start the timer with the same tag "Increase Speed" not the name of the variable.

    > On Timer "Increase Speed": 
    ------------ad 1 to "Paddlespeed"
    ------------Start Timer "Increase Speed" for 1.5 sec 
    

    Yes, it will add 1 to "Paddlespeed" every 1.5 second

    The best and quickest way to find out is to test it:

    https://www.dropbox.com/s/afhw6d3smk3xizs/Timers2.capx?dl=0

    Test Both the "Every X Seconds" and the "Timers" and see which one you like more is the same, I prefer the Timer just because has that trigger and its easier to visualize that you running a timer because of the icon, but if you prefer "Every X Seconds" then that is a good option too as its the same, it's all by preference.

    Ah! Bangers and Mash! Thank you so much for your patience and help as well as clarification. I'm going to experiment with the times and the file you gave me. My last question, so it functions with DT, so if I want to "pause" the game, would both be paused at that point in time? Then, if I continue time it continues from that point as well? I assume I would set "time scale" to 0 to pause.

  • Hmm, I think some of the content links are dead... but if you use the left navigation it works, which takes you here: https://www.construct.net/en/construct-2/manuals/construct-2/system-object-reference/system-expressions

    Oh my goodie goodness YES! There we go, yeah, I have no clue how you did it. I tried the left navigation but yeah, same problem. Still, thank you very much for your patience, I swear I'm not trying to be trouble. Is there anyway to download the manual?

  • It's all there in the reference section. There's no more comprehensive source of documentation than the manual!

    Honestly, I swear I'm not trying to troll or be difficult. However, when your on this page:

    construct.net/en/construct-2/manuals/construct-2/system-object-reference

    and click on "System Expressions", it just takes you to the main page. Alot of the links in that online manual do the same thing so I'm a little confused. My apologies if this seems frustrating.

  • > I've avoided the "Every X Seconds" command because if I remember right, using "DT" is more accurate or stable.

    You don't need to avoid "Every X seconds". It's already framerate independent, because as the name suggests, it works in seconds, not frames.

    If you want to make your own time counter based on dt, then just adding dt is all you need to do. I'm not sure what you're trying to achieve with the calculation round((dt+1)/2) - there's no need to change it, just add dt by itself, and that's essentially a time counter in seconds. But you may as well use 'Every X seconds' or the Timer behavior for convenience.

    I think you might of just answered my question. The idea was, I wanted to add 1 to "Paddlespeed". However, just using DT gave me two issues. The first was it was way to fast. The second, was that I didn't get whole numbers.

    So, using DT raw would give me 1,2,3,4,5.

    What I wanted was 1....2....3....4....5; essentially a pause between each number. Also, instead of seeing numbers like 1.322, 2.345; I wanted whole numbers. That's why I was trying to use Floor and Round but those never worked.

    But what your saying is that Timers and "Every X Seconds" work the same as just running dt?

  • To simplify yourself use "Timers" instead as they use already dt internally.

    > On Timer "Increase Speed": 
    ------------ad 1 to "Paddlespeed"
    ------------Start Timer "Paddlespeed" for 1.5 sec 
    

    I've been looking into timers, but I'm not sure it would fix what I'm after. Question, in that code; does it add 1 to "Paddlespeed" every 1.5 secs? Or, would I end up with 1 and a half?

  • Howdy y'all, so I'm trying to figure out something that I can't quite get to work. I have a variable I'm calling "PaddleSpeed" and its supposed to hold a whole number.

    I've been experimenting with the DT, trying to get said number but its not quite working.

    I tried:

    1: Everytick -> add to "Paddlespeed" -->round((dt+1)/2)

    2: Everytick -> add to "Paddlespeed" -->floor((dt+1)/2)

    however, when I check these, it always says 0. I'm assuming because the setup in both cases never breaks over one.

    What my goal is, to add "1" to "Paddlespeed" ever, say second and a half or two seconds. I've avoided the "Every X Seconds" command because if I remember right, using "DT" is more accurate or stable. Also, pausing the game will affect anything running of "DT" (if I remember right.)

    any help would be greatly appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The Construct 2 manual is still available online here.

    I must be going nuts or maybe it's been a while. Wasn't there another one, that was way more comprehensive and listed every, for example, expression in construct 2? Also broke it down with a explanation for those expressions?