VOLUME 16.01
18 postprehistor apps to co ic de
How to Bitsbox With Bitsbox, you can code real apps that work on gadgets like phones and tablets. All you need is a computer with internet and a working brain.
1
Find a computer with a physical keyboard.
The coding part of Bitsbox isn’t meant to be done on tablets just yet.
2
Open a web browser and go to bitsbox.com
3
Click Get Started.
We recommend Chrome, Firefox, Safari, or Internet Explorer 11.
Have fun!
The best thing about din osaurs is that no one's ever seen one. W e think we know what they looked like, we 've made educated guesses about what they sounded like, and it's safe to say that they smelled awful. (Have you had pet turtl es?)
1
On a computer, open the Bitsbox app you built.
All of this mystery create s a lot of space for creativity. Want your tin y, purple triceratops to sound like an excited goat? Go for it. It'll take a team of paleo ntologists and a time machine to prove you wrong.
2
Click the sharing icon
May long you roam the ea
How can I run my apps on a real phone? Before you do these steps, install a QR reader app on your gadget. Go here for a couple of suggestions: bitsbox.com/QRapps
in the corner of the screen.
3 Scan the on-screen QR code with your gadget. s like It look
this!
rth,
Aidan, Scott, Anastasia, Jeff, Emma, & Alexandra
When you change the code on your computer, the app on your gadget changes, too!
2
ATTENTION GROWNUPS! Check out the Bitsbox Grownup Guide at bitsbox.com/grownups
mini apps to get you started 8 8 1 0
Hellosaurus
1 fill('powder blue') 2 stamp('dinosaur',800) Can you change the background color to 'plum'?
4 9 5 3
4 4 3 8
Scary T. Rex
1 fill('scary trex') 2 sound('roar') Please make the T. Rex sound like a harmless kitty cat. Hint: 'cat'
PLAY WITH ME!
1 fill('dino sign') 2 text('PLAY WITH ME!') What else should his sign say?
CREATIVE CODING CHALLENGE CREATE A NEW APP WITH THIS NUMBER:
8 5 5 4 7 3 3 7
Run, Run Away
DINO YOGA
Create an app where a dinosaur moves across a yoga studio? Write "DINO YOGA" on the wall and play a funny sound when you run the app.
1 a = stamp('dinosaur5',100,750) 2 b = stamp('alien bee',300,750) 3 a.move(RIGHT,450,3000) 4 b.move(RIGHT,350,1000)
'ox' 'chicken' 'yoga studio'
'dino 11'
'dino 9'
'ogre'
Create a new app number 2502 to get help!
Need a helping hand?
Experiment with the numbers on lines 3 and 4. What happens when you change 3000 to 7000? Does the dinosaur move faster or slower?
SOUNDS:
3
' n i b boobbbine'ads b h e B l o b b o leheads B
x
425
2 5 2 9
bob Tap to
ead!
bleh the bob
y
450
HINT
While y o move y u're coding, our cur the tab sor ove le r The x a t on your scre en. nd y nu mbe appear tell you rs that what numbe rs to ty pe!
1 fill('volcano') 2 body = stamp('dino body',350,800) 3 head = stamp('dino head', , ) 4 head.tap = dance Replace the blank spaces on line 3 with numbers to place the dinosaur's head where it belongs.
PSSSSSSSsSST! Try these stamps to make more bobbleheads:
4
'mammoth body' 'mammoth head'
'puppy body' 'puppy head'
8 6 6 6
DRAW CRAZY TUSKS!
WOOLY MAMMOTH 1 fill('field2') 2 stamp('mammoth2',800) 3 size = 100 4 5 function drag() { 6 stamp('ivory',x,y,size) 7 stamp('ivory',768-x,y,size) 8 size = size - 1 9 }
SIZE IS A VARIABLE Lines 6, 7, and 8 all need to know the starting size of the mammoth's tusks, so we create a variable called size and refer to it on all three lines.
BRUSHING HIS TEETH TAKES
ALL DAY
Click th e sha on you ring icon r sc to dow reen n screens load hots of your ap p! 5
E G AAME
THE
0 6 2 1
G
t') Swif r o l y ) ,'Ta 989' me?' ar?','1 ') a N ' ( e mber ompt th Y = pr pt('Bir ?','Dece n om th 1 = pr pt('Mon ,'13') y) y m ,' + 2 y?' ' pro a D + = ' ( m + d ompt 3 ' ' = pr + d m 4 ate( ew D n = 5 nt e() mome new Dat nt 6 = mome 24 now 0) w o 60 / 7 n / 0,70 = 0 0 1 s 6 , m ' ld! 8 00 / / 10 d(days) ' days o s m 9 n = .rou ys + days Math + da 1 0 = ' days ' is 1 1 n + ( t x te 1 2
ING
AYS ct to D E TH obje ed
te ss t Da e pa ath to scrip nds hav a v a e th m ys. co eJ illise does es th s m f da 0 u 1 y ine ber o app man L s m . i w u e h o n T h a tim show into ulate ment in you ? nds calc o n o a c m e C tead s a lli GE! s ins N r since t the mi u E o L h L er CHA mber of conv u n e th
NT COU
6
Q. What
time is it?
A. Time to get a new watch!
Use this app to ask your parents how ancient they are...
s. an h m u it e h lly w v I lo ecia up. h p Es ketc
2 9 9 6
Love Card Make a custom card for someone you love!
...then this one to apologize!
1 fill('pink') 2 stamp('dino2') 3 text('I LOVE YOU!',100,200,100,'red') 4 text('-from dino',250,880,50,'red')
SAY WHAT YOU WANNA SAY The text command lets you put words anywhere on the screen. Experiment with the numbers and colors to figure out what they do.
7
2 0 4 5
t s e l o o C s ' d l r The Wo OOK APP B G IN R O L R OWN CO NKS! BUILD YOU EE BITE-SIZED CHU IN THR
step 1
COLOR!
art = stamp('coloring3') 1 2 nib = 20 3 hue = 'neon carrot' 4 dot = circle(384,70,nib,hue) 5 6 function drag() { 7 circle(x,y,nib,hue) 8 art.front() 9 } This code gives you one crayon! These 9 lines of code stamp a black-andwhite drawing, set your color to 'neon carrot', and let you to draw on the screen.
YOU CAN COLOR THESE INSTEAD! 8
coloring12
coloring15
coloring8
coloring9
coloring16
coloring14
coloring17
k o o B g n i r o l o C step 2 CRAYONS! 10 11 fill('crayons') 12 13 function update() { 14 dot.hide() 15 dot = circle(384,70,nib,hue) 16 } 17 18 function tap() { 19 if (y > 140) { 20 rgb = look(x,y) 21 hue = color(rgb) 22 update() 23 } 24 }
This code provides more colors! These 15 lines of code add colorful crayons to the bottom of your screen. Tapping one sets the color of your paint.
step 3 PRECISION! This code lets you change your crayon size! Add these 12 lines of code to give yourself a way to grow or shrink your crayon. Get precise!
25 26 function resize() { 27 if (x > 384) { 28 nib = nib - 2 29 } else { 30 nib = nib + 2 31 } 32 update() 33 } 34 35 stamp('resizer',384,70).tap = resize 36 update()
Clic on k the s y dow our sc haring of y nload reen t icon o our s app creens ! hot s
9
FIND
DIFFERENCES
prehistoric p ALBERTOSAURUS ALLOSAURUS ANKYLOSAURUS ARCHAEOPTERYX BRACHIOSAURUS COELOPHYSIS
B R A C H I
I
C X S U R
A N K Y L O
CRYOLOPHOSAURUS
S P T E R A
EUDIMORPHODON
T P Y O U E
PTERANODON SPINOSAURUS STEGOSAURUS TRICERATOPS TYRANNOSAURUS VELOCIRAPTOR
E B
I
E A F
G S T N
I
C
O O N T O O S U R U A S A S T S O S U Y B U A Y R V E U L O U A R R D T S U C O E L S G N S P O
10
c puzzler H
I
enter
O S A U R U S N C
U R U A S O L
L A R V
L O S A U R U S Y S E R A N O D O N O E U L U E C O U L
L D D R O
A F T A N O T I
I
A U C
C P P P A M L E A
O O L H O O O G
I
I
S R
A S O T R E B L A O A O S A P M E A D A N P A Y H U A S H H O N T L O A N R D S T C A O I
G U G
I
N R R
E L O P H Y S
I
S Y A
P O T A R E C
I
R T
The unused letters spell out a hidden message! What is it?
!
G
O
Y Z
!
D T D
MA
A R ZE C
11
3 8 7 6
FEEDINGTIME! TIME! HELP T. REX CATCH AS MANY CUPCAKES AS HE CAN!
US TACEO S E R C EVEN REDATOR -P UBER UPCAKES C LOVE
IT'S A HIT! Line 15 uses Bitsbox's built-in .hits() command to figure out if the T. Rex catches the cupcake. If the object called rex overlaps the object called food, the app runs the code on lines 16 through 20.
1 fill('sunset jungle') 2 rex = stamp('trex',700,200) 3 food = stamp('cupcake3',0,random(1024)) 4 count = 0 5 a = text(count,350,100,100) 6 speed = 10 7 8 function drag() { 9 rex.move(rex.x,y,200) 10 } 11 12 function loop() { 13 food.move(EAST,speed).rotate(RIGHT,20) 14 speed = speed + .2 15 if (rex.hits(food)) { 16 food.pop() 17 sound('chomp') 18 count = count + 1 19 a.change(count) 20 food = stamp('cupcake3',0,random(1024)) 21 } 22 }
Make this game a little easier by slowing down the cupcakes. 12
Hint: Line 6
6 9 2 4
FOSSIL HUNTER TAP TO SWEEP AWAY THE SAND. WHAT WONDERS WILL YOU UNCOVER? 1 fill('fossil'+random(8)) 2 3 function dig() { 4 this.size(0,1000) 5 } 6 7 function bury() { 8 s = stamp('sand2').move() 9 s.tap = dig 1 0 } 1 1 repeat(bury,250) 1 2 1 3 b = stamp('brush4',300) 1 4 function tap() { 1 5 b.move(x,y).dance() 1 6 }
REPEAT IS NEAT. This app buries its fossils by stamping the graphic 'sand2' all over the screen. Here's how it works: The bury() function stamps 'sand2' in a random spot. Line 11 uses Bitsbox's repeat() command to run the bury() function 250 times.
C th an at yo to pla u a y d Hi bru s e d a v nt s : s h a ery sou ou wa tim nd nd y t e e (' he yo ffe ma sa u ct ra nd tap ? c
a' )
13
. . . y a l p o t it's time
7 1 4 1
THINK YOU'RE A DINO EXPERT? THIS GAME SHOW IS FOR YOU!
14
Not really into dinosaurs? Use dogs instead!
'bulldog'
1 fill('stage') 2 dinos = ['Albertosaurus', 'Allosaurus', 3 'Ankylosaurus','Brachiosaurus'] 4 5 pic = stamp('question2',500) 6 label = 'Tap to play!' 7 answer = text(label,200,950,75,'impact') 8 9 function tap() { 10 if (label == 'What is it?') { 11 label = dino 12 dinos.push('Game Over') 13 } else { 14 dino = dinos.shift() 15 pic.change(dino) 16 label = 'What is it?' 17 } 18 answer.change(label) 19 }
'chihuahua'
'chocolate lab'
'cocker spaniel'
'dalmation'
'daschund'
'husky'
'sharpei'
CHALLENGE! Can you add these dinos to make the game harder? 'Archaeopteryx', 'Coelophysis', 'Cryolophosaurus', 'Diplodocus', 'Dorygnathus', 'Eudimorphodon', 'Maiasaura', 'Spinosaurus', 'Stegosaurus', 'Talarurus', 'Triceratops', 'Velociraptor2'
'shiba inu'
'shih tzu'
S. S O GR
1 trilos = [] 2 3 function spawn() { 4 bug = 'trilo' + random(6) 5 t = stamp(bug).size() 6 t.speed = random(5,15) 7 t.spin = random(0,5) 8 trilos.push(t) 9 } 10 repeat(spawn,12) 11 12 function wiggle(me) { 13 me.move(UP,me.speed) 14 me.wrap() 15 me.rotate(RIGHT,me.spin) 16 if (random(10) == 1) { 17 me.spin = -me.spin 18 } 19 } 20 21 function loop() { 22 trilos.forEach(wiggle) 23 }
7 4 8 7
TES CRE EPY .
FOREVER.
. H C YE
WATCH YOUR PET TRILOBITES SWIM AROUND.
MIGHT Y TRILOB I How would you change the code to make 50 trilobites instead of 12?
LOOP SOUP
ICK
.
Any code you put in a loop() runs 20 times every second. Loops are perfect for making objects move around on your screen forever. Here, the loop() sends each trilobite to the wiggle() function which makes it move—a little bit at a time, over and over and over.
15
8 2 3 8
DEFEND THE PLANET! BLAST THE METEORS BEFORE THEY DESTROY YOU!
1 Spaceship! 1 fill('orbit') pilot',376,512,150) 2 ship = stamp('dino 3 speed = 10
2 BLASTERS!
4 { 5 function touching() if (x < 384) { 6 ship.rotate(LEFT,speed) 7 } else { 8 ship.rotate(RIGHT,speed) 9 } 10 11 }
16
12 13 power = 700 14 recharge = 1 15 decharge = 40 16 marker = stamp('arrow2',power,1090) 17 18 function untouch() { 19 if (power > decharge) { 20 shot = stamp('laser',ship.x,ship.y) 21 shot.rotate(ship.rotation) 22 shot.move(UP,2000,2000) 23 power = power - decharge 24 } 25 }
P TI
Cl
ick
AY PL
to
u yo n ru
ra
p
ee n etw b p
ction ode se c h c ea
!
(J
US
3 METEORS!
Bad things happen when big rocks hit planets. T
AS
U K T YO HE N R E X T D I N O SAU
26 [] 27 meteors = 0 28 points = hite') oints,30,60,'w (p xt te = e or 29 sc fall() {} 30 function 31 loop() { 32 function 0) { if (power < 72 33 + recharge power = power 34 } 35 wer,1090,200) marker.move(po 36 + points) { m(3000) < 100 do an (r if 37 random(6) = 'meteor' + ce oi ch 38 dom(768),0) amp(choice,ran st = m 39 m.rotate() 40 ) meteors.push(m 41 } 42 h(fall) meteors.forEac 43 44 }
A TOUCHING STORY This app uses Bitsbox's touching() function to control the ship. Touching the left half of the screen makes the ship spin left— touching the right rotates it right. Dizzy?
M
T EE
)
4 DANGER! 45 46 function fall(m) { 47 if (m.hits(ship)) { 48 score.change('EXTINCT with '+p oints) 49 ship.pop() 50 untouch = null 51 } else { 52 m.move(DOWN,5) 53 m.wrap() 54 collision = m.hits('laser') 55 if (collision) { 56 m.hide() 57 collision[0].pop() 58 points = points + 1 59 score.change(points) 60 } 61 } 62 } 63 song('spiral')
CODING ONWARD It's your job to add amazing sound effects to this game. Can you do it?
17
7 9 9 2
R E Y A L P 2- PP! A
E L B I R R E PT N O D O N A R E T P 18
ur friend. ents on yo d ro p ro d n screen. Tap to on your ow ts n e d ro e t th Drag to ea you lose! n rodents, te s is m u o If y
Visit bitsbox.com/howtoshare to learn how to play this app with another person.
1 fill('island') 2 a = stamp('pteranodon',300) 3 text('Uneaten Rodents:',150,1000) 4 b = text('',500,1000) 5 6 function tap() { 7 send(x,y) 8 stamp('xpaint',x,y,100).size(0,1000) 9 } 10 11 function get(x,y) { 12 stamp('rodent',x,y,100).rotate(5000,10000) 13 } 14 15 function drag() { 16 a.move(x,y,500) 17 a.aim(x,y) 18 } 19 20 function loop() { 21 food = find('rodent').length 22 b.change(food) 23 find('rodent').forEach(search) 24 if (food > 10) { 25 reset('zam') 26 } 27 } 28 29 function search(food) { 30 if (food.hits(a)) { 31 food.pop() 32 } 33 }
SEND AND GET Bitsbox's send() and get() commands make it possible for two people to play the same app at the same time. Here, tapping sends an x,y position to the other player's device. That device gets the x,y position and stamps a spinning rodent at that spot.
Creative Coding Challenges Try coding these apps yourself!
CREATE A NEW APP WITH THIS NUMBER:
5 8 8 4 CREATE A NEW APP WITH THIS NUMBER:
4 8 2 8
SWEET TREAT CHALLENGE Create an app with a dinosaur and a cupcake sitting in a field.
VOLCANO!
BONUS 1 Make the dinosaur move to wherever you tap on the screen.
CHALLENGE Create an app with a volcanic island sitting in the middle of a deep blue sea.
BONUS 2 If the dinosaur hits the cupcake, she dances and a sound plays.
BONUS 1 Make the island explode when you tap it. Can you add a sound, too? BONUS 2 Add a pteranodon that flies across the sky when you run the app.
SOUNDS: 'claps' 'chomp' 'field2'
'dinosaur5'
'cupcake4'
'fox'
SOUNDS: 'explosion' 'boom' 'ocean waves'
'volcano2'
'pteranodon'
'crowd'
VOLCANO!: 3146 SWEET TREAT: 7579
Need a helping hand? 19
Create new apps with these numbers to get some ideas!
More stuff online! Look for more when you're coding at bitsbox.com!
Use these stamps ( & sounds & fills & songs) to make any app your own! Just don't forget to put single quotes around them in your code, like this:
cupcake4
dino3
dino4
dino5
dino6
dino7
dino8
dino9
dino11
dino bones
dino bot
dino love
dinosaur4
dino15
leaf3
meteor7
meteor9
plant2
plant3
rodent2
trex2
ufo3
ufo4
ufo5
stamp('alpaca') sound('goat') fill('big ben') song('sax')
fills
Sounds clap dino flap grr knock mammoth rip squawk stegosaurus trex
clocks
sea floor
©2 016 Bitsbox. All rights reserved. Designed and printed in the U.S.A.
bitsbox.com
dino hearts
Songs field2
stone wall sunset jungle
orbit
red hearts
rock island
trex skull
volcano
wood box
dynasty finland rockrailroad sleep spanish sporting storm tender unstable waltz