The problem in your code is that the argument of BGOFS are on line 20. Put BGOFS cameraBG[I],cameraX%,cameraY% in the same line.
I use this code on a map editor for my tactic rpg game. It's still a work in progress but it is too complex to use it as an example.
If you have a code where you want to add the camera, then I can try to add it for you. If not, then I could share my project.
SPHITSP(1) le indica al juego que retorne el primer sprite que este chocando con el sprite. Si no hay uno, entonces retorna -1.
2-Eso ocurre porque estas llamando la función LOCATE despues de print. Para arreglar el problema tienes que usar LOCATE antes de PRINT. Además, te recomiendo usar ENDIF y separar los comandos por espacios en lugar de usar ':'. De esa manera, tu código se verá ordenado.
Hola vi tu código y te voy a responder algunas preguntas:
1- Para detectar que el auto tocó la bandera, es necesario usar SPCOL. Primero tienes que llamar a esta función despues de haber hecho un SPSET del auto y de la bandera para indicarle al juego que estos sprites puede colisionar.(EJ: SPCOL 1)
Luego, en vez de usar y<=25 usas SPHITSP(1)==2.
Also:
-You need to put renderCamera in the part where your code render the changes of the game.
-To move background, you need to push the layer on cameraBG
Then just call moveCamera somewhere in your code(Try in the one that control the player) to test it.
DEF renderCamera
VAR I
INC cameraX%,cameraVX%
INC cameraY%,cameraVY%
SPOFS 0,-cameraX%,-cameraY%
FOR I=0 TO LEN(cameraBG)-1
BGOFS cameraBG[I],cameraX%,cameraY%
NEXT
cameraVX%=0
cameraVY%=0
END
You need the following things to make a camera:
-Variables to store the position of the camera.
-A invisible sprite(Call this the camera sprite) with management number=0
-The speed of the camera.
-SPLINK all the sprites you create with the camera sprite
Then you need to declare the functions:
Now I understand. You wanted to trim the "0" from the left side.
There is an easy way to have an string with exact length of a binary. Try this:
SIZE$=BIN$(VAL("&B"+SIZE$))
? LEN(SIZE$)
The code above is used to get the string without the 0 at the left side. The text &B at the begining of the argument is used to identify the string as a binary.
C1, C2 or C3 haven't been initialized. Also, you're not using the result of that operation... you must store it on a variable.
Example
VAR res=C1-RGB(0,256,0)
Sorry, I've been busy with other things so I don't have a significant progress. The last thing I've done was add the rules to select the chips from the bottom screen.
Here is a demo of the mmbn game i'm doing. For obvious reason, some sprites are grey.
KEY:[QREX5XA3]
There is not AI yet. The game include:
-5 animated background with random colors.
-2 music.
-Custom font.
-Battle menu.
-"Battle chips".
I saw that you want to make a encryptation algorithm. I have bad news for you: bin$() won't help you too much because it return a string.
You need to learn how use bitwise operators(>>,<<,and,or,xor) to handle them as a binary.
That's a value returned from the function(A String). It's up to you to decide what to do with that.
If you want to see the result on the console, then type:
? bin$(variable)
That can be done with other module. One of my modules is called GAME_LOOP. It store another module and call the following functions.
init_: Called once to create all the sprites and arrays.
destroy_: Clear all the sprites and free the memory of the arrays.
input_: Handle the input of the player.
update_: Handle the logic of the game.
render_: self explanatory.
I use 2 slots:
0: Executable
3: compiled files.
Right now I have 39 txt files in the project:
-1 is the executable
-1 is TH GRP editor.
-1 is hosiken's font editor.
-1 is the font file generated by the previous program.
-4 are from lowerdash(Compiler, base file, generic code generator and key setter for lowerdash keywords).
-The rest are the modules used on the game.