Landscape v.1

Post Reply
DrChip
Posts: 167
Joined: Wed Oct 22, 2014 3:26 pm
My devices: iPhone 4 to 6+,iPad mini to iPad air 2

Landscape v.1

Post by DrChip »

REM Landscape v.1 (buggy)
REM iPhone 6 plus / 8.2 b4


Init:
pi=3.1415
sw = Screen_Width()
sh = Screen_Height()
DIM trix(4),triy(4)

'SET UP SCROLL
s$=" "
s$=s$&"HAVE NO FEAR, DRCHIP IS BACK WITH HIS FIRST "
s$=s$&"RELEASE OF 2015.. IF YOU KNOW ME THEN YOU'LL KNOW "
s$=s$&"WHY THIS IS THE ONLY ONE SO FAR... I'LL TELL YOU "
s$=s$&"THIS LITTLE ROUTINE IS REALLY OPTIMISED AND IT'S "
s$=s$&"ALL IN REAL TIME!!! ONLY DRCHIP MAKES IT "
s$=s$&"POSSIBLE!!! HELLO TO ALL MY FRIENDS... BYE!!"

p=0
scx=0

'OPEN GRAPHICS SCREEN
graphics

'CREATE THE LANSCAPE GRID
point=81
dim x(point+1)
dim y(point+1)
dim z(point+1)
dim xt(point+1)
dim yt(point+1)
xc=-20
yc=0
zc=2
for a=1 to point
x(a)=xc
y(a)=sh+rnd(123)
z(a)=zc
xc=xc+5
if xc>20 then
xc=-20
zc=zc+1
end if
next a


'TRANSFORM X PERSPECTIVES
for a=1 to point
x(a)=x(a)*120
next a
mx=zc

'START MAIN LOOP
do
refresh off
graphics clear .20,0,0
gosub landscape
xsn=40*sin(m)
m=m+.1
draw color 1,1,1
draw text mid$(s$,p,67) at scx+xsn,sh-18
scx=scx-2
if scx<-10 then
p=p+1
if p>len(s$) then p=0
scx=scx+10
end if
a=1
zz=2+1*sin(m)
refresh on
until 0=1 'END MAIN LOOP

'3D LANDSCAPE:
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) 'TRANSFORM Y
next a 'END TRANSFORM LOOP
zo=zo-.1 'SCROLL INTO SCREEN

'HAS ONE LINE COMPLETELY SCROLLED IN?

if zo<-2 then
zo=-1 'RESET Z OFFSET
for b=1 to 72
rem SHIFT ALL ROWS FORWARD BY ONE LINE
y(b)=y(b+9)
next b

for a=73 to 81 'GENERATE NEW WAVE FOR BACK ROW
y(a)=650+l*sin(mm+a)
next a
l=340*sin(mm*2) 'SET SINE SIZE
mm=mm+.14 'SHIFTING VALUE FOR SINE
end if

'DRAW HILLS
xw=71
rem START POINT
for a=1 to 64
c=(z(a)*10)-20 'COLOR ACCORDING TO DEPTH
fill color 0,0,.c 'DRAW THE BLUE ONE FIRST
'fill triangle xt(xw),yt(xw) to xt(xw+1),yt(xw+1) to xt(xw+9),yt(xw+9)
trix(0)=xt(xw)
triy(0)=yt(xw)
trix(1)=xt(xw+1)
triy(1)=yt(xw+1)
trix(2)=xt(xw+9)
triy(2)=yt(xw+9)
fill poly trix,triy count 3

fill color .c,0,0 'NOW DO THE RED ONE
'fill triangle xt(xw+1),yt(xw+1) to xt(xw+10),yt(xw+10) to xt(xw+9),yt(xw+9)
trix(0)=xt(xw+1)
triy(0)=yt(xw+1)
trix(1)=xt(xw+10)
triy(1)=yt(xw+10)
trix(2)=xt(xw+9)
triy(2)=yt(xw+9)
fill poly trix,triy count 3
xw=xw-1 'JUMP TO NEXT POLYGON PAIR
'if mod(xw,9)=0 then xw=xw-1
if xw/9=0 then xw=xw-1 'ARE WE AT EDGE? IF YES, JUMP
next a
draw color 1,.55,.55
return
Attachments
image.jpg
image.jpg (168.49 KiB) Viewed 1824 times

Henko
Posts: 814
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Landscape v.1

Post by Henko »

s$=s$&"HAVE NO FEAR, DRCHIP IS BACK WITH HIS FIRST "
s$=s$&"RELEASE OF 2015.. IF YOU KNOW ME THEN YOU'LL KNOW "
s$=s$&"WHY THIS IS THE ONLY ONE SO FAR... I'LL TELL YOU "
s$=s$&"THIS LITTLE ROUTINE IS REALLY OPTIMISED AND IT'S "
s$=s$&"ALL IN REAL TIME!!! ONLY DRCHIP MAKES IT "
s$=s$&"POSSIBLE!!! HELLO TO ALL MY FRIENDS... BYE!!"
Dr.Chip, are you all right?

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Landscape v.1

Post by Mr. Kibernetik »

s$=s$&
is equivalent to
s$&=

similarly

zo=zo-.1
is equivalent to
zo-=.1

DrChip
Posts: 167
Joined: Wed Oct 22, 2014 3:26 pm
My devices: iPhone 4 to 6+,iPad mini to iPad air 2

Re: Landscape v.1

Post by DrChip »

Hi Henko, my son put the text in.

Thanks for the programming tip Mr. K!

Post Reply