cvga, on Wed Jan 23, 2008 1:28 AM, said:
Suppose I wanted to make one of those 'jump the peg' triangular games (like you might see at Cracker Barrel restaurants). I could have a total of 15 pegs (actually 14 since you start with one empty hole) in 5 rows (or columns if you turn it sideways). My screen would look like one of the following...
x_x_x_x_x
_x_x_x_x
__x_x_x
___x_x
____x
or (it's probably better to imagine the picture above turned sideways)
____x
___x
__x_x
_x_x
x_x_x
_x_x
__x_x
___x
____x
Initially I thought I would have to create a player0 that looks like a peg and a player1 that looks like a peg and rotate them through 8 drawscreens to get all of the pegs on the screen but that creates an extreme flickery mess.
Turning the board sideways reduces the number of columns to 5. Now I can use the two sprites as columns of pegs and cut my drawscreens down to 3 to show the whole board (although it's still flickery).
Is there a better way using batari basic with less flicker to accomplish what I want?
Actually, if you use the largest player size (quadruple wide), and the next-to-the-largest missile size (also quadruple wide), you could draw all 15 peg positions with just one player and one missile. Then you could use the other player as a cursor for pointing to which peg you want to move, and blink (or slow flicker) the other missile between two positions to mark which peg you've selected to move, and which position you've chosen to move it to. You could use the playfield to draw the triangular board (although it would be blocky looking), with "holes" in the playfield to let the background through.
I'm attaching a very preliminary display to show you what I mean, but it just has the 15 pegs showing (yes, I know that's 1 more than there should be).
cvga, on Wed Jan 23, 2008 1:28 AM, said:
Also, I was playing with the ball graphic but I was disappointed that it looks like a square. Is there a way to make it look more rounded like an actual ball?
The only ways to make the ball look rounded like a ball is to (1) vary its width and horizontal position from line to line-- which you can't do in batari Basic unless you write a custom kernel-- or (2) vary its width and height and position between two frames using flicker, which you *can* do in batari Basic. But you might want to just use square pegs, as I've done in my little demo program. For a game like this, the shape of the pegs is secondary to the game play, so square pegs should be perfectly acceptable.
By the way, the challenge with using just one player for all of the pegs is to be able to turn the pixels on and off as needed, which would require either defining a lot of player shapes for all of the possible peg arrangements-- which would take up a good bit of ROM-- or move the player shape into RAM so you could alter it on the fly. For the shape I drew in my demo, it would take 36 bytes of RAM, and you don't really have 36 bytes of RAM free in batari Basic, unless you use the Superchip option. However, one possibility is to create a modified version of the kernel that draws each line of player1 four times before moving on to the next line, so you could define the player shape using only 9 bytes instead of 36 bytes, and then you would need only 9 bytes of RAM to turn the pegs or pixels on and off as needed.
There are other possibilities, though. For example, it's easier to turn the playfield pixels on and off in the standard kernel. So if you use the playfield as the holes in the board, and use the background as the board itself, and then set the playfield control register (CTRLPF) so that the players are drawn *behind* the playfield, then you could just leave the player1 bits on all the time, and turn the playfield pixels on or off as needed to make it look like the pegs are turning on or off (moving).
Another possibility would be to just write a custom kernel, since one of the players will be motionless anyway (for all of the pegs), and only the other player would need to move around (for the cursor)-- plus, the cursor would really have only a set number of possible positions. So with a custom kernel, you could draw multiple copies of player1 from row to row for the pegs, because the most pegs you would have on any row would be 3, as follows:
P1A
P1A
P1A P1B
P1A P1B
P1A P1B P1C
P1A P1B
P1A P1B
P1A
P1A
Turning the pegs on or off would then be a simple matter of just changing the number of copies, spacing, and horizontal position on each row of pegs.
Actually, you could do pretty much the same thing without creating a custom kernel, by using the multisprite kernel, but you'd need to flicker the multisprites, since there are 9 rows on which pegs could appear, and you don't have that many multisprites.
Michael
Edited by SeaGtGruff, Wed Jan 23, 2008 2:00 AM.