Jump to content

Recommended Posts

I use software solution.

For top down RPG style.  I poll the name table.  So the code is...

 


if(joypad_1&UP){playerp=2*16;
if (walk==0){walk=15;}

y=(playery+8)/8;
x=(playerx+8)/8;
TileID = get_char(x,y);
if(TileID>=192){playery--;}
}


if(joypad_1&RIGHT){playerp=1*16;
if (walk==0){walk=15;}
y=(playery+12)/8;
x=(playerx+12)/8;
TileID = get_char(x,y);
if(TileID>=192){playerx++;}
}

if(joypad_1&DOWN){playerp=0*16;
if (walk==0){walk=15;}
y=(playery+16)/8;
x=(playerx+8)/8;
TileID = get_char(x,y);
if(TileID>=192){playery++;}
}
if(joypad_1&LEFT){playerp=3*16;
if (walk==0){walk=15;}
y=(playery+12)/8;
x=(playerx+4)/8;
TileID = get_char(x,y);
if(TileID>=192){playerx--;}
}

"TileID>=192" are the tiles that are impassable.  If you're using ICVGM.  The last 1/4 tiles are solid. 

This would be your character's center,
 

y=(playery+12)/8;
x=(playerx+8)/8;
TileID = get_char(x,y);

If you want to have a hazardous tiles like lava or spikes,  You can do, if(TileID==191){OuchySpike();}. 

 

Keep in mind if you're going below the screen, it'll pick up the sprite table data and act on it. So adding if restriction is recommended. 

  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks Kiwi. It works.

 

I noted "if (walk==0){walk=15;}" was not necessary. 

 

I remove them from the code and the program still works.

Share this post


Link to post
Share on other sites
2 hours ago, Serguei2 said:

Thanks Kiwi. It works.

 

I noted "if (walk==0){walk=15;}" was not necessary. 

 

I remove them from the code and the program still works.

Yeah, that code wasn't necessary.  I pulled it out from my New Years Beach Clean Up game since it is a top down game like the Venture type game you're making.  It is to reset the walk countdown to change the sprite image to his hopping walk state to his standing state. 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...