Original Post

How do I turn a C file into something to run in a Virtual Boy emulator? I was fiddling around with Notepad making a C file and I downloaded gccvb and VIDE, but I can’t find anything that would do this?

  • This topic was modified 14 years, 9 months ago by VirtualChris.
155 Replies

Yay!

Now, for smoother transitions between the game screens, you should use the vbFXFadeIn() and vbFXFadeOut() functions instead of setting the brightness registers manually.

Fading added. Also, when you hit a wall and go back to the start, the sub is unresponsive for a few seconds (so you don’t hit a wall again and again.)

Attachments:

Added level 6 with flashing walls that appear and disappear.

Attachments:

Added 2 more levels. You start on the first new one (level 7). To play again, lose all your lives on “level 9” to go back to the title screen.

Attachments:

Added two new levels, 9 & 10.

Attachments:

Why isn’t this working the way I want it to? What I want is for once it starts to have the maze be at the correct position when it fades in, not after. Second of all, I’ve added a level select screen (if you press select instead of start at the title screen, it comes up.) The same thing happens if you choose the level with the left and right keys and press start. Would someone please help me get the maze position right so it doesn’t do what it does now?

can you upload a rom so we can see what’s going wrong?

Oh no… I knew I shouldn’t have mentioned goto to someone who knows Basic :-P. Using goto makes REALLY ugly code… you should really use for and while loops with if statements whenever possible… and only on the rare occasion, use goto (i.e. when you’re breaking from the normal flow, like restarting after dying in the main game loop). Even then, goto is still not really a great solution, but IMO can be cleaner than having excessive loops.

But yeah, a ROM would probably help… I tried looking at the code, but I couldn’t really follow it because all the gotos.

DogP

Here’s a ROM.

Attachments:

hmm, hard to say. you should REALLY tidy up the code. 😉
i’d say the problem is either that you load bgmaps in lines 203 to 212, and then do it again, but a bit differently, in lines 253 to 259, or that the maze is defined to be in world 26 on line 200 and then to be world 27 on line 264.

OK, I figured out what was wrong and fixed it.

Attachments:

Spruced up the level select screen and added a level.

Attachments:

looks nice! but there’s a bug. if you start level 1 through the level select screen, the level walls do not get loaded. also, inputs are often not recognized. i assume this is happening due to high waitframe values in your loop!? you could solve that with a for loop:

let’s assume the part of your loop, which handles the delay and controller input, looks like this:

vbWaitFrame(40);
if(vbReadPad()&(…))

you could replace it with this:

for(i=0; i<40; i++)
{
vbWaitFrame(1);
if(vbReadPad()&(...)) }

The level 1 bug can easily be fixed. I changed the way the level select screen handles inputs so the sub won’t stop when you’re pressing the left or right button. It now looks like this:

choose_level_main:
	level_str[2]=0;

	level_str[0]=(level/10)+'0';
	level_str[1]=(level%10)+'0';

	vbSetWorld(31, WRLD_ON|3, 119, 0, 50, 0, 0, 0, 384, 224);
	vbSetWorld(30, WRLD_ON|1, 0, 0, 0, 0, 0, 0, 0, 0);
	vbSetWorld(29, WRLD_ON|2, 0, 0, 0, 0, 0, 0, 0, 0);
	vbSetWorld(28, WRLD_ON|1, 0, 0, 0, 0, 0, 0, 0, 0);
	vbSetWorld(27, WRLD_ON, xpos, 0, 150, 0, 0, 0, 384, 224);

	if (g==1 && xpos>300) g=0;
	if (g==0 && xpos<84) g=1;

	if (g==1) xpos=xpos+1, vbWaitFrame(1);
	if (g==0) xpos=xpos-1, vbWaitFrame(1);

	if (f>15) f=0, level=level-1; 
	if (h>15) h=0, level=level+1;

	vbTextOut(3, 1, 1,"START ON LEVEL");
	vbTextOut(3, 16, 1,level_str);
		if(vbReadPad()&(K_LL)) f=f+1;
		if(vbReadPad()&(K_LR)) h=h+1;
		if (level==0) level=13;
		if (level>13) level=1;
		if(vbReadPad()&(K_STA)) goto begin_game;
	goto choose_level_main;

I’ve changed it so if the player presses left or right for a set amount of time, the level changes instead of having a vbWaitFrame(40), which would stop the sub’s movement in its tracks.

EDIT: The only other time vbWaitFrame is at 40 is here:

	if(d==1) vbWaitFrame(40);

	d=0;

This should only be happening if the wall has been hit. I made it that way so when you start over again, you don’t automatically ram into a wall again.

Added the 14th level. I don’t get why the sub wouldn’t be responsive. Every time i play it on Reality Boy, it works fine for me. Has anyone played this on a Flash Boy yet? I’d really like to know if this would work on actual hardware, and I came here a little too late to get the last batch. Also, I’d really appreciate it if people would help with level designing. The squares have to be 8×8 pixels. The sub can fit in a 6-block space going vertically and (barely) in a 5-block going horizontally.
The final image should be in .bmp format. I’ve included a template for people that I use myself using MS Paint. If you’d like to use MS Paint, it would be easiest to use the third size eraser tool to make your blocks with.

sorry, i forgot to mention that i meant the level select screen. you often have to press left or right 5 times to change the level.

Added level 15 and changed the level select code to make it go faster.

Attachments:

Added level 16. The game is now 512K. It’s getting bigger. I don’t know how many levels to put in though. And also, I’d like someone to play this on real hardware via the Flash Boy and see if it works OK.

Attachments:

Still working on the game, Chris?

I have just tested the game on my FlashBoy. Nothing to complain really, it plays exactly like on Reality Boy, and the speed is perfect. 🙂

I took a break on it, but after a few months, i’m back working on it. I had to relearn how to do things since it’s been so long. I’m glad it works on a real Virtual Boy. I’ve added a new level. I plan on making new ones until the 2MB is used up.

Attachments:

 

Write a reply

You must be logged in to reply to this topic.