Skip to content

Instantly share code, notes, and snippets.

@bortels
Created October 29, 2011 22:20
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 bortels/1325166 to your computer and use it in GitHub Desktop.
Save bortels/1325166 to your computer and use it in GitHub Desktop.
messing with custom spritepack in Codify
watch("t")
watch("r")
watch("s")
watch("aa")
-- Use this function to perform your initial setup
function setup()
origin = vec2(1,0)
w2 = WIDTH/2
h2 = HEIGHT/2
v1= vec2(0,-1)
v2= vec2(0,1)
aa= v1:angleBetween(v2)
end
-- This function gets called once every frame
function draw()
background(63, 86, 106, 255)
t = vec2(CurrentTouch.x-w2, CurrentTouch.y-w2)
stroke(255, 0, 21, 255)
strokeWidth(5)
-- line(0,0,CurrentTouch.x,CurrentTouch.y)
r = math.deg(origin:angleBetween(t))-90
translate(w2, h2)
rotate(r)
s=CurrentTouch.state
if (s == BEGAN) then
sound("shoot")
end
if (s ~= ENDED) then
line(0,0,0,1000)
end
sprite("Test:Su-37K_new")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment