Created
August 10, 2019 17:01
-
-
Save jamesmichiemo/e1a710ccb1aea16176d65363b29cee85 to your computer and use it in GitHub Desktop.
processing + propane sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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