Created
March 10, 2012 16:32
-
-
Save AjayMT/2011951 to your computer and use it in GitHub Desktop.
Represents a ball in a pong clone created in lua(see 'Main.lua' & 'Player.lua')
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
Ball = class() | |
function Ball:init() | |
self.pos=vec2(WIDTH/2,HEIGHT/2) | |
self.acc=vec2(0,0) | |
end | |
function Ball:draw() | |
fill(255, 0, 0, 255) | |
self.pos = self.pos + self.acc | |
ellipse(self.pos.x,self.pos.y,20) | |
end | |
function Ball:touched(touch) | |
-- Codea does not automatically call this method | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment