I’m still quite new to programming so please bear with me.
I currently have a countdown timer on my game which counts down from 90 seconds. The countdown timer can be seen by the player. What I would like to do is set things up so that when an enemy is defeated, 20 seconds is added to that countdown time.
Thanks for the reply. I have to confess I don’t really understand this. is this something to do with the extension? was this something that’s attached to the enemy? or variable of some kind? how does this link with the rest of the coding/game build?
my apologies for my lack of knowledge. I’ve only been teaching myself how to do this for the past couple of months!
You can use the extension. Retracted - the extension doesn’t appear to work
To keep using the method you are in the screen snip. change that 90 (which is being subtracted) into a variable, and increase the variable value by 20 (or whatever value).
BTW, to avoid using abs (because when the timer is greater than 90 then the countdown becomes a count up) use “90 - TimerElapsedTime("highscoretimer)”
That countdown timer extension doesn’t work. I created a test app using the events you posted and it doesn’t countdown. I’ve checked the functions and cannot see where it starts the timer or even regularly updates the timer.
Okay, you might have to be very patient with me. I’ve only just started getting my head around variables and did my first one a few days ago ( having the health bar increase when an enemy is killed.) How would I set up a variable for the timer? How do I include that variable in this bit of code?
It’s a shame the countdown extension isn’t working, does that could have been a great way of doing this!
It is old, and it is relying on the timer getting created automatically. What gets me is that there’s no update function that reduces the timer value - it’s only done when calling the start or reset timer action.
Have a looks at this post from a few weeks ago. It’s pretty much the same thing, except you’re increasing the timer while the example in the other post decreases it.
If it’s still a bit much, let us know and we’ll explain it in more detail.
I’m sorry to be a pain but I’m definitely going to need a bit more detail. I’m now starting to feel more confused than when I started this thread! I really want this mechanic in my game, but I can’t seem to connect the variable with the timer.
this is definitely down to me and my own lack of knowledge. as I said before I’m only just starting to get my head around variables and they’ve been one element of Visual coding that I’ve really found quite challenging!
You can get lot of things working just by watching these tutors but whatsmore you will get better understanding of logic - how to create stuff in gdev.
so I’ve made some progress but have stumbled into a roadblock again. I basically set up the timer as a variable. when the enemy is defeated, points do add onto the timer. But it’s not +20. It’s 90 and them + 20 (my countdown timer starts at 90.)
do you know how to get it so that it just adds the + 20?
you don’t need to add -1. There is a subtract option, and you just subtract 1…
But as @radekpilmaier suggested, watch a few of the GDevelop beginner/basic tutorials. It’ll get you going faster, and probably introduce some new concepts for you to lpay around with.