Help with Clock component

Hello! I'm currently working on a game and I cant quite get something working.

So what I want is whenever the bullet hits it will call on the clock which will do damage every 1 second. Although after 3 seconds it stops is there a way I could achieve this?

There is no block for end in duration block, I think an error occurred for this block
we all know that if you leave empty an error will be occurred.

I know but im not exactly wanting people to go along with my code. Im fine if someone can lead me to code something that works.

just set timer enabled and timer always fires to true...

I want to do it on hit but after a few seconds it will stop.

how could I make it stop after a few seconds though?



(images are draggable)
Remember that every 1000 milliseconds is 1 second

Here is an old sample showing how to use a Clock Timer to walk a list of Balls and slow them down while cycling their colors.

You would need similar concepts for your app.

@BlueNight

Using a DurationToSeconds block is not what you need to do.

Try this example, it is similar to what you intend to do.

canvasCollision.aia (8.9 KB)

The test button is used to collide the ball with the sprite. It collides, waits four seconds and you can try again until you deplete health.. :wink: and DESTROY the sprite

thank you all so much!

I'm still working on this but do you see any noticeable problem here?
It isnt lowering/damaging the boss's health from what the slider shows.

what slider? You don't show where you reset it to health value ..and look at the code in your Clock2.TImer

The procedure you set your ThumbPosition probably needs to go (be called) into your Timer2 event handler. A guess, we don't know what else you are trying to do with the code in it.

Do I know for sure? Nope, not when you aren't sharing pertinent blocks. :cry:

For reference, the example aia I posted (which indeed is not exactly what your app needs to do) shows how I used code to post the present health value.

Oh!

Would it be better if I sent my file?

I hope these can help.


I don't know. Difficult to follow your logic. A guess is to poll health and post to slider by using the indicated block into the TImer2 event handler.

In my example, I did all that stuff in the Timer1.Block