Jump to content
ZippyRedPlumber

Wraparound Effect

Recommended Posts

The platforming game I'm working uses an effect similar to 2600 Pac-Man. If the player falls off to the bottom he doesn't die, he would appear at the top of the playfield. How can this be achieved?

Share this post


Link to post
Share on other sites

If you want it to be like Pac-Man where he disappears entirely before reappearing on the other side, that should be easy enough. Something like this for p0 and the standard kernel:

 

	if player0y >= player0height + 88 then player0y = 0 ; wrap from bottom to top
	if player0y > 200 then player0y = 87				; wrap from top to bottom

If you want it to appear on the other side pixel by pixel so that part of him is visible on the top and bottom at the same time, it would be more complicated - either you would use both players, or have several player definitions that are the entire height of the screen, and show the player disappearing from one end, and appearing on the other. This would take up a lot of ROM. It would probably be better do to it Pac-Man style.  🙂 

  • Like 2

Share this post


Link to post
Share on other sites

Wraparound occurs automatically on the right edge of the screen. To wrap your sprite to the right, just increase the X coordinate until it appears all the way on the left edge, then change the X coordinate to 0.

 

To wrap from the left edge to the right, you would change the X coordinate to the value where the sprite first begins to wrap after it is past the left edge. You will have to experiment with numbers to see what values work based on the width of the sprite, but something like:

 

    if player0x > 250 then player0x = 159 ; player wrapped to the left


If your sprites can't go all the way to the screen edges because the playfield doesn't reach the screen edges, then you will need to settle for the sprite vanishing at one edge, and then appearing at the other edge all at once. This really isn't so bad for most games, though.

Share this post


Link to post
Share on other sites

Sometimes (especially with the multi sprite kernel) you just have to eyeball it.  Sprite and virtual sprites can appear skewed from their x/y values.

 

I usually end up making a simple "game" that moves a particular sprite around and use the score for tracking the coordinates.  In my latest multi sprite attempt I found x = 20 to be a good wrap around value for medium stretched sprites.  x = 140 to be the good wrap point at the opposite end.

 

Sometimes you have to just brute force place a sprite and see if it displays properly.

 

Of course, this is not the best advice and it's explained poorly.  But, sometimes dumb, annoyingly manual methods get the job done.

 

  • Like 1

Share this post


Link to post
Share on other sites

The playerscores minikernel will let you do a regular score plus player scores, with the right options set. Latest version of the minikernel is here:

 

 

If you want two full six-digit scores scores, then the secondscore minikernel will work:

 

 

 

  • 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.
Note: Your post will require moderator approval before it will be visible.

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...