Hello. For the BPC contest, I plan on making a Battleship game, so I decided to make this thread because I anticipate having more than a few questions and I also wanted your feedback. Here is the code for the menu:
Here is some code I made that I would use to place the ships on a grid, the example is for the PT Boat:
My questions are:
1. Is there some faster way to generate the menu/grid? I noticed that when plotting the statisical sprites it erases everything on the graphscreen, so I decided the easiest way was to store the text and line in a temporary picture, and recall the picture after the sprite was plotted.
2. In the menu, the sprite for the cursor has a gap, yet when I plot it on the bottom-left of the screen, it doesn't have the gap. Why does this happen?
Thanks in advance for the help.
BASIC Code wrote:
:0,1,0,6,5,4,3,2,1,0,7,0,6,5,4,3,2,1,0,1,0,0→L4
:0,1,1,2,2,2,2,2,2,2,3,3,4,4,4,4,4,4,4,5,5,6→L5
:ClrDraw
:ClrHome
:DelVar ADelVar B0→Xmin
:0→Ymin
:92→Xmax
:64→YMax
:Repeat C=45 or (C=21 and B=9)
:DelVar CClrDraw
:Text(‾1,0,0,"BATTLESHIP BASIC
:Text(8,0,"CREATED BY ROBERTO SANCHEZ
:Horizontal(47
:Text(24,29,"START GAME
:Text(32,29,"INSTRUCTIONS
:Text(40,29,"ABOUT
:Text(48,29,"EXIT")
:StorePic 1
:20→A
:33→B
:Repeat C=21 or C=45
:1→dim(L1
:1→dim(L2
:augment(L1,L4+A→L1
:augment(L2,L5+B→L2
:Plot1Scatter ,L1,L2,[Dot])
:RecallPic 1
:Repeat C=21 or (C=25 and B≠33) or (C=34 and B≠9) or C=45
:getKey→C
:End
:B+8(C=25→B
:B-8(C=34→B
:End
:PlotsOff
:End
:DelVar ADelVar BDelVar CDelVar Pic1ClrDraw
:Output(1,1,"
Generated by SourceCoder, © 2005 Cemetech
:0,1,1,2,2,2,2,2,2,2,3,3,4,4,4,4,4,4,4,5,5,6→L5
:ClrDraw
:ClrHome
:DelVar ADelVar B0→Xmin
:0→Ymin
:92→Xmax
:64→YMax
:Repeat C=45 or (C=21 and B=9)
:DelVar CClrDraw
:Text(‾1,0,0,"BATTLESHIP BASIC
:Text(8,0,"CREATED BY ROBERTO SANCHEZ
:Horizontal(47
:Text(24,29,"START GAME
:Text(32,29,"INSTRUCTIONS
:Text(40,29,"ABOUT
:Text(48,29,"EXIT")
:StorePic 1
:20→A
:33→B
:Repeat C=21 or C=45
:1→dim(L1
:1→dim(L2
:augment(L1,L4+A→L1
:augment(L2,L5+B→L2
:Plot1Scatter ,L1,L2,[Dot])
:RecallPic 1
:Repeat C=21 or (C=25 and B≠33) or (C=34 and B≠9) or C=45
:getKey→C
:End
:B+8(C=25→B
:B-8(C=34→B
:End
:PlotsOff
:End
:DelVar ADelVar BDelVar CDelVar Pic1ClrDraw
:Output(1,1,"
Generated by SourceCoder, © 2005 Cemetech
Here is some code I made that I would use to place the ships on a grid, the example is for the PT Boat:
BASIC Code wrote:
:3,2,4,1,5,4,3,2,1,0,3,2,4,3,2,3,2→∟A
:0,0,1,1,2,2,2,2,2,2,3,3,4,4,4,5,5→∟B
:8,8→dim([E]
:DelVar DPlotsOff
:For(B,0,64,8
:Line(0,B,64,B
:Vertical B
:End
:1→C
:DelVar ADelVar BStorePic 1
:Repeat D=21
:1→dim(L1
:1→dim(L2
:augment(L1,∟A+(8A)→L1
:augment(L2,∟B+(8B)→L2
:Plot1Scatter ,L1,L2,[Dot]
:RecallPic 1
:Repeat D=21 or (D=24 and A≠0) or (D=26 and A≠7) or (D=25 and B≠7) or (D=34 and B≠0)
:getKey→D
:End
:A+(D=26→A
:A-(D=24→A
:B+(D=25→B
:B-(D=34→B
:End
:StorePic 1
:A+1→A
:7-B→B
:C→[E](B,A
:C+1→C
:DelVar D
Generated by SourceCoder, © 2005 Cemetech
:0,0,1,1,2,2,2,2,2,2,3,3,4,4,4,5,5→∟B
:8,8→dim([E]
:DelVar DPlotsOff
:For(B,0,64,8
:Line(0,B,64,B
:Vertical B
:End
:1→C
:DelVar ADelVar BStorePic 1
:Repeat D=21
:1→dim(L1
:1→dim(L2
:augment(L1,∟A+(8A)→L1
:augment(L2,∟B+(8B)→L2
:Plot1Scatter ,L1,L2,[Dot]
:RecallPic 1
:Repeat D=21 or (D=24 and A≠0) or (D=26 and A≠7) or (D=25 and B≠7) or (D=34 and B≠0)
:getKey→D
:End
:A+(D=26→A
:A-(D=24→A
:B+(D=25→B
:B-(D=34→B
:End
:StorePic 1
:A+1→A
:7-B→B
:C→[E](B,A
:C+1→C
:DelVar D
Generated by SourceCoder, © 2005 Cemetech
My questions are:
1. Is there some faster way to generate the menu/grid? I noticed that when plotting the statisical sprites it erases everything on the graphscreen, so I decided the easiest way was to store the text and line in a temporary picture, and recall the picture after the sprite was plotted.
2. In the menu, the sprite for the cursor has a gap, yet when I plot it on the bottom-left of the screen, it doesn't have the gap. Why does this happen?
Thanks in advance for the help.