Learn to Code – Blog. by Next Thing https://ntcblogbackup.wpengine.com News & Notes. Process & Projects. No BS. Srsly. Thu, 09 Nov 2017 03:16:07 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.5 PocketC.H.I.P. and PICO-8: A Dream Team at Dreamforce https://ntcblogbackup.wpengine.com/pocketc-h-i-p-and-pico-8-a-dream-team-at-dreamforce/ https://ntcblogbackup.wpengine.com/pocketc-h-i-p-and-pico-8-a-dream-team-at-dreamforce/#comments Fri, 07 Oct 2016 19:03:08 +0000 http://blog.nextthing.co/?p=1083 Middle School students learning to code with PICO-8 and PocketC.H.I.P.

Jessica Koehler from Sparkiverse teaching students to code with PICO-8 on PocketC.H.I.P.

SAN FRANCISCO–170,000 Salesforce customers descended upon the massive 700,000 square foot Moscone Center for Dreamforce, the annual Salesforce conference for developers and power users. Tucked away in a corner of Moscone West, 50 of these attendees were middle school students who participated in the first ever Next Thing Co. learn to code camp.

Jake helping a student with tricky part of the code syntax

Jake helping a student debug his game

At the request of Salesforce.org, the philanthropic and community service division of Salesforce, Ari and Jake organized the coding camp with Jessica Koehler and our friends at Sparkiverse. Given a one hour session, the goal was to teach a middle school class how to program a basic PICO-8 game using PocketC.H.I.P.. For many of the students this was their first time programming.

Programming is better with friends

Koehler assisting two students with PICO-8 programming

Despite limited formal programming experience, the students were able to code the game in the allotted time and have a ton of fun while doing it. Koehler broke down the game mechanics into small parts and explained how to program each. The students then applied her instructions and worked on their own PocketC.H.I.P.s to create personalized version of the game. Some of the students even finished early and spent extra time drawing fancier character sprites.

pico-8_1

The game takes user input from the D-pad to control a character on the screen. You score points by moving the character to collide with the semi-random bouncing yellow ball. This simple game is a great introduction to creating your own games on PICO-8. Read the full source code below and download the handout we used during the event.

And don’t feel the need to stop there. PICO-8 allows you to build in your own code on top of existing games or start from scratch and truly make it your own. For more resources that will help you learn to code, check out our suggested reading, learn how NTC’s very own Richard learned to code using PICO-8, and gain inspiration from the latest PICO-8 game jam, a highlight of some of the best PICO-8 games around.

dudex = 64
dudey = 64
thingx = 15
thingy = 10
thingdx = 1
thingdy = 1
score = 0

function _draw()
 rectfill(0,0,127,127,13)
 spr(001,dudex,dudey)
 spr(002,thingx,thingy)
 print(score,5,5,8)
 if score > 10 then
  print("you are cool!",10,5,8)
 elseif score >4 then
  print("you're pretty good..",10,5,8)
 end
end

function _update()
 movedude()
 bump()
 movething()
 bouncewall()
end

function movedude()
 if btn(0) then
  dudex = dudex -1
 end
 if btn(1) then
  dudex = dudex +1
 end  
 if btn(2) then
  dudey = dudey -1
 end
 if btn(3) then
  dudey = dudey +1
 end
end

function bump()
 if abs(dudex - thingx) <= 3 and
    abs(dudey - thingy) <= 3 then
   thingx = rnd(120)+0
   thingy = rnd(121)+0
   score+=1
 end
end

function movething()
 thingx = thingx + thingdx
 thingy = thingy + thingdy
end

function bouncewall()
 if thingx < -1 then
  thingdx = -thingdx
 end
 if thingx >121 then
  thingdx = -thingdx
 end
 if thingy < -2 then
  thingdy = -thingdy
 end
 if thingy > 120 then
  thingdy = -thingdy
 end
end


chipLogo64x64

Thanks to Sparkiverse for helping us teach the students PICO-8 programming on PocketC.H.I.P. and Salesforce.org for the opportunity to teach them! Happy hacking everyone, and if you know how to code, make sure you take a moment and share your skills with someone else!

]]>
https://ntcblogbackup.wpengine.com/pocketc-h-i-p-and-pico-8-a-dream-team-at-dreamforce/feed/ 1