Post by ramon on Dec 3, 2020 15:36:22 GMT
Te propongo un mecanismo para mover Sprites con diferentes velocidades. Se trata de salir con el comando “EXIT” justo antes de mover el sprite según un patrón rítmico.
Definimos los siguientes patrones rítmicos de movimiento (“1” mover, “0” salir):
I propose a mechanism to move Sprites with different speeds. It involves exiting with the “EXIT” command just before moving the sprite according to a rhythmic pattern.
We define the following rhythmic movement patterns (“1” move, “0” exit):
; VELOCIDAD 1+ 100000
IF Z = 0
ELSE
EXIT ; si Z <> 0 entonces salir (then EXIT)
ENDIF
; VELOCIDAD 2+ 100100
IF Z = 0
ELSE
IF Z = 3
ELSE
EXIT ; si Z <> 0 y Z <> 3 entonces Salir (sin mover). "then Exit (without moving)".
ENDIF
ENDIF
; VELOCIDAD 3+ 010101
IF Z = 0
EXIT ; si Z = 0 entonces salir
ENDIF
IF Z = 2
EXIT ; si Z = 2 entonces salir
ENDIF
IF Z = 4
EXIT ; si Z = 4 entonces salir
ENDIF
; VELOCIDAD 4+ 110110
IF Z = 2
EXIT ; si Z = 2 entonces salir
ENDIF
IF Z = 5
EXIT ; si Z = 5 entonces salir
ENDIF
; VELOCIDAD 5+ 111110
IF Z = 5
EXIT ; si Z = 5 entonces salir
ENDIF
; VELOCIDAD 6+ 111111
; Es justamente la del AGDEngine. No usa comando EXIT.
"It is precisely that of the AGDEngine. Don't use EXIT command".
Colocaremos el “código rítmico” correspondiente justo antes de la sección de movimiento de nuestro Sprite, de esta manera se interrumpe al salir del script. Ten cuidado, de no interrumpir otro código sensible.
"We will place the "rhythmic code" just before the movement section of our Sprite, this way it is interrupted when exiting the script. Be careful not to interrupt other sensitive code.".
EVENT PLAYER
; Rocket man controls
…
; VELOCIDAD 3+ 010101
IF Z = 0
EXIT ; si Z = 0 entonces salir
ENDIF
IF Z = 2
EXIT ; si Z = 2 entonces salir
ENDIF
IF Z = 4
EXIT ; si Z = 4 entonces salir
ENDIF
…
; sección de movimiento
…
Para un enemigo coloca otro patrón, así:
"For an enemy place another pattern, like this":
EVENT SPRITETYPE4
; enemigo
…
; VELOCIDAD 5+ 111110
IF Z = 5
EXIT ; si Z = 5 entonces salir
ENDIF
…
; sección movimiento
...
Para que esto funcione debes poner un contador en mainloop1:
EVENT MAINLOOP1
...
; Contador de frames del juego
ADD 1 TO Z
IF Z > 5
LET Z = 0 ; pulso (tic) 0, 1, 2, 3, 4, 5
ENDIF
…
Aquí tienes un ejemplo, las plataformas se mueven a velocidad 1+, y el resto a velocidad 6+ (100%):
"Here is an example, the platforms move at speed 1+, and the rest at speed 6+ (100%)":
Definimos los siguientes patrones rítmicos de movimiento (“1” mover, “0” salir):
I propose a mechanism to move Sprites with different speeds. It involves exiting with the “EXIT” command just before moving the sprite according to a rhythmic pattern.
We define the following rhythmic movement patterns (“1” move, “0” exit):
; VELOCIDAD 1+ 100000
IF Z = 0
ELSE
EXIT ; si Z <> 0 entonces salir (then EXIT)
ENDIF
; VELOCIDAD 2+ 100100
IF Z = 0
ELSE
IF Z = 3
ELSE
EXIT ; si Z <> 0 y Z <> 3 entonces Salir (sin mover). "then Exit (without moving)".
ENDIF
ENDIF
; VELOCIDAD 3+ 010101
IF Z = 0
EXIT ; si Z = 0 entonces salir
ENDIF
IF Z = 2
EXIT ; si Z = 2 entonces salir
ENDIF
IF Z = 4
EXIT ; si Z = 4 entonces salir
ENDIF
; VELOCIDAD 4+ 110110
IF Z = 2
EXIT ; si Z = 2 entonces salir
ENDIF
IF Z = 5
EXIT ; si Z = 5 entonces salir
ENDIF
; VELOCIDAD 5+ 111110
IF Z = 5
EXIT ; si Z = 5 entonces salir
ENDIF
; VELOCIDAD 6+ 111111
; Es justamente la del AGDEngine. No usa comando EXIT.
"It is precisely that of the AGDEngine. Don't use EXIT command".
Colocaremos el “código rítmico” correspondiente justo antes de la sección de movimiento de nuestro Sprite, de esta manera se interrumpe al salir del script. Ten cuidado, de no interrumpir otro código sensible.
"We will place the "rhythmic code" just before the movement section of our Sprite, this way it is interrupted when exiting the script. Be careful not to interrupt other sensitive code.".
EVENT PLAYER
; Rocket man controls
…
; VELOCIDAD 3+ 010101
IF Z = 0
EXIT ; si Z = 0 entonces salir
ENDIF
IF Z = 2
EXIT ; si Z = 2 entonces salir
ENDIF
IF Z = 4
EXIT ; si Z = 4 entonces salir
ENDIF
…
; sección de movimiento
…
Para un enemigo coloca otro patrón, así:
"For an enemy place another pattern, like this":
EVENT SPRITETYPE4
; enemigo
…
; VELOCIDAD 5+ 111110
IF Z = 5
EXIT ; si Z = 5 entonces salir
ENDIF
…
; sección movimiento
...
Para que esto funcione debes poner un contador en mainloop1:
EVENT MAINLOOP1
...
; Contador de frames del juego
ADD 1 TO Z
IF Z > 5
LET Z = 0 ; pulso (tic) 0, 1, 2, 3, 4, 5
ENDIF
…
Aquí tienes un ejemplo, las plataformas se mueven a velocidad 1+, y el resto a velocidad 6+ (100%):
"Here is an example, the platforms move at speed 1+, and the rest at speed 6+ (100%)":