Timers and Progress bars

  • Wondering if anyone can help, new to Construct but not new to programming, which I think might be the problem. In my mind its straight forward, but I cant find what I'm looking for in construct to achieve it.

    Basically, I have text object TxtBuildConstructionDrone thats serving as a place holder till I can be bothered sorting graphics.

    I'm trying to achieve the following but none of the tutorials match what I want and the ones that comes close are, well, poorly written.

    Basically I want the following (pseudo code before anyone says anything);

    On TxtBuildConstructionDrone Click
    	If ResourceMetal is greater than DroneConstructionMetalCost
    		subtract DroneConstructionMetalCost from ResourceMetal
    		Start Timer Loop
    			Each tick update Progress Bar BarBuildConstructionDrone
    			If timer equals 10
    				DronesConstruction++
    	Else
    		#generate error popup
    

    There can be multiple drones building at the same time, different durations which adds another bit of complexity. Can anyone point me in the right direction on how to achieve this?

  • Thanks but I'm not trying to spawn a sprite after 10 seconds. Its the progress bar that updates over 10 seconds I'm having issues with. Hense the reference to "Each tick update Progress Bar BarBuildConstructionDrone"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I did the events like that because you were bothered about multiple drones being built and asked for a point in the right direction, my logic resolves that. How a progress bar updates over 10 seconds is up to you, but doing something every tick is very fast.

  • I did the events like that because you were bothered about multiple drones being built and asked for a point in the right direction, my logic resolves that. How a progress bar updates over 10 seconds is up to you, but doing something every tick is very fast.

    So you give me logic for something i didnt ask for (it literally shows an increment of a variable in the code, not a object creation) and tell me how i sort what i actually asked for help with is up to me. Awesome.

    The reason multiple drones was mentioned is because its relevent to how the progres bars are handled because there are multiple running simultaneously. Nothing more.

  • Hmm that doesn't sound very grateful of the help, remember I am just a random user of Construct helping in my free time, not a staff member. If you want to increment a variable instead of spawn a droid then replace the spawn action with add 1 to variable. I structured the logic so that each droid spawned has its own timer therefore its own progress bar and should avoid anything messy happening.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)