local ge = require("game") local Ball = ge.Role:extend() do function Ball:step(t) ge.Role.step(self, t) if self.position.x < -self.game.size.x/2 then self.velocity:multiply(-1, 1) end if self.position.y < -self.game.size.y/2 then self.velocity:multiply(1, 0) end if self.position.x > self.game.size.x/2 then self.velocity:multiply(-1, 1) end if self.position.y > self.game.size.y/2 then self.velocity:multiply(1, -1.1) self.game:playsound("ding") end end end return Ball