|
Post by claudiamoral on Nov 16, 2020 13:32:36 GMT
Hello guys. How could I make a variable count the new screens that we are visiting (only the new ones), so that at the end of the game we can calculate the percentage of adventure completed? ?
|
|
|
Post by ramon on Nov 16, 2020 14:21:32 GMT
Sólo se me ocurre que sean correlativas y reservar una variable para el nivel más alto alcanzado.
|
|
|
Post by Minilop on Nov 16, 2020 14:37:39 GMT
Hmmm, interesting challenge, I have a solution (if you have enough free memory!) I'm assuming here your game is open, i.e. player can freely move around the map rather than access screens sequentially.
I'm thinking that one to achieve this may be to use OBJECTS, however this will use approximately 40 bytes per screen, we can also take advantage of the global variable SCREEN So, let's say you have 20 screens (0 to 19) You create 20 objects (0 - 19) and set them all to hidden, you don't need to actually design the objects themselves since the player wont actually see them Also we need a variable for counting them (C) In your RESTART SCREEN event:
IF GOT SCREEN ; does the player hold the Object corresponding to the screen number? ; if they do, do nothing ELSE ; if they don't GET SCREEN ; give the player the object that corresponds to the screen number ADD 1 TO C ; add 1 to the counter ENDIF
So, each time they visit a new screen they will be given a hidden object, and we count the number they have been given. It also checks if they already have the screens hidden object and if so doesnt increment the counter, nor give them the object again.
all you then need to do is:
MULTIPLY C BY { whatever 100/total number of screens is } to get your percentage complete
|
|
|
Post by ramon on Nov 16, 2020 15:29:10 GMT
Otra manera de afrontarlo es desde el punto de vista narrativo. En una aventura ("el viaje del héroe" por ejemplo) se van sucediendo los acontecimientos causa-efecto hasta el sacrificio final y éxito del heroína en este caso. Si identificas estos casos en tu juego y los contabilizas puedes hacer tus cálculos. Haber pasado por una sala, tener una combinación de objetos, acabar con determinados jefes finales, conocer personajes secundarios, etc.
|
|
|
Post by ramon on Nov 16, 2020 16:15:58 GMT
Última reflexión. El par NEXTLEVEL RESTART, hace que el juego vaya inevitablemente hacia adelante. De esta manera no solo podrás calcular tu porcentaje, sino lograr que cuando muera tu personaje se coloque de nuevo en la posición RESPAWN.
|
|
|
Post by claudiamoral on Nov 17, 2020 0:15:08 GMT
Hmmm, interesting challenge, I have a solution (if you have enough free memory!) I'm assuming here your game is open, i.e. player can freely move around the map rather than access screens sequentially. I'm thinking that one to achieve this may be to use OBJECTS, however this will use approximately 40 bytes per screen, we can also take advantage of the global variable SCREEN So, let's say you have 20 screens (0 to 19) You create 20 objects (0 - 19) and set them all to hidden, you don't need to actually design the objects themselves since the player wont actually see them Also we need a variable for counting them (C) In your RESTART SCREEN event: IF GOT SCREEN ; does the player hold the Object corresponding to the screen number? ; if they do, do nothing ELSE ; if they don't GET SCREEN ; give the player the object that corresponds to the screen number ADD 1 TO C ; add 1 to the counter ENDIF So, each time they visit a new screen they will be given a hidden object, and we count the number they have been given. It also checks if they already have the screens hidden object and if so doesnt increment the counter, nor give them the object again. all you then need to do is: MULTIPLY C BY { whatever 100/total number of screens is } to get your percentage complete Interesting, the game I'm trying to do is platform, but free. Now I have 39 screens, it would be a suicide to put so many objects, but the idea seems interesting ...
|
|
|
Post by claudiamoral on Nov 17, 2020 0:24:16 GMT
Última reflexión. El par NEXTLEVEL RESTART, hace que el juego vaya inevitablemente hacia adelante. De esta manera no solo podrás calcular tu porcentaje, sino lograr que cuando muera tu personaje se coloque de nuevo en la posición RESPAWN. Genial, la primera idea es la que había pensado en un principio, 7 objetos a coger, dos puertas con otras dos llaves, todo suma porcentaje..total 100%, pero dejando fuera las pantallas visitadas. Lo segundo tendría que ponerlo a prueba que no he usado esto nunca.
|
|