Qbasicnews.com

Qbasic "like" compilers/interpreters => FB Projects => Topic started by: j2krei08 on July 15, 2005, 06:53:12 PM



Title: 32Bowling For John
Post by: j2krei08 on July 15, 2005, 06:53:12 PM
Hey hey, I'm back for today.

I found out BLOAD, and now I'm ready.

If I can find a donor site to place my info, I would, but I have no internet site.  Can someone help me there?
I just need a place to store my images for a while.

I have decided to go a different route and change the physics from my old Qbowling.  I promise to post more information as availible (I still don't have internet).

My new physics are based on three things: ball placement, throwing angle, and strength.  The greater the angle and speed, the more it moves to different areas.  The pin physics will stay the same, though.  Knock down one and it just knocks down the others behind it.  And now with bmp's, I can draw out (beautifully) the things I want done.


Title: 32Bowling For John
Post by: j2krei08 on August 20, 2005, 10:42:51 PM
Hehe...  I just got a geocites account.

Here's screenshots:
(http://www.geocities.com/j2krei08/lane1.JPG)

(http://www.geocities.com/j2krei08/NewLane.JPG)


Title: 32Bowling For John
Post by: speedlemon on August 20, 2005, 11:47:06 PM
8)
good work john


Title: 32Bowling For John
Post by: j2krei08 on September 06, 2005, 04:55:54 PM
It's here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Finally, I have a Beta demo out.  It only has 3 frames and doesn't keep score.  Try it out: HERE. (http://www.geocities.com/j2krei08/index.html)

So try it out and tell me what you think.  If you beg, I might even give you the sourcecode.


Title: 32Bowling For John
Post by: j2krei08 on November 16, 2005, 03:21:00 PM
Hey, people!  Try it out!

Does anyone else have flashing problems?  I need some input on how to fix!  anyone willing to help gets the source code! :bounce:


Title: 32Bowling For John
Post by: marzecTM on November 16, 2005, 04:12:54 PM
WOAHHH FREE SOURCECODE! here i give you my internet! can i have the sources now? plz? thx yo


Title: 32Bowling For John
Post by: NecrosIhsan on November 16, 2005, 06:15:33 PM
:o  :lol:  :lol:  :lol:

Nice, marzec...

Seriously...a bowling game is kinda cool...you could have won my compo awhile back. :D


Title: 32Bowling For John
Post by: j2krei08 on November 17, 2005, 04:59:19 PM
Well, did you answer my question?

Does it flash disgustingly when you run it?  Only if you answer will you get the source.

It's here! (http://www.geocities.com/j2krei08/downloads.html)


Title: 32Bowling For John
Post by: SSC on November 18, 2005, 07:15:02 AM
yes it starts flashing on the second throw


Title: 32Bowling For John
Post by: j2krei08 on November 18, 2005, 03:25:54 PM
OK.  Here it is for FB.

Code:
DECLARE SUB ChooseBallColor()
DECLARE SUB DetLane (min,ln,x,lx,angln,lang)
DECLARE SUB DraPins(scrn)
DECLARE SUB DrawBall(which,x,y)
DECLARE SUB Hitpins (I,PinH)
DECLARE SUB INIT ()
DECLARE SUB ResetLane ()
DECLARE SUB ShowScore ()
DECLARE FUNCTION Strength()
DECLARE SUB Strike ()
DECLARE SUB Spare ()
DECLARE SUB Menu ()
DECLARE SUB Quitscreen ()
DECLARE SUB Pause ()
DECLARE SUB Moveball ()
DECLARE SUB Cheat ()
DECLARE SUB Bumpers ()
DECLARE SUB ShowRoll (I)
DECLARE SUB Hold(t&)
DECLARE SUB ShowballRoll

TYPE PINSTAT
   Up AS INTEGER
END TYPE

'Image Sprites
DIM SHARED PIN1(8192) AS UBYTE
DIM SHARED PIN2(4096) AS UBYTE
DIM SHARED BALL1(16384) AS UBYTE
DIM SHARED BALL2(4096) AS UBYTE
DIM SHARED BALL3(4096) AS UBYTE
DIM SHARED BALL4(4096) AS UBYTE
DIM SHARED SHADE(4096) AS UBYTE
DIM SHARED LANE(925696) AS UBYTE
DIM SHARED mouse(8192) AS UBYTE
DIM SHARED scrn(32*32*5) AS UBYTE
DIM SHARED choose (188416) AS UBYTE
DIM SHARED menus(1847296) AS UBYTE
DIM SHARED PINS(10) AS PINSTAT
DIM SHARED COL1%,COL2%,COL3%
DIM SHARED b,ang,tgt,speed,roll,move,angle,lx,score,rlb,s,queue,skip
DIM SHARED ACTUAL_ANGLE,ACTUAL_BALLX,ACTUAL_SPEED,ACTUAL_TARGT
DIM SHARED diff,sl,st,bump,onesecond

RANDOMIZE TIMER

INIT
MENU
ChooseBallColor
CLS
markedtime=timer
PRINT "Please Wait...":SCREENCOPY
FOR t& = 0 TO 30000000:NEXT
onesecond& = 30000000/(timer-markedtime)
PRINT "onesecond=",onesecond&
SLEEP 1000



DO
   RESETLANE
   FOR roll = 1 TO 2
      ang=175
      b=35
      move = 1
      x=314
      skip = 0
      TOP:
      DO
         BLOAD "DATA\LANE1.DAT",0
         RESTORE Pin1Up
         DraPins 1
         DrawBall(1,x-32,480-32)
         ShowballRoll
         SCREENCOPY
         IF move = 1 THEN
            DO
               N$ = INKEY$
               IF N$ = CHR$(255) + "M" THEN
                  x=x+41.333333
                  IF x > 490 THEN x=x-41.333333
               ELSE IF N$ = CHR$(255) + "K" THEN
                  x=x-41.333333
                  IF x < 150 THEN x = x+41.333333
                  END IF
               END IF
            LOOP UNTIL N$ > ""
         END IF
         
         IF move = 2 THEN
            LINE (x+1,448)-(ang,300),RGB (COL1%,COL2%,COL3%)
            SCREENCOPY
            SLEEP sl
            N$ = INKEY$
            ang=ang+b
            IF ang > 450 OR ang < 190 THEN b=-b
         END IF
         
         IF N$ = CHR$(27) THEN Quitscreen
         IF UCASE$(N$) = "P" THEN Pause
      LOOP UNTIL N$ = CHR$(32) OR N$ = CHR$(13)
         
      IF move = 1 THEN
         move = 2
         GOTO TOP
      END IF
     
     
      RESTORE LANE
      DetLane (min,ln,x,lx,angln,lang)
     
      STRENGTH
     
      FOR I=445 TO -10 STEP -speed
         RESTORE Pin2Up
         ShowRoll (I)
         IF bump = 1 THEN Bumpers
         Cheat      
         IF MULTIKEY(&h48) THEN skip = 1
         IF MULTIKEY(&h01) THEN Quitscreen
         Moveball
         Hitpins (I,0)
         IF UCASE$(N$) = "P" THEN Pause
         SLEEP 5
      NEXT
     
      IF s = 1 THEN
         IF roll = 2 THEN Spare
         IF roll = 1 THEN Strike
      ELSE
         FOR I = 1 TO 10
            IF Pins(I).Up = 0 THEN queue = queue + 1
         NEXT I
         score = score + queue
      END IF
      ShowScore
     
   NEXT roll

   frame = frame + 1

LOOP UNTIL frame = 10

Showscore
SLEEP 2000
STOP


SUB ShowballRoll
   IF roll >= 1 THEN
      LINE (225,2)-(245,6),&hFF0000,BF
      LINE(232,7)-(238,32),&hFF0000,BF
      LINE (225,33)-(245,37),&hFF0000,BF
   END IF
   IF roll = 2 THEN
      LINE (246,2)-(264,6),&hFF0000,BF
      LINE(253,7)-(259,32),&hFF0000,BF
      LINE (246,33)-(264,37),&hFF0000,BF
   END IF
END SUB

SUB ShowRoll (I)
   N$ = INKEY$
   PUT(0,0),LANE,TRANS
   DrawBall (2,lx,I)
   DraPins 2
   SCREENCOPY
END SUB

SUB Bumpers
   LINE (240,0)-(240,480),&hFF0000,BF
   LINE (395,0)-(395,480),&hFF0000,BF
   SCREENCOPY
END SUB

SUB Cheat
   IF MULTIKEY(&h2A) AND MULTIKEY(&h4B) THEN angle = angle - 2
   IF MULTIKEY(&h2A) AND MULTIKEY(&h4D) THEN angle = angle + 2
   IF skip <> 1 THEN SLEEP 50
END SUB

SUB MoveBall
   IF lx > 205 AND lx < 395 THEN
         IF ACTUAL_SPEED > ACTUAL_TARGT-30 AND ACTUAL_SPEED < ACTUAL_TARGT+30 THEN
            IF ACTUAL_ANGLE > ACTUAL_BALLX THEN lx = lx + angle
            IF ACTUAL_ANGLE < ACTUAL_BALLX THEN lx = lx - angle
         ELSE IF ACTUAL_SPEED > ACTUAL_TARGT+30 THEN
            IF ACTUAL_ANGLE > ACTUAL_BALLX THEN lx = lx + angle
            IF ACTUAL_ANGLE < ACTUAL_BALLX THEN lx = lx - angle
         ELSE IF ACTUAL_SPEED < ACTUAL_TARGT-30 THEN
            IF ACTUAL_ANGLE > ACTUAL_BALLX THEN lx = lx + angle
            IF ACTUAL_ANGLE < ACTUAL_BALLX THEN lx = lx - angle
         ELSE IF ACTUAL_SPEED < ACTUAL_TARGT+30 THEN
            IF ACTUAL_ANGLE > ACTUAL_BALLX THEN lx = lx + angle
            IF ACTUAL_ANGLE < ACTUAL_BALLX THEN lx = lx - angle
         END IF
      END IF
      END IF
      END IF
   END IF

   IF lx > 363 AND bump = 1 THEN angle = -angle
   IF lx < 240 AND bump = 1 THEN angle = -angle
END SUB

SUB ShowScore
   CLS
   DIM nums(32768) AS UBYTE
   DIM moveit(75*43*2) AS UBYTE
   DIM scoresh(270336) AS UBYTE
   s$ = STR$(score)+CHR$(32)
   FOR I = 1 TO 4
      e$ = MID$(s$,I,1)
      IF e$ = CHR$(32) THEN
         f = I - 1
         I = 4
      END IF
   NEXT I
   BLOAD "DATA\NUMBERS.DAT",VARPTR(nums(0))
   BLOAD "DATA\SCORE.DAT",VARPTR(scoresh(0))
   FOR I = 1 TO f
      a = -(VAL(MID$(s$,I,1)))*42
      PUT(xx,a),nums,TRANS
      LINE (xx, 43)-(xx + 25,480),0,BF
      xx = xx + 25
   NEXT I
   PUT (0,50),scoresh,TRANS
   SCREENCOPY
   t = TIMER
   DO
      N$ = INKEY$
      IF UCASE$(N$) = "P" THEN Pause
      IF N$ = CHR$(27) THEN Quitscreen
   LOOP UNTIL N$ > "" OR TIMER > t + 2
END SUB

SUB Hitpins (I,PinH)
   IF (lx > 220 AND lx < 270 AND I < 65 AND Pins(1).Up = 1) OR PinH = 1 THEN
      Pins(1).Up = 0
   END IF
   
   IF PinH = 2 AND Pins(2).Up = 1 THEN
      Pins(2).Up = 0
   END IF
   
   IF PinH = 3 AND Pins(3).Up = 1 THEN
      Pins(3).Up = 0
   END IF
   
   IF (lx > 347 AND lx < 387 AND I < 65 AND Pins(4).Up = 1) OR PinH = 4 THEN
      Pins(4).Up = 0
   END IF
   
   IF (lx > 235 AND lx < 255 AND I < 81 AND I > 55 AND Pins(5).Up = 1) OR PinH = 5 THEN
      Pins(5).Up = 0
      Hitpins (I,1)
      Hitpins (I,2)
   END IF
   
   IF PinH = 6 AND Pins(6).Up = 1 THEN
      Pins(6).Up = 0
   END IF
   
   IF (lx > 347 AND lx < 366 AND I < 53 AND I > 68 AND Pins(7).Up = 1) OR PinH = 7 THEN
      Pins(7).Up = 0
      HitPins (I,3)
      HitPins(I,4)
   END IF
   
   IF (lx > 258 AND lx < 282 AND I < 116 AND I > 95 AND Pins(8).Up = 1) OR PinH = 8 THEN
      Pins(8).Up = 0
      Hitpins (I,1)
      Hitpins (I,2)
      Hitpins (I,3)
      Hitpins (I,5)
      Hitpins (I,6)
   END IF
   
   IF (lx > 317 AND lx < 357 AND I < 116 AND I > 82 AND Pins(9).Up = 1) OR PinH = 9 THEN
      Pins(9).Up = 0
      Hitpins (I,2)
      Hitpins (I,3)
      Hitpins (I,4)
      Hitpins (I,6)
      Hitpins (I,7)
   END IF
   
   IF (lx > 280 AND lx < 329 AND I < 145 AND I > 110 AND Pins(10).Up = 1) THEN
      Pins(10).Up = 0
      Hitpins (I,9)
      Hitpins (I,8)
      S = 1
   END IF
   
   
   
END SUB

SUB Strike
   WHILE INKEY$ <> "": WEND
   Score = score + 30
   CLS
   BLOAD "DATA\STRIKE.DAT",0
   SCREENCOPY
   DO
      N$ = INKEY$
      IF UCASE$(N$) = "P" THEN Pause
      IF N$ = CHR$(27) THEN Quitscreen
   LOOP WHILE N$ = ""
   roll = 2
   s = 0
END SUB

SUB Spare
   WHILE INKEY$ <> "": WEND
   Score = score - queue
   Score = score + 20
   CLS
   BLOAD "DATA\SPARE.DAT",0
   SCREENCOPY
   DO
      N$ = INKEY$
      IF UCASE$(N$) = "P" THEN Pause
      IF N$ = CHR$(27) THEN Quitscreen
   LOOP WHILE N$ = ""
   roll = 2
   s = 0
END SUB

SUB DetLane (min,ln,x,lx,angln,lang)
   
   FOR I = 1 TO 9
      READ min,ln
      SCREENCOPY
      IF x >=min-1 AND x<=min+20.666666 THEN
         LANES = ln
         I = 9
      END IF
   NEXT I
   IF ln < 9 THEN
      DO
         READ null
      LOOP UNTIL null = 9
   END IF
   
   FOR I = 1 TO ln
      READ lx
   NEXT I
   
   RESTORE LANE
   FOR I = 1 TO 9
      READ min,angln
      SCREENCOPY
      IF ang >=min-1 AND ang<=min+20.666666 THEN
         ANGLE = angln
         I = 9
      END IF
   NEXT I
   IF angln < 9 THEN
      DO
         READ null
      LOOP UNTIL null = 9
   END IF
   
   FOR I = 1 TO angln
      READ lang
   NEXT I
   
   ACTUAL_ANGLE = ang-36
   ACTUAL_BALLX = x
END SUB

SUB ChooseBallColor ()
   x=-50
   f = INT(RND * 3)+ 1
   SETMOUSE 240,320,0
   mouseframe = 1
   mousedraw = 0
   DO
      BLOAD "DATA\Chooseball2.DAT",0
     
      GETMOUSE mx,my,,mb
     
      IF f = 1 THEN
         PUT (0,0),choose,PSET
         LINE(0,32)-(640,96),0,BF
      ELSE
         IF f = 2 THEN
            PUT (0,-32),choose,PSET
            LINE (0,32)-(640,64),0,BF
         ELSE
            IF f = 3 THEN
               PUT (0,-64),choose, PSET
            END IF
         END IF
      END IF
     
      IF mouseframe = 1 THEN
         GET (mx,my + 32)-(mx + 32,my + 64),scrn
         PUT (mx,my),mouse,TRANS
         PUT (mx,my + 32),scrn,PSET
      ELSE
         GET (mx,my-32)-(mx+32,my),scrn
         PUT (mx,my - 32),mouse,TRANS
         PUT (mx,my-32),scrn,PSET
      END IF
     
      SCREENCOPY
      SLEEP 1
      mousedraw=mousedraw+1
      IF mousedraw > 50 THEN
         mouseframe = -mouseframe
         mousedraw = 0
      END IF
     
      IF(my>=100 AND my<=132)AND mb=1 THEN GOSUB SELECTS
     
      IF INKEY$ = CHR$(27) THEN END
     
   LOOP
   
   SELECTS:
      IF (mx>=14 AND mx<=45) AND mb=1 THEN
         COL1=255:COL2=0:COL3=0
      ELSE IF (mx>=78 AND mx<=110) AND mb=1 THEN
         COL1=255:COL2=255:COL3=0
      ELSE IF (mx>=142 AND mx<=174) AND mb=1 THEN
         COL1=0:COL2=255:COL3= 0
      ELSE IF (mx>=204 AND mx<=236) AND mb=1 THEN
         COL1=0:COL2=0:COL3=255
      ELSE IF (mx>=268 AND mx<=300) AND mb=1 THEN
         COL1=255:COL2=128:COL3=64
      ELSE IF (mx>=332 AND mx<=364) AND mb=1 THEN
         COL1=0:COL2=128:COL3=0
      ELSE IF (mx>=396 AND mx<=428) AND mb=1 THEN
         COL1=0:COL2=0:COL3=128
      ELSE IF (mx>=460 AND mx<=492) AND mb=1 THEN
         COL1=128:COL2=0:COL3=0
      ELSE IF(mx>=524 AND mx<=556) AND mb=1 THEN
         COL1=128:COL2=128:COL3=0
      ELSE IF (mx>=588 AND mx<=620) AND mb=1 THEN
         COL1=64:COL2=64:COL3= 64
      ELSE RETURN
      END IF
   END IF
   END IF
   END IF
   END IF
   END IF
   END IF
   END IF
   END IF
   END IF
   CLS
   SETMOUSE 0,0,0
END SUB

FUNCTION Strength ()
   J=1:L=1:I=480:K=480:A=1:B=1
   IF ACTUAL_ANGLE >= ACTUAL_BALLX THEN tgt = ACTUAL_ANGLE - ACTUAL_BALLX
   IF ACTUAL_ANGLE < ACTUAL_BALLX THEN tgt = ACTUAL_BALLX - ACTUAL_ANGLE
   SCREENSET 0
   DO
      N$ = INKEY$
      I=I-A
      J=J+B
      LINE (0,tgt-30)-(30,tgt+30),&hFF0000,B
      LINE (5,I)-(15,I),RGB(J/2,I/2,J/10)
      LINE (5,I-1)-(15,I-1),0
      IF I=1 OR I = 480 THEN A=-A
      IF J=1 OR J = 480 THEN B=-B
      IF UCASE$(N$) = "P" THEN
         SCREENSET 1,0
         Pause
      END IF
      IF N$ = CHR$(27) THEN
         SCREENSET 1,0
         Quitscreen
      END IF
      HOLD onesecond& / st
   LOOP UNTIL N$=CHR$(32) OR N$ = CHR$(13)
   A=1:B=1
   DO
      N$ = INKEY$
      K=K-A
      L=L+B
      LINE (15,K)-(25,K),RGB(L/4,K/2,L/4)
      LINE (15,K-1)-(25,K-1),RGB(0,0,0)
      IF K=1 OR K = 480 THEN A=-A
      IF L=1 OR L = 480 THEN B=-B
      IF UCASE$(N$) = "P" THEN
         SCREENSET 1,0
         Pause
      END IF
      IF N$ = CHR$(27) THEN
         SCREENSET 1,0
         Quitscreen
      END IF
      HOLD onesecond / st
   LOOP UNTIL N$=CHR$(32) OR N$ = CHR$(13)
   
   ACTUAL_SPEED = 480-I
   ACTUAL_TARGT = 480-tgt
   speed=INT(480-I)/16
   angle=INT(((480-K)/64))*1.5
   tgt = INT((480-tgt)/16)*1.5
   IF ACTUAL_BALLX = 150 OR ACTUAL_BALLX = 478 AND bump = 0 THEN
      tgt = 0
      angle = 0
   END IF
   IF speed=0 THEN speed=1
END FUNCTION

SUB DrawBall (which,x,y)
      IF which = 1 THEN
         PUT (x,y), ball1,TRANS
         PAINT (x+31,y+31),RGB(COL1,COL2,COL3),0
      END IF
     
      IF which = 2 THEN
         rlb = rlb + speed
         IF rlb >= INT((ACTUAL_TARGT+ACTUAL_ANGLE)/32) * 3 THEN rlb = 0
         IF rlb <= INT((ACTUAL_TARGT+ACTUAL_ANGLE)/32) THEN
            PUT (x,y),BALL4,TRANS
         ELSE IF rlb >= INT((ACTUAL_TARGT+ACTUAL_ANGLE)/32)+1 AND rlb <= INT((ACTUAL_TARGT+ACTUAL_ANGLE)/32)*2 THEN
            PUT (x,y),BALL3,TRANS
         ELSE IF rlb >= INT((ACTUAL_TARGT+ACTUAL_ANGLE)/32)*2+1 AND rlb <= INT((ACTUAL_TARGT+ACTUAL_ANGLE)/32)*3 THEN
            PUT (x,y),BALL2,TRANS
               END IF
            END IF
      END IF
      PAINT (x+16,y+16),RGB(COL1,COL2,COL3),&hC0C0C0
      PUT (x,y),SHADE,TRANS
   END IF
END SUB

SUB DraPins (scrn)
   
   IF scrn = 1 THEN
      FOR I=1 TO 10
         READ x,y
         IF Pins(I).Up=1 THEN
            PUT (x,y),PIN1,TRANS
         END IF
      NEXT I
   END IF
   
   IF scrn = 2 THEN
      FOR I=1 TO 10
         READ x,y
         IF Pins(I).Up=1 THEN
            PUT (x,y),PIN2,TRANS
         END IF
      NEXT I
   END IF
   
   
   
END SUB

SUB INIT
   
   SCREEN 18,16,2,1
   SCREENSET 1,0
   
   BLOAD "DATA\PIN1.DAT",VARPTR(PIN1(0))
   BLOAD "DATA\PIN2.DAT",VARPTR(PIN2(0))
   BLOAD "DATA\LANE2.DAT",VARPTR(LANE(0))
   BLOAD "DATA\BALL1.DAT",VARPTR(BALL1(0))
   BLOAD "DATA\BALL2.DAT",VARPTR(BALL2(0))
   BLOAD "DATA\BALL3.DAT",VARPTR(BALL3(0))
   BLOAD "DATA\BALL4.DAT",VARPTR(BALL4(0))
   BLOAD "DATA\SHADING.DAT",VARPTR(SHADE(0))
   BLOAD "DATA\Chooseball.DAT",VARPTR(choose(0))
   BLOAD "DATA\Mouse.DAT", VARPTR(mouse(0))
   BLOAD "DATA\Difficulty.DAT",VARPTR(menus(0))
END SUB

SUB ResetLane
   
   FOR I=1 TO 10
      PINS(I).Up=1
   NEXT I
   
END SUB

SUB Menu
   mouseframe=1
   SETMOUSE 320,240,0
   DO
      GETMOUSE mx,my,,mb
      PUT (0,0),menus,PSET
      SCREENCOPY
      N$ = INKEY$
      IF N$ = CHR$(27) THEN Quitscreen
   LOOP UNTIL N$ = CHR$(32) OR mb = 1
   
   DO
      PUT (0,-480),menus,PSET
      GETMOUSE mx,my,,mb
      IF mouseframe = 1 THEN
         GET (mx,my + 32)-(mx + 32,my + 64),scrn
         PUT (mx,my),mouse,TRANS
         PUT (mx,my + 32),scrn,PSET
      ELSE
         GET (mx,my - 32)-(mx + 32,my),scrn
         PUT (mx,my - 32),mouse,TRANS
         PUT (mx,my - 32),scrn,PSET
      END IF
     
      SCREENCOPY
      SLEEP 1
      mousedraw=mousedraw+1
      IF mousedraw > 50 THEN
         mouseframe = -mouseframe
         mousedraw = 0
      END IF
     
      IF mb = 1 THEN
         IF mx >= 272 AND mx <= 346 AND my >= 27 AND my <= 52 THEN
            diff = 1
            EXIT DO
         END IF
         IF mx >= 267 AND mx <= 351 AND my >= 158 AND my <= 172 THEN
            diff = 2
            EXIT DO
         END IF
         IF mx >= 276 AND mx <= 337 AND my >= 263 AND my <= 298 THEN
            diff = 3
            EXIT DO
         END IF
         IF mx > 568 AND mx < 615 AND my > 449 AND my < 467 THEN Quitscreen
      END IF
      IF INKEY$ = CHR$(27) THEN Quitscreen
   LOOP
   
   IF diff = 1 THEN
      sl = 50
      st = 150
      bump = 1
   END IF
   IF diff = 2 THEN
      sl = 30
      st = 100
      bump = 0
   END IF
   IF diff = 3 THEN
      sl = 10
      st = 70
      bump = 0
   END IF
   
END SUB

SUB Quitscreen
   CLS
   t = TIMER
   DO
      BLOAD "DATA\Quitscreen.DAT",0
      SCREENCOPY
   LOOP UNTIL TIMER > t + 2
   END
END SUB

SUB Pause
   CLS
   mouseframe = 1
   SETMOUSE 320,240,0
   DO
      BLOAD "DATA\PAUSE.DAT",0
      Drawball (1,290,415)
      GETMOUSE mx,my,,mb
      IF mouseframe = 1 THEN
         GET (mx,my + 32)-(mx + 32,my + 64),scrn
         PUT (mx,my),mouse,TRANS
         PUT (mx,my + 32),scrn,PSET
      ELSE
         GET (mx,my - 32)-(mx + 32,my),scrn
         PUT (mx,my - 32),mouse,TRANS
         PUT (mx,my - 32),scrn,PSET
      END IF
     
      SCREENCOPY
      SLEEP 5
      mousedraw=mousedraw+1
      IF mousedraw > 50 THEN
         mouseframe = -mouseframe
         mousedraw = 0
      END IF
     
      IF mx > 217 AND mx < 348 AND my > 123 AND my < 141 AND mb = 1 THEN EXIT DO
      IF mx > 217 AND mx < 423 AND my > 171 AND my < 189 AND mb = 1 THEN ChooseBallColor
      IF mx > 217 AND mx < 392 AND my > 219 AND my < 237 AND mb = 1 THEN Showscore
      IF mx > 217 AND mx < 278 AND my > 267 AND my < 290 AND mb = 1 THEN Quitscreen
     
      IF my > 380 THEN setmouse mx,380,0
     
   LOOP UNTIL INKEY$ = CHR$(27)
END SUB

SUB Hold (t&)
   FOR counter = 0 to t&:NEXT
END SUB

Pin1Up:
DATA 255,56,288,56,319,56,350,56,270,73,303,73,334,73,288,91,319,91,303,113

Pin2Up:
DATA 240,10,280,10,320,10,360,10,260,40,300,40,340,40,280,70,320,70,300,100

LANE:
DATA 150,1,191,2,232,3,273,4,315,5,356,6,397,7,439,8,480,9
DATA 210,235,250,270,300,335,348,360,390


It needs to be put one directory above DATA, in where Bowling.exe is to work.  Please, any input is helpful.


Title: 32Bowling For John
Post by: MystikShadows on November 18, 2005, 04:46:43 PM
The first ball doesn't flash all that much...

The second and 3rd ball flash alot more and somethign causes the pins to flash too after the first shot.

All in all it's a nice concept though..well made.


Title: 32Bowling For John
Post by: j2krei08 on November 21, 2005, 02:34:24 PM
Maybe screenlock to lock until it's drawn?


Title: 32Bowling For John
Post by: j2krei08 on December 09, 2005, 03:25:03 PM
Wait.  You need the files.  Download it on my new site:


http://www.geocities.com/jkrei08/32bowlingws.zip


Title: 32Bowling For John
Post by: speedlemon on December 09, 2005, 09:57:59 PM
fixed link:
http://www.geocities.com/j2krei08/32bowlingws.zip


Title: 32Bowling For John
Post by: j2krei08 on December 10, 2005, 03:34:44 PM
Oh, thanks :)


Title: 32Bowling For John
Post by: j2krei08 on December 15, 2005, 03:26:02 PM
So, can you help with the flashing or timing?


Title: 32Bowling For John
Post by: Zack on December 15, 2005, 08:54:58 PM
j2krei, not to stray from the topic or anything...but your avatar scares the hell outta me.


Title: 32Bowling For John
Post by: jsmith71 on December 15, 2005, 08:55:46 PM
Quote from: "Zack"
j2krei, not to stray from the topic or anything...but your avatar scares the hell outta me.

Pink Floyd man, Pink Floyd! :wink:


Title: 32Bowling For John
Post by: j2krei08 on December 16, 2005, 01:47:38 PM
Yes, my avatar is wierd, and it took me an hour to get it just right (ripped straight from the movie)

Anywho, I changed a few things myself and I will replace the file online by Monday.

Still, can someone help me with the scoring process?  I want it like regular, because right now it just adds 30 for strikes and 20 for spares.


Title: 32Bowling For John
Post by: j2krei08 on December 21, 2005, 02:01:34 PM
I updated the file.

I fixed some things and made some things completely different.

Download it and see (I need testers badly)


Title: 32Bowling For John
Post by: j2krei08 on January 10, 2006, 02:47:49 PM
If anyone happens to care, I am redoing my site.  My links will be empty for a while, so hang on a sec.


Title: 32Bowling For John
Post by: j2krei08 on January 31, 2006, 05:12:56 PM
OK, I'm trying a new approach, sprites.

I created a sprite loader and included it before the program.  I am completely re-writing the thing from scratch.

But, can I do this easier?
Code:

IF (mx > 100 AND mx < 150) AND (my > 100 AND my < 150) THEN


I don't want to have it that long.  How can I combine them?


Title: 32Bowling For John
Post by: Z!re on February 01, 2006, 05:01:47 AM
Quote from: "j2krei08"
OK, I'm trying a new approach, sprites.

I created a sprite loader and included it before the program.  I am completely re-writing the thing from scratch.

But, can I do this easier?
Code:

IF (mx > 100 AND mx < 150) AND (my > 100 AND my < 150) THEN


I don't want to have it that long.  How can I combine them?
Code:
If mx+my*MaxX > 100+100*MaxX and mx+my*MaxX < 150+150*MaxX then
Point being: You cant do it shorter


Title: 32Bowling For John
Post by: j2krei08 on February 02, 2006, 06:56:00 PM
Oh.

There should be a way similar to LINE or GET, you know:
Code:
IF mx > (x1,y1)-(x2,y2) THEN

But oh well.

The entire size is greatly decreased, but I still am not satisfied.  BMP is still too big.  How could I make an image, say 320*240 stretch to 640*480?  That would reduce resolution, but I feel size is a huge part of this project.


Title: 32Bowling For John
Post by: TheDarkJay on February 03, 2006, 01:42:48 PM
Instead of get use point to store the image into an array and write a function that passes a pointer to it to draw the image...

I'd write an example of such a function but after learning pointers in C++ I never learned them in FreeBASIC...


Title: 32Bowling For John
Post by: j2krei08 on February 13, 2006, 03:14:33 PM
That's kinda what I did,
Code:

'$include:'fbgfx.bi'
DECLARE FUNCTION Font (spritex,spritey,text AS STRING,num AS INTEGER)
DECLARE FUNCTION PlaceSprite (spritex,spritey,sprite AS STRING,mode,alpha_level)

DIM SHARED Aboutbtn     (8780)      AS INTEGER
DIM SHARED ball_roll    (5140)      AS INTEGER
DIM SHARED big_ball     (4100)      AS INTEGER
DIM SHARED Chooseball   (223129)    AS INTEGER
DIM SHARED Font_letter  (12264)     AS INTEGER
DIM SHARED Hiscrbtn     (21392)     AS INTEGER
DIM SHARED Load         (37644)     AS INTEGER
DIM SHARED Mainback     (307204)    AS INTEGER
DIM SHARED Mouse        (1716)      AS INTEGER
DIM SHARED Menubuttons  (18544)     AS INTEGER
DIM SHARED Optinbtn     (14408)     AS INTEGER
DIM SHARED Pins         (2168)      AS INTEGER
DIM SHARED Radiumv      (70744)     AS INTEGER
DIM SHARED Startbtn     (4216)      AS INTEGER
DIM SHARED x            (260)       AS INTEGER
DIM SHARED ball_color

SCREEN 18,16,2,GFX_FULLSCREEN
SCREENSET 1,0
setmouse 320,240,0
SLEEP 1000
OPEN "Data\Text\Highscores.dat" FOR RANDOM AS #1
BLOAD "DATA\Images\Mainmenu.bmp",VARPTR(Mainback(0))
GET (0,0)-(640,480),Mainback(0)

BLOAD "DATA\Images\Font.bmp",0
   l_num = -1
   FOR I = 0 TO 111 STEP 18
      FOR J = 0 TO 107 STEP 16
         l_num = l_num + 1
         GET(J,I)-(J + 15, I + 17),Font_letter(292 * l_num)
      NEXT J
   NEXT I
   CLS
BLOAD "DATA\Images\menu_buttons.bmp", 0
   GET (0,0)-(161,25),  Menubuttons(0)
   GET (0,27)-(112,60), Menubuttons(4216)
   GET (0,62)-(176,95), Menubuttons(8062)
   GET (0,97)-(89,122), Menubuttons(14084)
   GET (0,124)-(63,156),Menubuttons(16200)
   CLS
BLOAD "DATA\Images\ball.bmp",0
   GET (0,0)-(31,31),ball_roll(0)
   GET (0,32)-(31,63),ball_roll(1029)
   GET (0,64)-(31,95),ball_roll(2057)
   GET (0,96)-(31,127),ball_roll(3085)
   GET (32,64)-(63,95),ball_roll(4112)
   GET (32,0)-(96,64),big_ball(0)
   CLS
BLOAD "DATA\Images\mouse.bmp",0
   GET(0,0)-(16,24),Mouse(0)
   GET(0,25)-(18,49),Mouse(454)
   GET(17,0)-(33,24),Mouse(908)
   GET(18,25)-(33,49),Mouse(1312)
   CLS
BLOAD "DATA\Images\Radiumv.bmp",0
   GET (0,0)-(539,130),Radiumv(0)
   CLS
BLOAD "DATA\Images\load.bmp",0
   GET (256,0)-(512,48),Load(0)
   GET (0,0)-(255,48),Load(12292)
   GET (0,49)-(256,99),Load(25352)
   CLS
BLOAD "DATA\Images\Pins.bmp"
   GET (0,0)-(19,58),Pins(0)
   GET (21,0)-(40,38),Pins(1160)
   GET (21,40)-(30,58),Pins(1890)
   GET (31,46)-(40,58),Pins(2056)
BLOAD "DATA\Images\Chooseball.bmp"
   GET (0,0)-(625,357),Chooseball(0)
CLS

FUNCTION Font (spritex,spritey,text AS STRING,num AS INTEGER)
   l_next = 0
   IF num > -1 THEN text = STR$(num)
   text = UCASE$(text)
   FOR a = 1 TO LEN(text)
      IF MID$(text,a,1) = " " THEN l_num = -1
      IF MID$(text,a,1) = "A" THEN l_num = 0
      IF MID$(text,a,1) = "B" THEN l_num = 1
      IF MID$(text,a,1) = "C" THEN l_num = 2
      IF MID$(text,a,1) = "D" THEN l_num = 3
      IF MID$(text,a,1) = "E" THEN l_num = 4
      IF MID$(text,a,1) = "F" THEN l_num = 5
      IF MID$(text,a,1) = "G" THEN l_num = 6
      IF MID$(text,a,1) = "H" THEN l_num = 7
      IF MID$(text,a,1) = "I" THEN l_num = 8
      IF MID$(text,a,1) = "J" THEN l_num = 9
      IF MID$(text,a,1) = "K" THEN l_num = 10
      IF MID$(text,a,1) = "L" THEN l_num = 11
      IF MID$(text,a,1) = "M" THEN l_num = 12
      IF MID$(text,a,1) = "N" THEN l_num = 13
      IF MID$(text,a,1) = "O" THEN l_num = 14
      IF MID$(text,a,1) = "P" THEN l_num = 15
      IF MID$(text,a,1) = "Q" THEN l_num = 16
      IF MID$(text,a,1) = "R" THEN l_num = 17
      IF MID$(text,a,1) = "S" THEN l_num = 18
      IF MID$(text,a,1) = "T" THEN l_num = 19
      IF MID$(text,a,1) = "U" THEN l_num = 20
      IF MID$(text,a,1) = "V" THEN l_num = 21
      IF MID$(text,a,1) = "W" THEN l_num = 22
      IF MID$(text,a,1) = "X" THEN l_num = 23
      IF MID$(text,a,1) = "Y" THEN l_num = 24
      IF MID$(text,a,1) = "Z" THEN l_num = 25
      IF MID$(text,a,1) = "0" THEN l_num = 26
      IF MID$(text,a,1) = "1" THEN l_num = 27
      IF MID$(text,a,1) = "2" THEN l_num = 28
      IF MID$(text,a,1) = "3" THEN l_num = 29
      IF MID$(text,a,1) = "4" THEN l_num = 30
      IF MID$(text,a,1) = "5" THEN l_num = 31
      IF MID$(text,a,1) = "6" THEN l_num = 32
      IF MID$(text,a,1) = "7" THEN l_num = 33
      IF MID$(text,a,1) = "8" THEN l_num = 34
      IF MID$(text,a,1) = "9" THEN l_num = 35
      IF MID$(text,a,1) = "!" THEN l_num = 36
      IF MID$(text,a,1) = "?" THEN l_num = 37
      IF MID$(text,a,1) = "." THEN l_num = 38
      IF MID$(text,a,1) = "@" THEN l_num = 39
      IF MID$(text,a,1) = "," THEN l_num = 40
      IF MID$(text,a,1) = "_" THEN l_num = 41
      IF l_num >= 0 THEN PUT(spritex + l_next,spritey),Font_letter(292 * l_num),TRANS
      FOR I = 27 TO 35
         IF l_num = I THEN l_next = l_next - 3
      NEXT I
      IF l_num = 8 OR l_num = 9 OR l_num = 18 THEN l_next = l_next - 4
      l_next = l_next + 14
   NEXT
END FUNCTION

FUNCTION PlaceSprite (spritex,spritey,sprite AS STRING,mode,alpha_level)

   sprite$ = LCASE$(sprite$)
   IF mode = 0 THEN 'PSET Only
      IF sprite$ = "Chooseball screen" THEN PUT(spritex,spritey),Chooseball(0)
   END IF
   
   IF mode = 1 THEN  'Trans Only
      IF sprite$ = "big ball" THEN
         PUT(spritex,spritey),big_ball(0),TRANS
         PAINT(spritex + 32,spritey + 32),ball_color,&hC0C0C0
      END IF
      IF sprite$ = "startbtn" THEN PUT(spritex,spritey),Menubuttons(0),TRANS
      IF sprite$ = "optinbtn" THEN PUT(spritex,spritey),Menubuttons(4216),TRANS
      IF sprite$ = "hiscrbtn" THEN PUT(spritex,spritey),Menubuttons(8062),TRANS
      IF sprite$ = "aboutbtn" THEN PUT(spritex,spritey),Menubuttons(14084), TRANS
      IF sprite$ = "quitsbtn" THEN PUT(spritex,spritey),Menubuttons(16200), TRANS
     
      IF sprite$ = "load 1" THEN PUT(spritex,spritey),Load(0),TRANS
      IF sprite$ = "load 2" THEN PUT(spritex,spritey),Load(12292),TRANS
      IF sprite$ = "load 3" THEN PUT(spritex,spritey),Load(25352),TRANS
   END IF
   
   IF mode = 2 THEN  'Alpha Only
      IF sprite$ = "radiumv" THEN PUT(spritex,spritey),Radiumv(0),ALPHA,alpha_level
      IF sprite$ = "mainmenu" THEN PUT(0,0),Mainback(0),ALPHA,alpha_level
   END IF

   IF mode = 3 THEN  'Trans with Alpha Shadow
      IF MID$(sprite$,1,8) = "ballroll" THEN
         IF MID$(sprite$,10,1) = "1" THEN PUT(spritex,spritey),ball_roll(0),TRANS
         IF MID$(sprite$,10,1) = "2" THEN PUT(spritex,spritey),ball_roll(1029),TRANS
         IF MID$(sprite$,10,1) = "3" THEN PUT(spritex,spritey),ball_roll(2057),TRANS
         PAINT(spritex + 16,spritey + 16),ball_color,&hC0C0C0
         PUT(spritex,spritey),ball_roll(4112),ALPHA,128
      END IF
     
      IF MID$(sprite$,1,5) = "mouse" THEN
         IF MID$(sprite$,7,1) = "1" THEN
            PUT(spritex,spritey),Mouse(908),ALPHA,180
            PUT(spritex,spritey),Mouse(0),TRANS
         END IF
         IF MID$(sprite$,7,1) = "2" THEN
            PUT(spritex+3,spritey),Mouse(1312),ALPHA,180
            PUT(spritex,spritey),Mouse(454),TRANS
         END IF
      END IF
     
      IF MID$(sprite$,1,3) = "pin" THEN
         IF MID$(sprite$,5) = "1" THEN
            PUT(spritex,spritey),PINS(0),TRANS
            PUT(spritex+16,spritey+40),PINS(1890),ALPHA,128
         END IF
         IF MID$(sprite$,5) = "2" THEN
            PUT(spritex,spritey),PINS(1160),TRANS
            PUT(spritex+16,spritey+26),PINS(2056),ALPHA,128
         END IF
      END IF
   END IF
   
END FUNCTION



Part one is text font and 2 is sprites.  I should convert to point, though.


Title: 32Bowling For John
Post by: na_th_an on February 14, 2006, 07:48:49 AM
You can make it a bit shorter and faster. In your text printing routine you are calculating Mid$(text, a, 1) a lot of times - you can precalculate this. Plus all those lines can be shortened::

Replace this:

Code:
    IF MID$(text,a,1) = "A" THEN l_num = 0
      IF MID$(text,a,1) = "B" THEN l_num = 1
      IF MID$(text,a,1) = "C" THEN l_num = 2
      IF MID$(text,a,1) = "D" THEN l_num = 3
      IF MID$(text,a,1) = "E" THEN l_num = 4
      IF MID$(text,a,1) = "F" THEN l_num = 5
      IF MID$(text,a,1) = "G" THEN l_num = 6
      IF MID$(text,a,1) = "H" THEN l_num = 7
      IF MID$(text,a,1) = "I" THEN l_num = 8
      IF MID$(text,a,1) = "J" THEN l_num = 9
      IF MID$(text,a,1) = "K" THEN l_num = 10
      IF MID$(text,a,1) = "L" THEN l_num = 11
      IF MID$(text,a,1) = "M" THEN l_num = 12
      IF MID$(text,a,1) = "N" THEN l_num = 13
      IF MID$(text,a,1) = "O" THEN l_num = 14
      IF MID$(text,a,1) = "P" THEN l_num = 15
      IF MID$(text,a,1) = "Q" THEN l_num = 16
      IF MID$(text,a,1) = "R" THEN l_num = 17
      IF MID$(text,a,1) = "S" THEN l_num = 18
      IF MID$(text,a,1) = "T" THEN l_num = 19
      IF MID$(text,a,1) = "U" THEN l_num = 20
      IF MID$(text,a,1) = "V" THEN l_num = 21
      IF MID$(text,a,1) = "W" THEN l_num = 22
      IF MID$(text,a,1) = "X" THEN l_num = 23
      IF MID$(text,a,1) = "Y" THEN l_num = 24
      IF MID$(text,a,1) = "Z" THEN l_num = 25
      IF MID$(text,a,1) = "0" THEN l_num = 26
      IF MID$(text,a,1) = "1" THEN l_num = 27
      IF MID$(text,a,1) = "2" THEN l_num = 28
      IF MID$(text,a,1) = "3" THEN l_num = 29
      IF MID$(text,a,1) = "4" THEN l_num = 30
      IF MID$(text,a,1) = "5" THEN l_num = 31
      IF MID$(text,a,1) = "6" THEN l_num = 32
      IF MID$(text,a,1) = "7" THEN l_num = 33
      IF MID$(text,a,1) = "8" THEN l_num = 34
      IF MID$(text,a,1) = "9" THEN l_num = 35
      IF MID$(text,a,1) = "!" THEN l_num = 36
      IF MID$(text,a,1) = "?" THEN l_num = 37
      IF MID$(text,a,1) = "." THEN l_num = 38
      IF MID$(text,a,1) = "@" THEN l_num = 39
      IF MID$(text,a,1) = "," THEN l_num = 40
      IF MID$(text,a,1) = "_" THEN l_num = 41


With:

Code:
m$ = Mid$ (text, a, 1)
If m$ >= "A" And m$ <= "Z" Then
    l_num = Asc (m$) - Asc ("A")
Else If m$ >= "0" And m$ <= "9" Then
    l_num = 26 + Val (m$)
Else If m$ = "!" Then
    l_num = 36
Else If m$ = "?" Then
    l_num = 37
Else If m$ = "." Then
    l_num = 38
Else If m$ = "@" Then
    l_num = 39
Else If m$ = "," Then
    l_num = 40
Else If m$ = "_" Then
    l_num = 41
End If


---

Though it could have been shortened significally using some leet function shredding - nice one-liner, which replace all those IFs:

Code:
l_num = Instr ("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!?.@,_", Mid$ (text, a, 1)) - 1


What the above line does is:

1.- get the current character  with Mid$ (text, a, 1)
2.- look for it in the "ABCDEF... string. Instr will return a number with its position within the string or 0 if it is not found.
3.- We substract 1.

That way if Mid$ (text, a, 1) = "B", Instr returns "2", we substract 1 and we get l_num = 1, for example. Or if Mid$ (text, a, 1) = " " ,Instr returns "0", we substract 1 and we get l_num = -1.


Title: 32Bowling For John
Post by: j2krei08 on February 14, 2006, 12:05:40 PM
Wow, that one line replaces everything!?  Thanks! :D  :D  :D


Title: 32Bowling For John
Post by: j2krei08 on March 27, 2006, 06:59:21 PM
Alright, I've been working on this for a while, and I came to a tick.

When aiming the ball after selecting position, the line to direct the ball goes straight across.  I want it to curve, maybe someone could help me with the trig?  Move around with mouse.  Just generic points, I can change them later.

(http://radiumv.phatcode.net/bowlingaim.gif)


Title: 32Bowling For John
Post by: Torahteen on March 27, 2006, 07:09:28 PM
I could help with trig. What is it you needed?


Title: 32Bowling For John
Post by: j2krei08 on March 27, 2006, 07:26:24 PM
K, let's see if I can explain this, I don't have the work with me.

I have the bowling lane images drawn on screen of 640x480.

Part 1.The background image is 383x480 (if I remember right) and aligned at (0,0). The first ball image, shown at (mx,448) mx being the mouse X position.  Then, using the mouse, you select the x position of the ball.

Part 2. Now that the ball X position is set, the image of the lane (background) goes to a point with the pins at the end. I want a line at (ballx + 32(because the ball is 64px across),448)-(mx,300) mx is the mouse again.  When running it, the line seems to be too long at the ends, and I want the line to shorten when moving to the edges.

Drawing a circle at (ballx + 32,480),150 (I think) will give a pretty good curve, but I don't know how to make the line length follow that curve.

This would be way easier if I had the actual thing, but I'm not by it and I didn't put it on my jumpdrive.


Title: 32Bowling For John
Post by: j2krei08 on March 28, 2006, 01:31:22 PM
Here are the files.

http://radiumv.phatcode.net/trig.zip

See what I mean?


Title: 32Bowling For John
Post by: RADIUM-V Interactive on May 09, 2006, 04:46:04 PM
Well, i have a demonstration out now. It's pretty sweet, I think. It obviously doesn't really function or knock down the pins yet (or turn for that matter). There's 2 frames available per run. I have sound function capability, but no sounds yet, except for Microsoft Sam saying "RADIUM-V Interactive" for the open - oh, wait, I disabled it - oops.  But the file's there.

In no way is this done. Remember that. There are some things I still need to make and some things I need to fix.  This is just a demonstration to prove I'm still working on this.

Anyway, here it is  :^_^:

 :lookright: Download Bowling (http://radiumv.phatcode.net/downloads/bowling.exe) :lookleft:

Oh, and I'm re-doing my site. Check it out, if you dare...
http://radiumv.phatcode.net


Title: 32Bowling For John
Post by: Mr Match on May 09, 2006, 08:14:02 PM
Sweet new site!  :)
(sadly made with dreamweaver though...) :wink:

I've gotten rid of mine for now, it needs a new look like yours does. 8)


Title: 32Bowling For John
Post by: RADIUM-V Interactive on May 11, 2006, 12:30:15 PM
I did a few updates, but I haven't released them yet. The pins now kinda fall down (they mostly disappear), but they do go away.

I have decided to release the newer source code. There's no reason to horde it for myself :^_^: but it will be a while before it's ready