Jump to content





Rock Cutter

Posted by Kiwi, 14 October 2015 · 842 views

When I first program this game, I wanted to make a platformer.  I did make a gameboy mockup for Pixelation challenge thread long long time ago. 
 
Attached Image Attached Image
 
Then went on to make a Mock-up of Rock Cutter, if it was made for NES. 
 
Attached Image
 
I made this in Flash 5.  I didn't really know how to program back then.  The Gameboy and NES mock-up was created in middle of 2002.  I thought of trying to make this game for the Colecovision.  Platformer is one of my favorite game genre.  So I started on it last year in July. 
 
Attached Image
 
First thing when I program is work on the controls.  Gravity is a pretty new thing for me to figure out.  Also tell Quinn if there's a ground, if there's a ground then your y position is -2.  And being on a ground, you're able to jump.  Jump is +4 for a few frames, and then dies off when the jumpcounter expires.  I only have Quinn attack only when he is standing on the ground.  I might be able to have him attack in the air, but he can't move when he is in attack position, but gravity may still work on him.  I thought of shooting out blade, but didn't really figure it out.  Although, it'll make the game a lot easier.
 
Second thing, is sprites system.  Quinn's sprite number is 12-15. And the 2 colored objects are alternating 0-11, 16-23.  The sprite bosses share that slot too.  Colecovision only can display 4 sprites on a line.  Quinn will alway be visible, while 3 objects on a line is visible to the player.  4th object will get dropped.  
 

if(flicker==0){
i=0;
for(ID=0;ID!=6;ID++){

sprites[16+i].y = 207;
sprites[17+i].y = 207;
sprites[0+i].y = objecty[ID];
sprites[0+i].x = objectx[ID];
sprites[0+i].colour =objectc1[ID];
sprites[0+i].pattern =objectp1[ID];
sprites[1+i].y = objecty[ID];
sprites[1+i].x = objectx[ID];
sprites[1+i].colour =objectc2[ID];
sprites[1+i].pattern =objectp2[ID];
i+=2;
}
if(bosson==4){boss4();}
if(bosson==3){boss3();}
if(bosson==1){boss();}
flicker=1;goto flick;
}
if(flicker==1){
i=10;
for(ID=0;ID!=6;ID++){

sprites[0+i].y = 207;
sprites[1+i].y = 207;
sprites[16+i].y = objecty[ID];
sprites[16+i].x = objectx[ID];
sprites[16+i].colour =objectc1[ID];
sprites[16+i].pattern =objectp1[ID];
sprites[17+i].y = objecty[ID];
sprites[17+i].x = objectx[ID];
sprites[17+i].colour =objectc2[ID];
sprites[17+i].pattern =objectp2[ID];
i-=2;
}
if(bosson==1){boss();}
if(bosson==3){boss3();}
if(bosson==4){boss4();}
flicker=0;goto flick;
}

flick:
  Most of the enemies have a black outline, so it won't be difficult to see them on a busy colorful background even when they are flickering. 
 
Having 6 objects maximum is enough for this game.  Having more than 6 objects will guarantee that the game will slowdown when it get really busy.  Then you have an issue that the NMI will corrupt the screen a bit during updating the time when there is slowdown occurring.  Flappe Byrd and Flight of the Icarus had 6 objects maximum. 
 
I am now working on the fourth level.  The boss in this one is already programmed.  I might have space for 5th short level with the final boss.  I'm up 28.7KB.  I should be able to condense more data to cram more stuff in.  
 






It looks really amazing :) nice graphics :thumbsup:

  • Report
You have a lot of duplicated code in that routine when the only things that affect it are flicker and i. It would be more compact to write :-
 
    if (flicker==0)
        i=0;
    else
        i=10;
    flicker^=1;
    for(ID=0;ID!=6;ID++)
        {
        sprites[16+i].y = 207;
        sprites[17+i].y = 207;
        sprites[0+i].y = objecty[ID];
        sprites[0+i].x = objectx[ID];
        sprites[0+i].colour =objectc1[ID];
        sprites[0+i].pattern =objectp1[ID];
        sprites[1+i].y = objecty[ID];
        sprites[1+i].x = objectx[ID];
        sprites[1+i].colour =objectc2[ID];
        sprites[1+i].pattern =objectp2[ID];
        i+=2;
        }
    if(bosson==4){boss4();}
    if(bosson==3){boss3();}
    if(bosson==1){boss();}
To improve code generation efficiency further I'd generate a pointer to sprites[i] before the loop and use that to access the structure elements.
  • Report

That would work if:

for(ID=0;ID!=6;ID++){
        sprites[16+i].y = objecty[ID];
        sprites[16+i].x = objectx[ID];
        sprites[16+i].colour =objectc1[ID];
        sprites[16+i].pattern =objectp1[ID];
        sprites[17+i].y = objecty[ID];
        sprites[17+i].x = objectx[ID];
        sprites[17+i].colour =objectc2[ID];
        sprites[17+i].pattern =objectp2[ID];
        sprites[0+i].y = objecty[ID];
        sprites[0+i].x = objectx[ID];
        sprites[0+i].colour =objectc1[ID];
        sprites[0+i].pattern =objectp1[ID];
        sprites[1+i].y = objecty[ID];
        sprites[1+i].x = objectx[ID];
        sprites[1+i].colour =objectc2[ID];
        sprites[1+i].pattern =objectp2[ID];
        if(flicker==0){i+=2;}else{i-=2;}
}

Usually when the objects are not activate, they are moved to objecty[ID]=207. if flicker is 1, then it reverse the table from 10 to 0.  So if there's 4 objects on a line, they'll flicker instead of disappear.  I'll try your code out.  Thank you for the advice.

  • Report

Ah, I missed that. If you define some sprite structure pointers in the "if (flicker)" statement then the same code could work for both.

  • Report
    if (flicker==0){i=0;} else{i=10;}
    flicker^=1;
    for(ID=0;ID!=6;ID++)
        {

        sprites[16+i].x = objectx[ID];
        sprites[16+i].colour =objectc1[ID];
        sprites[16+i].pattern =objectp1[ID];

        sprites[17+i].x = objectx[ID];
        sprites[17+i].colour =objectc2[ID];
        sprites[17+i].pattern =objectp2[ID];
		if(flicker==0){
        sprites[16+i].y = 207;
        sprites[17+i].y = 207;}
else{		
        sprites[16+i].y = objecty[ID];
        sprites[17+i].y = objecty[ID];		
}
		
        sprites[0+i].x = objectx[ID];
        sprites[0+i].colour =objectc1[ID];
        sprites[0+i].pattern =objectp1[ID];

        sprites[1+i].x = objectx[ID];
        sprites[1+i].colour =objectc2[ID];
        sprites[1+i].pattern =objectp2[ID];
if(flicker==0){
        sprites[0+i].y = objecty[ID];
        sprites[1+i].y = objecty[ID];}
else{		
        sprites[0+i].y = 207;
        sprites[1+i].y = 207;		
}
        if(flicker==1){i+=2;}else{i-=2;}
}

This is the code as right now that works.  It does lag the game when it get crowded with a boss, Rockies and the white rocks, Megaman 3 style because it have to now add data to the x color and patterns.  However, I can have the enemy vs Quinn collusion detection occur every other frame or check for the first 3 object one frame, and then the last 3 objects in another frame.  I may revert to what I have right now.

  • Report
It can be optimised for size quite a bit more with structure pointers ;).
  • Report

February 2019

S M T W T F S
     12
3456789
10111213141516
171819 20 212223
2425262728  

Recent Entries