ca0e8212
Geoffrey PREUD'HOMME
Code original
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
bush = class:new()
function bush:init()
self.x = math.random()*100
self.y = math.random()*20+57
self.i = math.random(2)
self.speed = 50
end
function bush:update(dt)
if not rockets or rockets[1].x > 50 then
self.x = self.x - self.speed*dt
end
if self.x < - _G["bush" .. self.i .. "img"]:getWidth() then
self.x = 100
self.y = math.random()*20+57
self.i = math.random(2)
self.speed = 50
end
end
function bush:draw()
draw(_G["bush" .. self.i .. "img"], self.x, self.y)
end
|