okay that's clear enough, it would only be for my visual/logical overview convenience to seperate stuff, thx!
Separating stuff should be done in such a way, that you don't need to include ".c" files. Only header files.
ok.
coding now the multicolor sprite movement, gtstck is pretty much the same everywhere, but to get the y axis to react om the gtstck(0) value of 1 or another key/joy direction isnt really working out.
I am using a for loop:
if (gtstck(keyport) == 0) { putspr(p,pllocx,pllocy,logop,t); } else if (gtstck(keyport) == 1) { for (i = 0;gtstck(keyport) > 0; i++) { putspr(p,pllocx,pllocy+i,logop,t); /* putspr(plane,x,y,logop,pat nr); */ } }
not really a good solution (this example is for going up.)
It looks like it could be replaced with
stck = gtstck(keyport); //call this only one time and store in variable, save cpu time if (stck == 1) { pllocy = pllocy + 1 } putspr(p,pllocx,pllocy,logop,t); /* putspr(plane,x,y,logop,pat nr); */
@hit9918
I did try that (except the stck=gtstck part), but that just shows a sprite, pressing the up key wont move it one bit (lol)
So thats why i was going for a FOR loop, so inclemently add a value could plus the y axis by not only 1, but when keeping the key pressed, keeps on counting.
I will try something else and post it here.
Remove things till something happens.
Removing the stick part:
while(1) { pllocy = pllocy + 1 putspr(p,pllocx,pllocy,logop,t); /* putspr(plane,x,y,logop,pat nr); */ }
Now the sprite should run wild.
Another test would be to put the value returned by gtstck(keyport); to bordercolor.
Then wiggle the stick and see whether something happens.
Testing things isolated.
good idea :-) Will do that, thanks!
I got it to work, only now my multicolorsprite shows not all colors.
Plus i see the speed of the sprite is wayy too fast.
I was trying the following to slow it down:
x = (x + 1) % 40;
But that doesnt work for some reason :/
That does not slow it down, but keeps x between 0 and 39 (inclusive). Try to sync the code to VBLANK to slow it down. Or just use a big for loop to create a slow down if you want a quick test.
VBLANK is a bios call? Or is it a framething, not familiar with it. Is there documentation on it somewhere?
I was actually thinking on using the systemclock, cause that would mean the playingspeed would be more the same on each machine (MSX2 and higher models), or is using VBLANK doing a similair thing?
Cause a for loop would be different in performance on a faster machine.