Skip to content

Instantly share code, notes, and snippets.

@jamesmichiemo
Created August 10, 2019 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmichiemo/e1a710ccb1aea16176d65363b29cee85 to your computer and use it in GitHub Desktop.
Save jamesmichiemo/e1a710ccb1aea16176d65363b29cee85 to your computer and use it in GitHub Desktop.
processing + propane sketch
#!/usr/bin/env jruby
# frozen_string_literal: false
require 'propane'
# move with arrow keys
# propane graffiti by 8mana
# based on code by Casey Reas and Ben Fry
class ArrowKeys < Propane::App
def settings
size 480, 120
end
def setup
sketch_title 'move with arrow keys'
$x = 215
end
def draw
if key_pressed? && key == CODED
if key_code == LEFT
$x -= 1
elsif key_code == RIGHT
$x += 1
end
end
rect $x, 45, 50, 50
end
end
ArrowKeys.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment