Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Balon = {x = 0, y = 0, vx = 0, vy = 0}
- function Balon:new(o, x, y)
- o = o or {}
- setmetatable(o, self)
- self.__index = self
- self.x = x or 400
- self.y = y or 200
- return o
- end
- function Balon:print_pos()
- print(string.format("x: %s, y: %s",self.x, self.y))
- end
- function Balon:obtener_pos()
- return self.x, self.y
- end
- function Balon:definir_pos(x, y)
- ultima_actualizacion = os.time()
- self.x = x
- self.y = y
- end
- function Balon:dibujar()
- local x, y = self.x, self.y
- particula(1, x, y-5)
- particula(1, x-5, y)
- particula(1, x+5, y)
- particula(1, x, y+5)
- end
- particula = tfm.exec.displayParticle
- ultima_actualizacion = os.time()
- local balon = Balon:new(nil)
- local nombre = "Saintgio"
- function eventLoop(elapsedTime, remainingTime)
- if os.time()-ultima_actualizacion > 400 then
- balon:definir_pos(tfm.get.room.playerList[nombre].x, tfm.get.room.playerList[nombre].y)
- end
- balon:dibujar()
- end
- function eventKeyboard(playerName, keyCode, down, xPlayerPosition, yPlayerPosition)
- balon:definir_pos(xPlayerPosition, yPlayerPosition)
- end
- for _, keyCode in pairs({0,1,2,3}) do
- system.bindKeyboard(nombre, keyCode, true)
- system.bindKeyboard(nombre, keyCode, false)
- end
Advertisement
Add Comment
Please, Sign In to add comment