A downloadable game

Explicación del código

1 print at 8,2;"You are Offline"; at 9,5;"Q to JUMP"
2 let j = 0
3 let i = 15
4 print at 18,i;"\## "; at 16,2;" ";at 17,2;" ";at 18,2;" ";at 18+j,2;chr$ 139;
5 if i = 2 and j = 0 then : stop
6 IF INKEY$="Q" and j = 0 then let j = -3
7 let i = i - 1
8 if j < 0 then let j = j + 1
9 if i = 1 then let i = 15
10 goto 4

Al principio realicé el juego en 12 líneas al reducirlo a 9 líneas use la línea 1 para mostrar el

nombre y las instrucciones.

La línea 2 define la variable j, que se usa para saber si se está saltando o no, si está

saltando el valor es negativo, si no está saltando el valor es 0.

La línea 3 define la variable i,que define la posición horizontal del enemigo.

La línea 4 pinta al enemigo al jugador, y borra las otras posiciones que puede tener el

jugador. El enemigo tiene un espacio detrás de él para que se vaya borrando la posición

anterior al moverse.

La línea 5 comprueba si ha chocado el enemigo con el jugador y termina la ejecución si se han chocado

La línea 6 comprueba si se está pulsando Q y no se está saltando, mediante la variable j. Si cumple las dos condiciones se cambia el valor de la variable j. La próxima vez que se pinte el jugador estará dos caracteres por arriba.

La línea 7 reduce 1 el valor de la variable i, esto hará que cuando se vuelva a pintar el enemigo se haya acercado al jugador.

La línea 8 comprueba que si se está saltando baje un carácter el jugador.

La línea 9 hace que si la posición de enemigo es 1, se ponga a la derecha

La línea 10 retorna a la línea 4, esto es para que se cree el bucle infinito de la línea 4 a la

10 mientras no choque el enemigo con el jugador.


Explanation of the code

1 print at 8,2;"You are Offline"; at 9,5;"Q to JUMP"
2 let j = 0
3 let i = 15
4 print at 18,i;"\## "; at 16,2;" ";at 17,2;" ";at 18,2;" ";at 18+j,2;chr$ 139;
5 if i = 2 and j = 0 then : stop
6 IF INKEY$="Q" and j = 0 then let j = -3
7 let i = i - 1
8 if j < 0 then let j = j + 1
9 if i = 1 then let i = 15
10 goto 4

At first I made the game in 12 lines by reducing it to 9 lines use line 1 to show the name and instructions.

Line 2 defines the variable j, which is used to know if it is jumping or not, if it is jumping the value is negative, if it is not jumping the value is 0.

Line 3 defines the variable i, which defines the horizontal position of the enemy.

Line 4 paints the enemy to the player, and erases the other positions that the player may have. The enemy has a space behind him so that the previous position is erased when moving.

Line 5 checks if the enemy has collided with the player and ends the execution if they have collided

Line 6 checks if Q is being pressed and not skipping, using the variable j. If both conditions are met, the value of variable j changes. The next time the player is painted, they will be two characters up.

Line 7 reduces the value of variable i by 1, this will make the enemy approach the player when it is repainted.

Line 8 checks that if the player is skipping, the player drops one character.

Line 9 makes if the enemy position is 1, it goes to the right

Line 10 returns to line 4, this is so that the infinite loop from line 4 to 10 is created as long as the enemy does not collide with the player.

Download

Download
You_are_offline.bas 315 bytes
Download
You_are_offline.p 1 kB
Download
You_are_offline.pdf 385 kB

Leave a comment

Log in with itch.io to leave a comment.