I'm going to answer your last question first...
freehabitat, on Sun Jan 20, 2008 9:02 AM, said:
what other possibilitys are to do big frames moveing around by useing joystick ?
As I see it, you have only three to five options-- use sprites, use the playfield, use color changes, or maybe you could use video blanking. The fifth option would be to use some combination of the first four options.
The best option would be to use sprites, since they're movable objects, anyway. For a frame or box, you'd probably want to use the players, since they're the only sprites that are more than 1 bit (or pixel) wide. The problem is, the players can be set to only three different sizes-- single width (each bit or pixel is 1 color clock wide), double width (each bit or pixel is 2 color clocks wide), or quadruple width (each bit or pixel is 4 color clocks wide). That puts a limit on how wide of a frame you can draw with a player, unless you use one or more tricks. For example, you could create a larger 48-pixel wide frame using the "score" trick, but that would mean you'd have only one frame, since both players would need to be used to create just the one frame. Or you could draw two frames, each with one player, and use flickering to make bigger frames.
You could also use the missiles and the ball, but since they're each just 1 pixel wide, you'd have to use some tricks to try to create a frame with them, and even then, the frame might not be as wide as you'd like.
Or you could use the players and the missiles together, which could give you slightly wider frames than if you'd used just the players by themselves.
The second option would be to use the playfield to draw a frame. The advantage would be that you could draw the frame as wide as the screen, and/or as tall as the screen. The disadvantage is that the playfield resolution is much lower that the sprites' resolution, so a frame drawn with the playfield could be moved horizontally only 4 color clocks at a time-- it would not move around as smoothely as a sprite could.
The third option would be to draw a frame by changing colors while the scan line is being drawn. For example, you could draw a frame using just the background color register. Color changes can occur every 3 color clocks-- or rather, they can occur on boundaries that are spaced 3 color clocks apart, whereas two consecutive color changes cannot be closer that 9 color clocks apart. That culd give you a horizontal motion that's just a tiny bit better than using the playfield, but it would probably be very tricky to write a kernel to draw a frame this way and yet be able to move it around on the screen.
The fourth option-- using video blanking-- is basically like a variation of using the color-changing option, so it has all the problems of that method, except it's actually more restrictive, because you'd be stuck with drawing a black frame (since video blanking is actually where you "turn off" the scanning beam, hence no colors can be drawn in the area where video blanking is being used).
The fifth option is to use some combination of the other methods. For example, you could draw the horizontal sides of a frame using the playfeld, and use 2 copies of a player or missile to draw the vertical sides, and then you'd need to carefully move the horizontal playfield lines around while you're moving the vertical player lines around.
Or you could draw the horizontal lines using color changes, and draw the vertical lines using 2 copies of a player or missile.
You should be aware, though, that many of the techniques I described above would require writing a custom kernel in assembly language-- you couldn't do them in batari Basic using the canned kernels.
freehabitat, on Sun Jan 20, 2008 9:02 AM, said:
if i move my sprite in any directions out of the playfield it sould appear on the opposite side, very common for some games.
as you can see if you try my code, it works in 3 directions very well. if i move my sprite to the bottom it moves "to fast" to the top.
This is because of the way the video display and the TIA work. When you position a sprite near the right edge of the screen so that part of it extends past the right edge of the screen, the TIA draws the rest of the sprite at the left side of the screen. This is automatic, and requires no extra programming on your part. In fact, if you want an object to slide into view at the side of the screen, or slide off the side of the screen, without part of it wrapping around to the other side of the screen as it's sliding onto or off of the screen, then you have to do something special, like change its shape to make the "offscreen" portion be "turned off" (i.e., replace the 1 bits with 0 bits).
On the other hand, the video screen doesn't have wraparound in the vertical direction; if something starts to move off of the top or bottom of the screen, it doesn't simultaneously start to appear at the bottom or top of the screen. You *can* make a sprite do a "vertical wraparound" that way, but the way you have to do it is by drawing part of the sprite at the top of the screen, and drawing the other part of the sprite at the bottom of the screen, so that it *appears* to be wrapping around. That isn't too difficult to do in assembly language, as long as you've written your kernel to let you do that, but it's trickier to do in batari Basic, since batari Basic uses a "canned" kernel that doesn't lend itself to those kinds of techniques.
However, you *can* do it in batari Basic, and it isn't all that difficult, but you have to be clever-- and careful. Basically, you must define the player so it has two copies-- a top one and a bottom one-- with a lot of blank lines between them, spaced apart so that the extra copy doesn't start to appear at the top or bottom of the screen until the main copy has started to slide off of the screen. And then you have to manipulate the player's lo pointer, the player's height, and the player's y position to draw it just right depending on which vertical position you want it to have.
I've modified your "frames" program to allow the larger frame to wraparound from top to bottom, or vice versa, using this technique, but I remarked out the code for moving the smaller frame around, because I haven't made the modification for the smaller frame yet. I'm going to post the modified code now, but I'm not going to try to explain it tonight-- I'm going to wait until another night, when I've had time to fix the smaller frame to work the same way.
Michael