|
Post by yeoldegamersteve on Aug 22, 2018 10:27:10 GMT
I guess there will be an easy way to do this but I'm dumb, I want to have a countdown timer in the form of a bar at the bottom of the screen that is slowly getting smaller.
How would you do it?
|
|
|
Post by lukebord1 on Aug 23, 2018 14:51:45 GMT
The following tip requires at least a basic AGD knowledge.
Create the countdown bar graphics into the character set (e.g. using lowercase letters), then create text messages for the various countdown combinations, e.g.: "aaaaaa", "aaaaab", "aaaabb" and so on, respecting a numerical progression. Setup a variable for the timer and another variable for the message number; when the timer reaches a desired value, then the message number will be increased. Print the countdown bar message in a loop event, done!
|
|
|
Post by yeoldegamersteve on Aug 23, 2018 19:35:12 GMT
Thank you, that's very interesting and I never thought of that.
Like a complete buffoon I was going about it all wrong, I made one block with my bar graphic and tried to use a repeat loop in main loop 1 to display 1-9 copies of the block to show the bar from min to max level.
..no wonder it never worked. haha
|
|
|
Post by lukebord1 on Aug 24, 2018 16:50:00 GMT
...don't worry, nobody says there's just one method to reach a solution. However there're many tested tricks as the one above which help to get the result with less effort, you can try different ways and choose which will result the best for you.
|
|
|
Post by highrise on Aug 25, 2018 0:59:50 GMT
|
|
|
Post by Jonathan Cauldwell on Aug 25, 2018 14:31:21 GMT
In the new MPAGD you can also use PLOT. In addition there's a command to display a variable as a timer, so for example DISPLAY SECONDS 210 would show as 3:30
|
|
|
Post by yeoldegamersteve on Aug 28, 2018 19:34:23 GMT
Thanks a lot!
I wanted it for a game I'm working on, however it might not happen as I can't get the player to move as I want haha (I want the player to be like on a motorbike, one tap and start moving forwards, another tap and you speed up. but I can't get it to work. but that's to be expected as I'm still a newbie and getting to grips with agd)
|
|
|
Post by Charlyf on Mar 12, 2019 22:10:25 GMT
... no se preocupe, nadie dice que solo hay un método para llegar a una solución. Sin embargo, hay muchos trucos probados como el anterior que ayudan a obtener el resultado con menos esfuerzo, puede probar diferentes formas y elegir cuál resultará la mejor para usted. me puedes mostrar el codigo Gracias
|
|
|
Post by Charlyf on Mar 12, 2019 22:10:50 GMT
¡Muchas gracias! Lo quería para un juego en el que estoy trabajando, sin embargo, puede que no suceda, ya que no puedo hacer que el jugador se mueva como quiero jaja (quiero que el jugador sea como en una motocicleta, un toque y comience a avanzar, otro toque y usted acelera, pero no puedo hacerlo funcionar, pero eso es de esperar ya que todavía soy un novato y me estoy poniendo en contacto con Agd) can you show me the code? thanks
|
|
|
Post by Charlyf on Mar 12, 2019 22:49:22 GMT
El siguiente consejo requiere al menos un conocimiento básico de AGD. Cree los gráficos de la barra de cuenta regresiva en el conjunto de caracteres (por ejemplo, usando letras minúsculas), luego cree mensajes de texto para las distintas combinaciones de cuenta atrás, por ejemplo: "aaaaaa", "aaaaab", "aaaabb" y así sucesivamente, respetando una progresión numérica. Configure una variable para el temporizador y otra variable para el número de mensaje; cuando el temporizador alcance el valor deseado, el número de mensaje aumentará. Imprima el mensaje de la barra de cuenta regresiva en un evento de bucle, ¡listo! me puedes mostrar el codigo gracias
|
|
|
Post by Jonathan Cauldwell on Mar 16, 2019 19:56:34 GMT
Here's some example source code for a time bar written in MPAGD script. Put this in one of the main loop events.
; AGD template for a main loop timer bar. ; By J. Cauldwell, September 2015.
; We use T for the time left and U as a counter to determine when we remove a bit of the bar. ; When it reaches 8, we decrement the time bar. By adjusting this value we could speed up or ; slow down the counter for different levels of difficulty.
IF T = 0 AT 0 0 PRINT "TIME" LET T = 32 WHILE T < 255 ; to the end of the screen. LET A = 2 ; start plotting 2 pixels down. REPEAT 4 ; 4 pixel high bar. PLOT T A ; plot a pixel. ADD 1 TO A ; down one pixel. ENDREPEAT ADD 1 TO T ; one pixel along. ENDWHILE ENDIF
ADD 1 TO U IF U > 8 ; every 8th loop. LET U = 0 SUBTRACT 1 FROM T ; timer goes down one. LET A = 2 ; pixels start at 2. REPEAT 4 ; bar is 4 pixels high. PLOT T A ; unplot the pixel. ADD 1 TO A ; next pixel down. ENDREPEAT IF T <= 32 ; have we reached the left edge? KILL ; kill the player. LET T = 0 ; reset T so we redraw the bar next time ENDIF ENDIF
|
|