Blazer scrolling grid project
-
- Posts: 167
- Joined: Wed Oct 22, 2014 3:26 pm
- My devices: iPhone 4 to 6+,iPad mini to iPad air 2
Blazer scrolling grid project
Hi! I'm working on a filled version of my 3d scrolling grid I posted earlier.
If anyone wants to jump in it would help! I don't want a split screen just one lower 3d scrolling map.
Ballblazers:
http://www.youtube.com/watch?v=MRRVJCuhREw&sns=em
Peace!
If anyone wants to jump in it would help! I don't want a split screen just one lower 3d scrolling map.
Ballblazers:
http://www.youtube.com/watch?v=MRRVJCuhREw&sns=em
Peace!
- Attachments
-
- What I have...
- IMG_0540.PNG (474.24 KiB) Viewed 5058 times
-
- I'm trying to make...
- IMG_0539.PNG (301.95 KiB) Viewed 5058 times
- rbytes
- Posts: 1338
- Joined: Sun May 31, 2015 12:11 am
- My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet - Location: Calgary, Canada
- Flag:
- Contact:
Re: Blazer scrolling grid project
I did a few experiments, but so far haven't been able to simulate the filled grid. What I think would work best is the DRAW QUAD command, because I can see that each individual grid shape is a quad. The trick is to apply the math you are using now to draw the lines, and apply it to define the corners of the quads. I know that your math skills are better than mine, so it would probably be best if you work that out.
Since very quad has to change shape with every scrolling movement, there is a lot of graphics processing to be done. I wonder if the screen can be redrawn fast enough for smooth scrolling.
I guess we will find out.
Since very quad has to change shape with every scrolling movement, there is a lot of graphics processing to be done. I wonder if the screen can be redrawn fast enough for smooth scrolling.
I guess we will find out.
The only thing that gets me down is gravity...
-
- Posts: 167
- Joined: Wed Oct 22, 2014 3:26 pm
- My devices: iPhone 4 to 6+,iPad mini to iPad air 2
Re: Blazer scrolling grid project
Hi!
I used the quad command with an offset and locations value and draw the grid before displaying it. I can't get the speed up to make it look smooth. I'm still playing with it off and on.
I used the quad command with an offset and locations value and draw the grid before displaying it. I can't get the speed up to make it look smooth. I'm still playing with it off and on.

- rbytes
- Posts: 1338
- Joined: Sun May 31, 2015 12:11 am
- My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet - Location: Calgary, Canada
- Flag:
- Contact:
Re: Blazer scrolling grid project
Some of the Forum members have some good ideas about speeding up execution. Why don't you post what you have so far and see if we can offer anything?
The only thing that gets me down is gravity...
-
- Posts: 167
- Joined: Wed Oct 22, 2014 3:26 pm
- My devices: iPhone 4 to 6+,iPad mini to iPad air 2
Re: Blazer scrolling grid project
This is one of many ideas...
Code: Select all
GRAPHICS
GRAPHICS MODE NORMAL
sw=SCREEN_WIDTH()
sh=SCREEN_HEIGHT()
DIM trix(4),triy(4)
speed = 10 'pos forward 10, neg backward -10
deltaspeed = 1 ' rate of inc...
stepp = 92 '166 ' block size
ste = stepp/2
scrollmin=80
scrollmax=80
LOOP:
speed=speed+deltaspeed
IF speed > scrollmin OR speed < -scrollmax THEN
deltaspeed = -deltaspeed
END IF
'Draw Background
REFRESH OFF
'clear screen
GRAPHICS CLEAR 0,0,0
z=z+speed
IF z>=0 THEN
z=z-speed
END IF
FOR h=z TO sh STEP stepp
FOR w=0 TO sw STEP stepp
FILL COLOR 15/255,255/255,60+(h/3)/255
FILL RECT w,h TO w+ste,h+ste
'FILL COLOR 0+(h/3)/255,10+(h/3)/255,0+(h/3)/255
FILL RECT w+ste,h+ste TO w+stepp,h+stepp
NEXT w
NEXT h
REFRESH ON
GOTO LOOP
-
- Posts: 167
- Joined: Wed Oct 22, 2014 3:26 pm
- My devices: iPhone 4 to 6+,iPad mini to iPad air 2
Re: Blazer scrolling grid project
Code: Select all
REM 3D LANDSCAPE GRID IDEA
'
p=0
scx=0
lxo=sw/2 '340
lyo=1000
poll=18
DIM logx(poll*4+1)
DIM logy(poll*3+1)
FOR a=1 TO poll*3
READ logx(a),logy(a)
logx(a)=logx(a)*4
logy(a)=logy(a)*6
NEXT a
GRAPHICS
sw=SCREEN_WIDTH()
sh=SCREEN_HEIGHT()
'CREATE THE LANSCAPE GRID
point=123 '81 '****changed
DIM x(point+1)
DIM y(point+1)
DIM z(point+1)
DIM xt(point+1)
DIM yt(point+1)
xc=-20
yc=1
zc=2
FOR a=1 TO point
x(a)=xc
y(a)=sh*2 '+RND(123) ' hills pre calaculated -650
z(a)=zc
xc=xc+5
IF xc>20 THEN xc=-20 ! zc=zc+1
NEXT a
'TRANSFORM X PERSPECTIVES
FOR a=1 TO point
x(a)=x(a)*sw '120 changed width
NEXT a
mx=zc
LOOP:
REFRESH OFF
FILL COLOR 20/255,0,0
GRAPHICS CLEAR 0,0,0
FILL RECT 0,sh-100 TO sw,sh
GOSUB LANDSCAPE
xsn=40*SIN(m)
m=m+.1
DRAW COLOR 250/255,250/255,250/255
DRAW TEXT MID$(s$,p,67) AT scx+xsn,sh-20
scx=scx-2
IF scx<-10 THEN
p=p+1
IF p>LEN(s$)-1 THEN p=0
scx=scx+10
END IF
a=1
zz=2+1*SIN(m)
FILL COLOR 45/255,45/255,65/255
FOR b=1 TO 18
'FILL TRI zz*logx(a)+lxo,logy(a)+lyo , zz*logx(a+1)+lxo,logy(a+1)+lyo , zz*logx(a+2)+lxo,logy(a+2)+lyo
a=a+3
NEXT b
REFRESH ON
GOTO LOOP
LANDSCAPE:
FOR a=1 TO point 'TRANSFORM POINTS LOOP
q=z(a)+zo ' SET CONSTANT DIVISION VARIABLE
xt(a)=(x(a)/q)+sw/2 ' TRANSFORM AND OFFSET X
yt(a)=(y(a)/q)+sh/2 ' TRANSFORM Y
NEXT a ' END TRANSFORM LOOP
zo=zo-.2 ' SCROLL INTO SCREEN
''HAS ONE LINE COMPLETELY SCROLLED IN?
IF zo<-2 THEN '2
zo=.2 ' RESET Z OFFSET
FOR b=1 TO 72 ' SHIFT ALL ROWS FORWARD BY ONE LINE
y(b)=y(b+9)
NEXT b
FOR a=73 TO 123 '81 ' GENERATE NEW WAVE FOR BACK ROW
y(a)=650+l*SIN(mm+a)
NEXT a
l=140*SIN(mm*2) ' SET SINE SIZE 340
mm=mm+4 ' SHIFTING VALUE FOR SINE
END IF
'DRAW HILLS
xw=71 ' START POINT
FOR a=1 TO 64
c=(z(a)*10)-20 ' COLOR ACCORDING TO DEPTH
FILL COLOR 0,0,c/255 ' DRAW THE BLUE ONE FIRST
FILL TRI xt(xw),yt(xw) , xt(xw+1),yt(xw+1) , xt(xw+9),yt(xw+9)
FILL COLOR c/255,0,0 ' NOW DO THE RED ONE
FILL TRI xt(xw+1),yt(xw+1) , xt(xw+10),yt(xw+10) , xt(xw+9),yt(xw+9)
xw=xw-1 ' JUMP TO NEXT POLYGON PAIR 1
IF xw%9=0 THEN xw=xw-1 ' ARE WE AT EDGE? IF YES, JUMP
NEXT a
FILL COLOR 1,55/255,55/255
RETURN
DATA -39,-9,-25,-15,-24,-8
DATA -31,-15,-35,15,-28,15
DATA -38,0,-27,-4,-26,5
DATA -25,15,-20,-15,-21,18
DATA -21,-15,-15,15,-18,15
DATA -25,3,-18,-4,-16,4
DATA -15,14,-13,-14,-13,17
DATA -16,-14,-9,15,-5,18
DATA -11,-7,-8,-10,-6,19
DATA -3,-12,-5,15,-3,18
DATA -6,-13,5,15,2,16
DATA -6,3,-5,-2,4,4
DATA -2,-10,0,-6,15,-12
DATA 6,17,10,15,3,-13
DATA 12,15,20,15,15,-4
DATA 15,-4,17,-7,10,-8
DATA 15,-11,35,15,27,13
DATA 35,-15,29,-13,21,19
'19
-
- Posts: 167
- Joined: Wed Oct 22, 2014 3:26 pm
- My devices: iPhone 4 to 6+,iPad mini to iPad air 2
Re: Blazer scrolling grid project
Code: Select all
REM Poly Grid test without spread
init:
sw=SCREEN_WIDTH()
sh=SCREEN_HEIGHT()
ox=sw/3 ' x location of keys
oy=sh/2 ' y locstion of keys
offt=30
offb=20
GRAPHICS
'GOSUB drawpad ' control panel
DIM X1(40),Y1(24),X2(80),Y2(24),X3(80),Y3(24),X4(80),Y4(24)
xx=50
yy=10
LOOP:
'GOSUB controls
i=0
x1(i)=sw/2-offt 'top left
y1(i)=sh/2-offt
x2(i)=sw/2+offt 'top right
y2(i)=sh/2-offt
x4(i)=sw/2-offb 'botom right
y4(i)=sh/2+offb
x3(i)=sw/2+offb 'bottom left
y3(i)=sh/2+offb
i=1
x1(i)=sw/2-offb 'top left
y1(i)=sh/2-offb
x2(i)=sw/2+offb 'top right
y2(i)=sh/2-offb
x4(i)=sw/2-offt 'botom right
y4(i)=sh/2+offt
x3(i)=sw/2+offt 'bottom left
y3(i)=sh/2+offt
REFRESH OFF
i=0
FOR xx = -sw TO sw STEP 100
FOR yy = -sh TO sh STEP 50
IF i = 0 THEN
i=1
FILL COLOR 1,0,0
FILL QUAD X1(i)+xx+50,Y1(i)-yy-45,X2(i)+xx+50,Y2(i)-yy-45,X3(i)+xx+50,Y3(i)-yy-45,X4(i)+xx+50,Y4(i)-yy-45
ELSE
i=0
FILL COLOR 1,1,1
FILL QUAD X1(i)+xx,Y1(i)+yy,X2(i)+xx,Y2(i)+yy,X3(i)+xx,Y3(i)+yy,X4(i)+xx,Y4(i)+yy
END IF
NEXT yy
NEXT xx
REFRESH ON
'GOTO LOOP
END
Re: Blazer scrolling grid project
I found this, hope it helps

Code: Select all
REM 3D Checkerboard:
REM ported out of Source: https://www.khanacademy.org/computer-programming/3d-checkerboard/972365924
REM sB 5.6 / iOS 6.1 / iPhone 4
REM by Operator
GRAPHICS
GRAPHICS CLEAR 1,0,0
scr_w = SCREEN_WIDTH()
scr_h = SCREEN_HEIGHT()
scr_w2 = scr_w/2
scr_h2 = scr_h/2
walkSpeed = 10
perspect = 250
horizon = 180
tileWidth = 100
meX = 400
meY = 40
FIELD "info" TEXT "" AT 0,0 SIZE 320,20 RO
FIELD "info" FONT COLOR 1,1,1
FIELD "info" BACK ALPHA 0
REFRESH OFF
TIME RESET
LOOP:
GRAPHICS CLEAR 1,0,0
loop_count += 1
'drawGrid
FOR x = 0 TO 700 STEP tileWidth
FOR y = 0 TO 700 STEP tileWidth
IF y - meY > -tileWidth - 100 THEN
IF ((x/tileWidth + y/tileWidth)%2) THEN
FILL COLOR 0,0,0
ELSE
FILL COLOR 1,1,1
END IF
p1 = perspect/(perspect + y - meY)
x1 = scr_w2 + p1*(x - meX)
y1 = horizon + p1*scr_h2
p2 = perspect/(perspect + y - meY + tileWidth)
x2 = scr_w2 + p2*(x - meX)
y2 = horizon + p2*scr_h2
FILL QUAD x1,y1, x1+tileWidth*p1,y1, x2+tileWidth*p2, y2, x2,y2
END IF
NEXT y
NEXT x
GET TOUCH 0 AS tx,ty
IF tx > 0 THEN
IF tx > scr_w2 THEN meX += walkSpeed
IF tx < scr_w2 THEN meX -= walkSpeed
IF ty > scr_h2 THEN meY -= walkSpeed
IF ty < scr_h2 THEN meY += walkSpeed
END IF
fps = INT(loop_count/TIME())
FIELD "info" TEXT " Touch screen to navegate "&"FPS: "&fps
REFRESH
GOTO LOOP
- Attachments
-
- image.jpg (66.92 KiB) Viewed 4974 times
-
- Posts: 167
- Joined: Wed Oct 22, 2014 3:26 pm
- My devices: iPhone 4 to 6+,iPad mini to iPad air 2
Re: Blazer scrolling grid project
Very nice and tidy!!!! Good job! Thanks!!
- rbytes
- Posts: 1338
- Joined: Sun May 31, 2015 12:11 am
- My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet - Location: Calgary, Canada
- Flag:
- Contact:
Re: Blazer scrolling grid project
Thanks, Operator. It looks good. I will check it out. Currently I have Dr Chip's code modified to produce what you see in the image. These are quads that are at least angled correctly, but each quad stretches the full height of the grid. The horizontal black lines are just drawn lines, not dividers between quads. Now I need to use the horizontal line calculations to subdivide the quads into vertical stacks of quads, and checkerboard the colors. I will likely end up with something quite similar to the code in the checkerboard sample you posted.
That will be a lot of quads to draw per second, and the animation may slow down too much. But it seems from Dr Chip's original sample photo that the quads could be a lot larger, and that will speed the animation up again.
That will be a lot of quads to draw per second, and the animation may slow down too much. But it seems from Dr Chip's original sample photo that the quads could be a lot larger, and that will speed the animation up again.
- Attachments
-
- IMG_5288.PNG (254.43 KiB) Viewed 4965 times
The only thing that gets me down is gravity...