Original Post

Announcing the beginning of work on GoSub 2. Improvements over the original are:
+I am going to add an octopus chasing you. To fire a torpedo in the direction you’re going, press A.
+I also plan to put in more than 32 levels this time. These levels include an in and out, and no treasure. Your search is for the big huge treasure chest I plan to put in at the end.
Right now, all I have is a title screen. There are two different animations, please watch both of them, and I remind you these are placeholder graphics, and may not be used in the final version (especially the torpedo sprite!)

Attachments:
66 Replies

question: how do I fit two whole maps on one world? The way I’m doing this now is that I have one map (the front) taking up the whole screen on one world and another map (the back) taking up the whole screen on another. Also, how would I keep it so that you go above part of a world at one part and behind another part at another part?

  • This reply was modified 13 years, 9 months ago by VirtualChris.

VirtualChris wrote:
question: how do I fit two whole maps on one world?

You don’t. You still need to use two worlds, but you can have both of those worlds cut out their graphics from the same charmap, so you only need to load one charmap (and one charseg) for both worlds.

What I meant was how would I display two seperate worlds using the same charmap? I mean, wouldn’t I be doing this:

	vbSetWorld(31, WRLD_ON|1, 0, -2, 8, 0, 0, 0, 384, 224);		// front mazes 
	vbSetWorld(26, WRLD_ON|1, 0, 2, 8, 0, 0, 0, 384, 224);		// back mazes

VirtualChris wrote:
how would I display two seperate worlds using the same charmap?
[/code]

You are already doing exactly that with the sub and the octopus, right? Just cut from different parts of the map.

The back maze would fit below the front maze (at y:224) in your front maze map.

something like:

vbSetWorld(31, WRLD_ON|1, 0, 2, 8, 0, 0, 224, 384, 224);        // back mazes
vbSetWorld(26, WRLD_ON|1, 0, -2, 8, 0, 0, 0, 384, 224);        // front mazes 

My bad. I meant BGMap instead of charmap.

VirtualChris wrote:
My bad. I meant BGMap instead of charmap.

…so did I still answer your question? I’m confused now 😕

In order to display two different mazes (one for front and one for back), I’m using two different BGMaps along with two different charsegs.

	copymem((void*)CharSeg1, (void*)CORAL, 256*16);
	copymem((void*)BGMap(1), (void*)LEVEL1FRONT, 256*16); 

	copymem((void*)CharSeg2, (void*)CORAL, 256*16);
	copymem((void*)BGMap(2), (void*)LEVEL1BACK, 256*16); 

It sounds like you want me to somehow combine these two things so I don’t have to use BGMap(2) and CharSeg2?

It sounds like you want me to somehow combine these two things so I don’t have to use BGMap(2) and CharSeg2?

Exactly.

Make the level maps like the attached VIDE project.

Then only use this code:

copymem((void*)CharSeg1, (void*)CORAL, 256*16);
copymem((void*)BGMap(1), (void*)LEVEL1FRONTANDBACK, 256*16);

vbSetWorld(31, WRLD_ON|1, 0, 2, 8, 0, 0, 224, 384, 224);        // back mazes
vbSetWorld(26, WRLD_ON|1, 0, -2, 8, 0, 0, 0, 384, 224);        // front mazes

OK, I’ve done all that, but how would I change the sub wall collision detection to choose between what’s less than 224 and what’s more than 224? Right now, the collision detection is working on both levels like it’s one (which, apparently, now it is.)

        int i;
	for (i = 0; i < 5; i++) { 
	if(getBGMapChar(1, (xpos/8)+i, (ypos/8)+2) == 512) { 
      xpos = 22; 
      ypos = 180; 
      gamesubdir = 0; 
      lives--; 
      b = 1; 
      torpedodir = 0; 
      break; 
		}
	} 

The smallest change to that code to make it work would be:

      int i;
      for (i = 0; i < 5; i++) { 
        if(getBGMapChar(1, (xpos/8)+i, ((ypos+(d==2?224:0))/8)+2) < 514) { 
          xpos = 22; 
          ypos = 180; 
          gamesubdir = 0; 
          lives--; 
          b = 1; 
          torpedodir = 0; 
          break; 
        }
      } 

I'll explain:
d==2?224:0 is a compact form of one-line if/else statement that adds 224 to the ypos if d==2 (and adds 0 otherwise).

< 514 comes from the assumption that you did like me and use one bright coral and one dark, which would be at position 512 and 513 in the charsegs. The map won't use any chars below 512, so it's safe to assume everything below 514 is a hit.

There! I had to tweak the code samples a little, but I finally got stuff working again. I’ve added the water waves back.

Attachments:

I was going to edit the above post to say that I’ve fixed a bug, but I couldn’t find the edit post button, so here it is. Level 2 should now be passable.

Attachments:

Looking good! :thumpup:

One major thing though. You’ve screwed up the 3D effect with the front/back mazes, it’s inverted now…

Your code:

vbSetWorld(31, WRLD_ON|1, 0, -2, 8, 0, 0, 224, 384, 224); // front mazes 
vbSetWorld(26, WRLD_ON|1, 0, 2, 8, 0, 0, 0, 384, 224); // back mazes

Correct code:

vbSetWorld(31, WRLD_ON|1, 0, 2, 8, 0, 0, 224, 384, 224); // back mazes 
vbSetWorld(26, WRLD_ON|1, 0, -2, 8, 0, 0, 0, 384, 224); // front mazes

And what happened to the little fishy? 🙂

I figured since the fish didn’t change the gameplay, I got him out. I can put him back in if you like. I also added a level, and since I don’t want to have the ROM start at the current level, I added a level select menu at the title screen, control the level # to start at using up and down on the left d-pad. I also added the Planet VB screen. Had a heck of a time trying to get that thing in, so I had to redo it.

Attachments:

Great, the 3D effect looks perfect now!

VirtualChris wrote:
I figured since the fish didn’t change the gameplay, I got him out. I can put him back in if you like.

Well, small animated details in the background is always nice for the overall presentation. 🙂

VirtualChris wrote:
The difference between the my example and yours is I understand mine. Of course, I am still learning C, and why I code the way I do is because I have a lot more experience in Basic than I do in C. But yeah, I will do my best to try and clean up the code to the best of my abilities with what knowledge of C (which is little) I know.

Do NOT blame the dirtiness, or the lack of it, in your code structure on BASIC. Ever. I’m a BASIC programmer too; I only learned C so I could program for the VB, and my code is way cleaner.

Excuse me for not posting feedback on the game; I will when I can.

Long time, no update. I’ve added a password system. To access the password screen, press select at the title screen. To enter a password, press down or up to cycle through all the letters and left or right to change a letter. The letter you are changing will be flashing. All passwords will lead to level 1 except the following:
level 2 – GUBSO
level 3 – OBUGS
(I have yet to think up of passwords for levels 4-6.)

Attachments:

Hey, I thought you had lost interest in this project (again) 😉

BOGUS would be a good password 😀

The passwords will be too easy to guess if you’re only going to have those letters… unless you’re including the entire alphabet or something? (I still have to compile Mednafen on this computer.)

Correct me if I’m wrong, but there’s about 3,125 different combinations of those letters. Even if there’s far fewer combinations than that, I figure it will still be good enough for a project with around 50 or 60 different levels. I did think up of BOGUS by myself, it’s the password for level 5. Here’s all the different passwords so far (I also made a new level 7.) I kinda ran out of fun combinations (as you can see by level 7’s), so if any one has any others, you can help me out
02 – GUBSO
03 – OBUGS
04 – BUSGO
05 – BOGUS
06 – USBOG
07 – OUGSB
Also, I switched to displaying the passwords on the screen above right hand corner instead of a description of the level.

Attachments:

 

Write a reply

You must be logged in to reply to this topic.