Jump to content
IGNORED

Wraparound Effect


ZippyRedPlumber

Recommended Posts

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
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
  • 9 months later...

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.

Link to comment
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
Link to comment
Share on other sites

  • 3 weeks later...

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