Tricky
Posted: Fri Apr 03, 2015 5:15 am
Code: Select all
rem Tricky v3
rem iPhone 6 Plus / iOS 8.3 b4
rem This is from my son Digit. He's 12...
rem adjust bs to device. 64 - iphone, 128 ipad
rem v3 fixed scoller and block size
rem Enjoy...
' Some basic stuff..
graphics
sw=screen_width()
sh=screen_height()
dim block(10, 8)
bs=64 ' size of the block larger for ipad
message$ = " Hey, where's my coke? Thanks. Oh, welcome to Tricky, my fun little demo! I (Digit) have done this, in case you didn't know it already.. I hope you like it! Bye! "
length = len(message$)
' Somekind of intro..
do
refresh off
graphics clear 31/255,31/255,31/255
for what = 0 to 31
draw color 0, (what * 8)/255, 0
draw text "Digit presents" at sw/4, (what + 20)
next what
draw color 1,1,1
draw text "Digit presents" at sw/4, 20+31
draw color 1, 0, 1
draw text "..Tricky.." at sw/3, 51+22
draw color 0, 1, 0
draw text "Touch to Start" at 0, sh-20
refresh on
until touch_x(0) <> -1
do
refresh off
graphics clear
' Graphics!
for what = 0 to 31
x_slower = x_slower - 1
if x_slower < 0 then
if the_x = -1536 then the_x_direction = 1
if the_x = 1536 then the_x_direction = 0
if the_x_direction = 0 then the_x = the_x - 1
if the_x_direction = 1 then the_x = the_x + 1
if the_x = 0 then
x_slower = 3072
endif
end if
mm = mm + 2
x = the_x + sw * sin(mm) + sw/2
y = sh * cos(mm) + sh/2
if the_x = 0 then
'graphics clear 0, 0, 64/256
draw color 0, 0, 1
else
'graphics clear 63/255, 0, 0
draw color 1, 0, 0
end if
draw line sw/2, sh/2 to x, y
next what
block_slower = block_slower - 1
for y = 0 to 7
for x = 0 to 9
if block_slower < 0 then
block(x, y) = int(rnd(2))
end if
if block(x, y) = 1 then
if the_x = 0 then
fill color 0, 0, 1
else
fill color 1, 0, 0
endif
fill rect x * bs, y * bs to x * bs + bs, y * bs + bs
end if
next x
next y
if block_slower < 0 then
block_slower = 16
end if
text_x = text_x + 0.2
if text_x > length - 32 then
text_x = 0
endif
text_to_show$ = mid$(message$, text_x, sw)
draw color 1,1,1
draw text text_to_show$ at 0, 32
draw color 0, 0, 0
draw text "T R I C K Y" at 0, 0
draw color 127/255, 127/255, 127/255
draw text "T R I C K Y" at 2, 0
lsec$ = sec$
sec$ = right$(time$, 1)
if lsec$ <> sec$ then
rate$ = str$(rate)
end if
if lsec$ <> sec$ then
rate = 0
end if
rate = rate + 1
draw color 1,1,1
draw text "Frame(s) per second: " & rate$ at 0,sh-20
refresh on
until quit = 1
end
' And that's the end of that demo :)